Zooming BoundingBox in DetailView not working correctly

Hi, I have a question that might have been asked before here:

So I try to create several layouts of items and prepare the detailview like that:
It is working for 1 single operation.
But when I execute it in a loop it is not always doing it correctly.
What am I missing?

def _SetUpView(objs, pageview, detailview):
    geos = [sc.doc.Objects.Find(id).Geometry for id in objs]
    # My method for the boundingbox
    bbox = BBox(geos, Rhino.Geometry.Plane.WorldXY).CreateBoxAroundItems(self.Geometry, Rhino.Geometry.Plane.WorldXY)

    sc.doc.Views.ActiveView = pageview
    pageview.SetPageAsActive()
    pageview.SetActiveDetail(detailview.Id)
    detailview.DetailGeometry.IsProjectionLocked = False

    detailview.Viewport.ZoomBoundingBox(bbox)
    detailview.DetailGeometry.IsProjectionLocked = True
    detailview.CommitChanges()
    sc.doc.Views.ActiveView.Redraw()

    pageview.SetPageAsActive()
    sc.doc.Views.ActiveView = pageview
    sc.doc.Views.ActiveView.Redraw()

Thanks,
T.

Hi @tobias.stoltmann,

Without being able to run your code, it’s difficult to know what doing wrong.

Have you seen this thread?

– Dale

1 Like

@dale, thanks. This works. :slight_smile:

# Give Rhino a chance to catch up...
Rhino.RhinoApp.Wait()