How can I list the names of all the bodies in the Mechanical tree through ACT?

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 864
500 Comments Photogenic Name Dropper Solution Developer Community of Practice Member
✭✭✭✭
edited June 2023 in Structures

How can I list the names of all the bodies in the tree through ACT ?

Tagged:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 864
    500 Comments Photogenic Name Dropper Solution Developer Community of Practice Member
    ✭✭✭✭
    Answer ✓

    One can create a loop to go through all the parts and bodies in the model and use print command to print the name. Here is a script example :

        geo = ExtAPI.DataModel.Project.Model.Geometry
        for part in geo.Children:
            for body in part.Children:
                print(body.Name)