How can I get all actual bodies in a part? Not the bodies that are consumed by boolean operations.
For example if you have 3 extrudes and you unite them all to 1 solid body. There is only 1 actual solid body in your part.
The collection "s.parts.work.bodies" will return all bodies from the extrudes even before the unite. While selecting in the interface all bodies returns me only 1 body (the actual and only solid body in the part)
Is there a way to detect these contruction bodies? Or how to get the actual solid body in the part?
Solved! Go to Solution.
Are you using the "keep tool" option in your booleans? In my test file, multiple bodies are reported when this option is turned on (as expected), but only 1 body is reported when it is turned off.
No, the "keep tool" option is not used in this file.
Attached my NX9 part and journal.
In the journal, there are 2 different methods to count the bodies, where i expect both to return 1 body.
The first method returns 11 bodies and the second 13 bodies.
That is even stranger that both methods return different number of bodies, but i haven't looked into that yet.
According to GTAC, I need to check if the body is on a "system" layer.
Then I get only 1 body like I needed. All bodies on layers >256 are not really there for the user...
Sub Main() Dim ii As Integer = 0 For Each body1 As Body In s.Parts.Work.Bodies If body1.IsSolidBody And body1.Layer < 257 Then Echo(body1.ToString & " - Layer: " & body1.Layer.ToString) ii += 1 End If Next Echo("Body count = " & ii, True) End Sub