Description
Set the display mode of all detail view (on all layouts). Useful to quickly set all detail views of all layouts to “Hidden” display mode when using VisualArq.
See also
SetDetailDisplayModeAllLayouts script.
Author and license
Script by MLAV.LAND, licensed under the GNU GPL 3 License.
Code
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
def SetDetailDisplayModesForAllLayouts():
modes = Rhino.Display.DisplayModeDescription.GetDisplayModes()
mode = None
modeNum = 0
if 'DETAIL_MODE' in sc.sticky:
modeNum = sc.sticky['DETAIL_MODE']
if len(modes) > 1:
go = Rhino.Input.Custom.GetOption()
go.SetCommandPrompt("Select display mode")
str_modes = [m.EnglishName.replace(" ", "").replace("-", "") for m in modes]
go.AddOptionList("DisplayMode", str_modes, modeNum)
if go.Get() == Rhino.Input.GetResult.Option:
modeNum = go.Option().CurrentListOptionIndex
mode = modes[modeNum]
sc.sticky['DETAIL_MODE'] = modeNum
else:
mode = modes[0] if modes else None
if not mode:
return
# Disable screen redraw to prevent 'flashing'
sc.doc.Views.RedrawEnabled = False
try:
for pageView in sc.doc.Views.GetPageViews():
pageView.SetPageAsActive()
dets = pageView.GetDetailViews()
if not dets: continue
for det in dets:
pageView.SetActiveDetail(det.Id)
det.Viewport.DisplayMode = mode
det.CommitViewportChanges()
pageView.SetPageAsActive()
finally:
# Re-enable screen redraw and refresh all views
sc.doc.Views.RedrawEnabled = True
sc.doc.Views.Redraw()
if __name__ == '__main__':
SetDetailDisplayModesForAllLayouts()