0

I am looking to determine if a node is an assembly or a part. I have looked through the viewer3D.js code and came across the below flags:

enter image description here

Although when I work access these flags, the result is always 0 for all nodes regardless whether it is a GEOMETRY, COMPOSITE OR ASSEMBLY.

Are these flags currently in use? Or are they legacy code that is no longer being used?

Neil_M
  • 462
  • 5
  • 17

1 Answers1

0

You can simply check if the node has children or not. Only leaf nodes have geometry. I don't know of a more direct way to do that

 const instanceTree = viewer.model.getData().instanceTree

 var childCount = 0 

 instanceTree.enumNodeChildren(nodeId, (childId) => {

     ++childCount
 })

 if (childCount) {

   //this is an "assembly" node
 }
Felipe
  • 4,325
  • 1
  • 14
  • 19