Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

Get actual bodies in part, not intermediate

Hi,

 

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?

 

thanks

br

Fred

5 REPLIES

Re: Get actual bodies in part, not intermediate

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.

Re: Get actual bodies in part, not intermediate

Hi Cowski,

 

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.

 

br

Fred

Re: Get actual bodies in part, not intermediate

I did some extra tests and I think this is a part specific problem/bug. I'll ask GTAC to have a look at it.

Solution
Solution
Accepted by topic author evolve
‎12-07-2016 04:44 AM

Re: Get actual bodies in part, not intermediate

Hi Cowski,

 

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...

 

br

Fred

 

 

    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

Re: Get actual bodies in part, not intermediate

Good to know. Thanks for the update.