'Hiding level in viewer Autodesk Forge
Solution 1:[1]
First, you have to collect all elements from your model:
const instanceTree = model.getData().instanceTree;
const rootId = instanceTree.getRootId();
function getAllDbIds(rootId, instanceTree) {
var alldbId = [];
if (!rootId) {
return alldbId;
}
var queue = [];
queue.push(rootId);
while (queue.length > 0) {
var node = queue.shift();
alldbId.push(node);
instanceTree.enumNodeChildren(
node,
function (childrenIds) {
queue.push(childrenIds);
}
);
}
return alldbId;
};
Second - get all elements with the name "Level"
const levelId = allIds.filter((x) => instanceTree.getNodeName(x).includes("Level"))
Third step - remove elements by Id in the viewer:
viewer.impl.visibilityManager.setNodeOff(levelId, true)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Roman Lavrov |