How can I use the Selection Manager?
Pernelle Marone-Hitz
Member, Moderator, Employee Posts: 871
✭✭✭✭
Best 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
0
Answers
-
Additionally, see this post on how to modify the current selection:
https://discuss.ansys.com/discussion/2797/how-to-select-geometry-from-gui-though-script-highlight-in-gui-not-using-named-selection0