Home > OS >  Recognizing MainBody in PartBodies in a catia part using VBA
Recognizing MainBody in PartBodies in a catia part using VBA

Time:04-27

Catia contains a body that cannot be deleted in its tree structure in a part and boolean operations on that body cannot be performed (except "remove lump"), this body is called MainBody (i have read about it on different pages not sure whether it's called MainBody).

so the question is, how to recognize Mainbody in catvba (code).

any help is appreciated thanks.

This image shows Mainbody a Part

This image shows a Normal Partbody in the same Part

CodePudding user response:

The MainBody is accessible directly from the Part (for example):

Set oMainBody = CATIA.ActiveDocument.Part.Mainbody

Also, this body belongs to the Bodies-Collection of the part.

CodePudding user response:

Thanks for the earlier answer it was very useful, I have a follow-up question though, how can I compare 2 bodies in CATIA (not using individual parameters like name, because 2 bodies can have the same name). and if the bodies are exactly the same then perform some action, I tried this but I got an error, saying the object doesn't support the property.

Set oMainBody = thePart.MainBody
For i = 1 To no_of_bodies
    Set body_xyz = thePart.Bodies.Item(i)
    If (oMainBody = body_xyz) Then
        x = x   1
    End If
Next
  • Related