I am attempting to zoom to a set of objects in multiple detail views.
I have constructed a test sample script, the test works as anticipated when I call detail.ZoomExtents(), however when I replace detail.ZoomExtents with detail.ZoomBoundingBox(bb) the detail views are unchanged. I am creating a BoundingBox object so I’m not sure why this is not functioning.
def Zoom_All(Objs,type): bb=rs.coerceboundingbox(rs.BoundingBox(Objs)) for layout in scriptcontext.doc.Views.GetPageViews(): #Get all layouts in document scriptcontext.doc.Views.ActiveView = layout #Set layout to active view for detail in layout.GetDetailViews(): #Get all detail in each layout if detail.DetailGeometry.IsProjectionLocked==True: #Test if deatil is locked detail.DetailGeometry.IsProjectionLocked=False #Lock detail so we can edit it detail.CommitChanges() #Unlock the detail layout.SetActiveDetail(detail.Id) #Set detail to active if type=="ZE": detail.Viewport.ZoomExtents() elif type=="ZS": detail.Viewport.ZoomBoundingBox(bb) detail.CommitViewportChanges() layout.Redraw() Rhino.RhinoApp.Wait()
If anyone has come across this error or has other ideas on how to fix this problem that would be excellent.