How can I show all bodies in Mechanical through scripting?

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 870
100 Answers 500 Comments 250 Likes First Anniversary
✭✭✭✭
edited June 2023 in Structures

How can I show all bodies in Mechanical through scripting?

Tagged:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 870
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭
    Answer ✓

    The following function can be used:

    def ShowAllBodies():
        '''
        Show all the bodies in Geometry        
        ''' 
        try:
            # log("ShowAllBodies")    
            for child in ExtAPI.DataModel.Project.Model.Geometry.Children:
                if child.DataModelObjectCategory == DataModelObjectCategory.Part:
                    child.Hidden=False            
            ExtAPI.DataModel.Tree.Refresh()
    
        except:
            ExtAPI.Log.WriteMessage("Error : Exception in ShowAllBodies()")