udda
udda

Reputation: 93

hide nodes in a 3D model - forgeviewer

I want to hide specific set (an array of dbIds) of nodes in the model.

I tried using this example but it hides all the nodes.

What would be the best way to get this done.

viewer version - 6.*

Thank you in advance.

Upvotes: 0

Views: 499

Answers (1)

Petr Broz
Petr Broz

Reputation: 9934

The approach explained in the linked article uses an internal implementation (viewer.impl) so we cannot guarantee it will be available in newer versions of the viewer. A cleaner approach would be to simply hide the elements using the official hide method, and then disabling the "Ghost hidden objects" viewer option: enter image description here

If you still need to completely disable an element in the scene, try the following approach:

function disableElement(viewer, model, dbid) {
    const frags = model.getFragmentList();
    const tree = model.getInstanceTree();
    tree.enumNodeFragments(dbid, function (fragid) {
        frags.setFragOff(fragid, true);
    });
    viewer.invalidate(true, true, true);
}

Upvotes: 3

Related Questions