pyrevitlabs/pyRevit

Add option to "Toggle All Grids Bubbles" to toggle bubbles at the sides of the view (top|bottom, left|right)

eirannejad opened this issue · 2 comments

From pyRevit fan:

"toggle all grids bubbles in current view" is it possible to choose either the top bubbles on the sheet or bottom bubbles on the sheet to turn a whole set of those on or off? Or is the only option is to turn all of the grids on or off regardless of if they're on top or bottom, left or right?

No directionality implemented in the code
https://github.com/pyrevitlabs/pyRevit/blob/master/extensions/pyRevitTools.extension/pyRevit.tab/Drawing%20Set.panel/views.stack/Views.pulldown/Toggle%20All%20Grid%20Bubbles%20in%20Current%20View.pushbutton/script.py

All on or off.
Closest and easiest thing would be to add option for end0 or end1, but that would all depend on what was the first and second drawing point.

not fully automated , but flipping grids much easier using multi-selections.

doc = revit.doc
active_view = doc.ActiveView

grids = revit.get_selection()

if not grids:
    forms.alert('No Grids selected!', exitscript=True)
end_0 = []
end_1 = []

with revit.Transaction('Flip Grids'):
    for grid in grids:
        # Define Ends
        end_0 = grid.IsBubbleVisibleInView(DB.DatumEnds.End0, active_view)
        end_1 = grid.IsBubbleVisibleInView(DB.DatumEnds.End1, active_view)

        if end_0:
            grid.HideBubbleInView(DB.DatumEnds.End0, active_view)
        else:
            grid.ShowBubbleInView(DB.DatumEnds.End0, active_view)

        if end_1:
            grid.HideBubbleInView(DB.DatumEnds.End1, active_view)
        else:
            grid.ShowBubbleInView(DB.DatumEnds.End1, active_view)