Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have tried setting up Forge Viewer in headless mode using the following link: https://forge.autodesk.com/en/docs/viewer/v6/tutorials/headless.

I have hard-coded the URN and the access token but the model is not displaying.

Please provide any sample source code to load the model.

question from:https://stackoverflow.com/questions/65888875/load-model-by-headless-viewer

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.8k views
Welcome To Ask or Share your Answers For Others

1 Answer

Here's a couple of tips:

  1. Check the browser console. Perhaps the URN or the access token is incorrect, which is why the model does not load.

  2. The link you're working with is for an older version of Forge Viewer (v6). I'd suggest using version 7.*. Try using this basic app as a starting point: https://github.com/petrbroz/forge-basic-app, and replace this line of code:

const viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('preview'));

with

const viewer = new Autodesk.Viewing.Viewer3D(document.getElementById('preview'));

With this I've been able to load a model with a headless viewer:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...