Yury Apanasik
Yury Apanasik

Reputation: 113

How to initialize empty viewer

I have tried to start viewer without model:

var viewer = new Autodesk.Viewing.Private.GuiViewer3D(viewerElement);

const forgeOptions = {
    env: 'AutodeskProduction',
    accessToken: scope.token
};

Autodesk.Viewing.Initializer(forgeOptions, () => {
    viewer.start();
});

After that I get viewer with loader in center (without panels).

If I set model urn in start() method all panels are loaded. I can remove this model and I get empty viewer with panels and bars.

How can I get empty loaded viewer without cheat with model load/unload?

Upvotes: 1

Views: 654

Answers (1)

Eason Kang
Eason Kang

Reputation: 7115

Unfortunately, the UIs of the GuiViewer3D is created after model loading currently. And the viewer doesn't support empty model mode, so you might have to load one model at least.

However, there is a workaround to archive this. You can load a dummy model which contains two very very tiny points like the maximum and minimum points of a bounding box to make it look like there is no model loaded. Before loading new models, you have to unload this dummy model firstly and call Viewer3D.tearDwon() to release some memories.

P.S. This is just a workaround, not the formal solution, you might have to use it at your own risk.

Upvotes: 1

Related Questions