ZoomBoundingBox() Error

Greetings,
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.
Thanks,
5chmidt

I haven’t studied your code all that much. But perhaps you could redraw the detail not the layout?

Rhino.DocObjects.DetailViewObject has no Redraw function neither does Rhino.Display.RhinoViewport. How would I set the detail to redraw? I was working under the assumption was that if the code worked for ZoomExtents(), which it does, then the same formatting should also work for ZoomBoundingBox(). In the above test script I am passing in a set of objects and a string that will run either ZoomExtents or ZoomBoundingBox while leaving the rest of the code the same. When I keep the same set of objects and pass in “ZS” nothing happens, the details do not change their view, however when I pass in “ZE” all details zoom to the model extents as anticipated.

I’ll take a look into the issue with ZoomBoundingBox. In the mean time, you just make sure the objects are selected and call ZoomExtentsSelected.

– Dale

@5chmidt - I recently had a similar issue applying Viewport changes to a detail, starting with the boilerplate Layout and Detail creation example, as found in the documentation for RhinoPageView.SetActiveDetail Method
The solution was to use SetActiveDetail, make only viewport changes, then use CommitViewportChanges().
This helped with using RhinoViewport.ZoomBoundingBox and RhinoViewPort.SetCameraTarget