kabirbaidhya
kabirbaidhya

Reputation: 3490

Forge Viewer: Need to hide all the elements like in isolated view

Using the isolate() method I can isolate few elements and hide everything else like this: viewer.isolate([65, 80, 83, 92]); enter image description here

But is it possible to hide all the elements like the hidden elements of the isolated view?

I tried doing viewer.isolate([]);

But that would show all the elements instead.

What I need instead is to be able to hide all the elements and show only the semi-transparent view like in the isolated state.

Is there a way to do this?

Thanks

Upvotes: 0

Views: 2870

Answers (3)

r.schmitt
r.schmitt

Reputation: 53

found an easy global setting for ghosting: Viewer3d.setGhosting(bool)

var viewer = NOP_VIEWER;
viewer.setGhosting(false);

this will turn off the visibility of the non-isolated elements completely

Upvotes: 2

Felipe
Felipe

Reputation: 4375

Another solution might be as follow ...

var instanceTree = viewer.model.getData().instanceTree
var rootId = instanceTree.getRootId()
viewer.hide(rootId) // hidding root node will hide whole model ...

Upvotes: 5

Augusto Goncalves
Augusto Goncalves

Reputation: 8604

For a list of dbIds, you can call the following (for each dbId):

var n = viewer.model.getData().instanceTree.nodeAccess.nodes[dbId];
viewer.impl.visibilityManager.setNodeOff(n, true);

To show again, just replace the setNodeOff true with false.

Upvotes: 3

Related Questions