-
-
Notifications
You must be signed in to change notification settings - Fork 325
/
script.py
43 lines (35 loc) · 1.27 KB
/
script.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""Toggle all/selected grid bubbles in the active view."""
#pylint: disable=E0401
from pyrevit import forms
from pyrevit import revit, DB
all_grids = DB.FilteredElementCollector(revit.doc)\
.OfCategory(DB.BuiltInCategory.OST_Grids)\
.WhereElementIsNotElementType().ToElements()
selected_option = \
forms.CommandSwitchWindow.show(
['Show Bubbles',
'Hide Bubbles'],
message='Select option:'
)
if selected_option:
hide = True
if selected_option == 'Show Bubbles':
hide = False
grids = []
selection = revit.get_selection()
if selection:
grids = [x for x in selection if isinstance(x, DB.Grid)]
else:
grids = all_grids
try:
with revit.Transaction('Toggle Grid Bubbles'):
for grid in grids:
if hide:
grid.HideBubbleInView(DB.DatumEnds.End0, revit.active_view)
grid.HideBubbleInView(DB.DatumEnds.End1, revit.active_view)
else:
grid.ShowBubbleInView(DB.DatumEnds.End0, revit.active_view)
grid.ShowBubbleInView(DB.DatumEnds.End1, revit.active_view)
except Exception:
pass
revit.uidoc.RefreshActiveView()