-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClipSelGUIMultiple.py
27 lines (19 loc) · 997 Bytes
/
ClipSelGUIMultiple.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
def ClipSel():
selection_settings = Rhino.DocObjects.ObjectEnumeratorSettings()
selection_settings.ObjectTypeFilter = Rhino.DocObjects.ObjectType.ClipPlane
clip_planes_iterator = sc.doc.Objects.GetObjectList(selection_settings)
# getobjectlist methods yields an iterator that gets exhausted
# line below converts it into an immutable list
clip_planes = list(clip_planes_iterator)
clip_plane_names = [clip_plane.Name for clip_plane in clip_planes
if clip_plane.Name is not None]
selected_clip_planes = rs.MultiListBox(sorted(set(clip_plane_names)))
if selected_clip_planes == None:
return
selected_clip_planes_guids = [clip_plane.Id for clip_plane in clip_planes
if clip_plane.Name in selected_clip_planes]
rs.SelectObjects(selected_clip_planes_guids)
ClipSel()