How do I select bodies by centroid in DesignModeler scripting?
Landon Mitchell Kanner
Member, Employee, GitHub-issue-creator Posts: 316
✭✭✭✭
in Structures
Answers
-
centroid = [0.25, 1.5, 4.5] tolerance = 0.001 bodies_to_select = [] for body in ExtAPI.DataModel.GeoData.Bodies: if abs(body.Centroid[0] - centroid[0]) < tolerance: if abs(body.Centroid[1] - centroid[1]) < tolerance: if abs(body.Centroid[2] - centroid[2]) < tolerance: bodies_to_select.append(body) ExtAPI.SelectionManager.ClearSelection() ExtAPI.SelectionManager.AddSelection(bodies_to_select)
0