How can I use the Selection Manager?

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

How can I use the Selection Manager to scope a body?

Tagged:

Best Answer

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

    Below is an example of using the selection manager to apply a meshing method to a body:

        # create a new empty selection
        tempSel = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
        # provide list of Ids of entities to select
        tempSel.Ids = [4]
        # create new meshing method
        newMethod = ExtAPI.DataModel.Project.Model.Mesh.AddAutomaticMethod()
        # assign location
        newMethod.Location=tempSel
    

    Other useful commands are:

    • to clear the current selection:

         ExtAPI.SelectionManager.ClearSelection()
      
    • to get the IDs of the entities currently selected in the UI:

        ExtAPI.SelectionManager.CurrentSelection
      

Answers