Highlight remote points associated with a selected body.
Ayush Kumar
Member, Moderator, Employee Posts: 444
✭✭✭✭
in Structures
Comments
-
Assuming you have scoped 1 face in each remote point of your project. The following code will highlight all remote points associated with a selected body. Tested with 2024R1.
from itertools import chain from collections import defaultdict def flatten_chain(matrix): return list(chain(*matrix)) body_id = ExtAPI.SelectionManager.CurrentSelection body = ExtAPI.DataModel.GeoData.GeoEntityById(body_id.Ids[0]) face_ids = [face.Id for face in body.Faces] rps = ExtAPI.DataModel.Project.Model.RemotePoints.Children rps_dict = defaultdict(list) for rp in rps: rps_dict[str(list(rp.Location.Ids))].append(rp) filtered_rps_temp = [] for face_id in face_ids: filtered_rps_temp.append(rps_dict[str([face_id])]) filtered_rps = flatten_chain(filter(None, filtered_rps_temp)) ExtAPI.DataModel.Tree.Activate(filtered_rps) ExtAPI.SelectionManager.ClearSelection()
0