I am able to write recursive subroutines that cycle thru all the Geometrical Sets and Ordered Geometrical Sets without issue, because there is a collection under each GS and OGS for HybridBodies and OrderedGeometricalSets, respectively. However, when I find the Part-Level (Root-Level) Bodies, there is not a Bodies collection inside it. So, when I have a model with multiple aggregated Boolean operation Bodies inside of a body, I can't find them in the standard collections operation in VBA, C#.net, or VB.net.
How can I find these Bodies inside of a Body?
This took a while to figure out, and I'm definitely posting it on the web because it's barely documented.
The problem with Bodies automation is the fact that all bodies are stored in the part level collection. I didn't see that at first, because I'm used to the Geometrical Set and OGS recursion when working with CATIA spec tree navigation.
But the fact that all bodies are stored in the root level collection is actually more of a hindrance than a benefit, because it does not allow for recursive cycling.
I tried to use the selection object searching to find aggregated bodies, but it was too buggy and cumbersome to figure it out.
The best solution for determining if a Body is aggregated via Boolean solids operation in another Body is to use the "InBooleanOperation" method. This is not very well documented and that's why I'm posting it here.
It returns a simple true or false. Like this:
As for finding the parent of a nested Body, I haven't figured it out yet, but I'll post it once I do.