Component.GetChildren Issues.

Hello,

I am having some trouble using the Component.GetChildren method with certain parts in my assembly. On parts that are unloaded, sometimes they won't retrieve their children using the aforementioned method (repeatable for specific parts). Only when they're loaded they will properly return an array of their children. There is no solid geometry in the children that aren't being reported, so I assumed they were Non-geometric components.

I've checked for "Non-geometric components" by right clicking on the child -> properties, and "Component is Non-Geometric" isn't checked, so I do not think that is impacting my journal. Is there something else that can inhibit the Component.GetChildren method? Or should parts be loaded before I attempt to ask for their children?

The journal properly returns the children of most other unloaded parts in my assembly, it only seems to be impacting specific parts.

Please let me know if there's additional information I can provide to help troubleshoot this, thank you.

If the parts are not loaded, I would not expect .GetChildren to return anything useful. I've not tested this, but perhaps NX will try to load the parts when you call .GetChildren; if so, the call will only be successful if NX can find the components based on your current load options.

I figured out the issue. It involved performing a structure update on a component if I expected it to have children, but its .GetChildren.Length = 0

Function StructureUpdate(ByVal comp As Component)
If comp.GetChildren().Length = 0 Then
Dim comps(0) As Component
comps(0) = comp
comp.Parent.UpdateStructure(comps,1)
If comp.GetChildren().Length() > 0 Then
StructUp = True
End If
End If
End Function