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: 715
First Comment First Anniversary Ansys Employee 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: 715
    First Comment First Anniversary Ansys Employee 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)