Hi,
I’ve got an issue when trying to ZoomExtents a DetailViewObject:
*If I set as active the detailView it seems to work, but as soon as I set back as active the pageView, everything is cancelled.
*Even stanger: If I breack the code with a dummy user action, it works! (for exemple: RhinoGet.GetBool(“PressEnterToContinue”, True, “”, “”, True)
I think this some kind of commit bug, here is my code:
`Dim CoverSheetpageview As Rhino.Display.RhinoPageView = TryCast(doc.Views.ActiveView, Rhino.Display.RhinoPageView)
CoverSheetpageview.PageName = "CoverSheet"
Dim CoverSheetdetailview As Rhino.DocObjects.DetailViewObject = CoverSheetpageview.GetDetailViews(0)
CoverSheetpageview.SetActiveDetail(CoverSheetdetailview.Id) 'activer le premier détail de la page en cours (a généraliser)
CoverSheetdetailview.Viewport.ZoomExtents()
CoverSheetdetailview.CommitViewportChanges()
CoverSheetdetailview.CommitChanges()
CoverSheetpageview.Redraw()
'Désactiver le détail
RhinoGet.GetBool("PressEnterToContinue", True, "", "", True)
CoverSheetpageview.SetPageAsActive()
doc.Views.ActiveView = CoverSheetpageview
CoverSheetpageview.Redraw()`
Protected Overrides Function RunCommand(ByVal doc As RhinoDoc, ByVal mode As RunMode) As Result
Dim pageView = TryCast(doc.Views.ActiveView, RhinoPageView)
If pageView Is Nothing Then
Return Result.Failure
End If
Dim details = pageView.GetDetailViews()
If details Is Nothing OrElse 0 = details.Length Then
Return Result.Failure
End If
pageView.PageName = "CoverSheet"
For Each detail As DetailViewObject In details
pageView.SetActiveDetail(detail.Id)
detail.Viewport.ZoomExtents()
detail.CommitViewportChanges()
pageView.Redraw()
RhinoApp.Wait()
Next
pageView.SetPageAsActive()
pageView.Redraw()
Dim tmp As String = Nothing
RhinoGet.GetString("Press <Enter> to continue", True, tmp)
doc.Views.ActiveView = pageView
Return Result.Success
End Function
@dale, i think i am facing a similar problem with zooming in a detail viewport using Rhino 5 SR12. There clearly is a bug, i am trying to zoom to a bounding box like this:
It seems that ZoomBoundingBox(bbox) does always zoom to the extents of the document content. If i add a point, very far away from my drawing which is not part of the bounding box i pass to the ZoomBoundingBox method, it zooms so this point is included.
If i select something during above code using rs.Command() and then use ZoomBoundingBoxSelected(), it also includes the point which is not selected and far away. How can i make it zoom the bounding box i passed ?
btw. under which circumstances does ZoomBoundingBox(bbox) return False ?
I haven’t had the attention span to figure out why you code isn’t working. So I’ve opened an issue so I can spend some time determining if this a bug or not.