setNodesVisibility() forces visibility of nodes not originally visible in initial load

When i load 3d model on initial i can see below file no extra color (Blue).

But after recursively get all node from root using getNodeChildren() and settingsetNodesVisibility() call forces them visible like below. Note : this model don’t have type (BIM_Space) i have verified my question is setNodesVisiblity() unneccarryl showing wired data which was not loaded when first model load?

I have a 3D model that, when loaded initially, shows only the nodes and colors intended by the model (no extra blue overlays or other nodes visible).

However, when I recursively retrieve all nodes starting from the root using getNodeChildren() and then call setNodesVisibility() on them, the following happens:

  • Nodes that were not originally visible are now forced visible.

  • These nodes don’t belong to any specific type (like BIM_Space)—I’ve verified this.

  • It seems like setNodesVisibility() is making data visible that wasn’t actually loaded on the first render.

I expected setNodesVisibility(nodeIds, true, true) with initiallyHiddenStayHidden = true to respect the original visibility, but it doesn’t.

Question:
Is this expected behavior in Hoops Communicator? Or am I missing a recommended way to toggle visibility recursively without forcing “extra” nodes to appear?

Code snippet:

// Recursively get all children from root
const allNodes = [];
function traverse(nodeId) {
  const children = viewer.model.getNodeChildren(nodeId);
  children.forEach(child => {
    allNodes.push(child);
    traverse(child);
  });
}
traverse(rootNodeId);

// Set visibility
viewer.model.setNodesVisibility(allNodes, true, true);

Any guidance on how to preserve the model’s original visibility while manipulating nodes programmatically would be appreciated.

I want to say that the parameter initiallyHiddenStayHidden applies to a NodeType of PartInstance. But your code is setting visibility to its child node which would be BodyInstance. You can confirm with this call:

Communicator.NodeType[hwv.model.getNodeType(nodeId)];

A useful function, if you want to explore programmatically manipulating nodes, is getVisibilityState which returns the default visibility state.