I’m lost with an attempt to change a large number of Detail Views all at once. I have a script from @willem which is useful when I’m working page after page.
I found the script by @Dale to change all Detail View modes to Wireframe but I had no luck so far with the additions I made.
What needs to be done to change the view in each detail to its matching Named View?
For now, there are equal numbers of layouts and Named Views.
import Rhino import rhinoscriptsyntax as rs import scriptcontext as sc namedviews = rs.NamedViews() # Demonstrates how to set all detail views to wireframe display def SampleSetDetailsToWireframe(): # Find the wireframe display mode object display_mode = Rhino.Display.DisplayModeDescription.FindByName("Wireframe") if display_mode: # Get all of the document's page views page_views = sc.doc.Views.GetPageViews() if page_views: # Process each page view for page_view, namedview in zip(page_views, namedviews): print page_view # Get all of the page view's details details = page_view.GetDetailViews() print details print namedview if details: # Process each page view detail for detail in details: # If the detail's display mode is not wireframe... if detail.Viewport.DisplayMode.Id != display_mode.Id: # ...set it to wireframe. detail.Viewport.DisplayMode = display_mode detail.CommitViewportChanges() # Redraw the page view page_view.Redraw() # Check to see if this file is being executed as the "main" python # script instead of being used as a module by some other python script # This allows us to use the module which ever way we want. if __name__ == "__main__": SampleSetDetailsToWireframe()
restore_named_views.py (1.6 KB)