When I execute the following code, which is the last part of a Python script for importing pointclouds:
# Specify the final view to display at end of script.
final = 'Perspective'; final_view = None
# Get list of all views.
allviews = doc.Views.GetViewList(True, True)
# Process each view to remove clutter (axes & grid), switch to Wireframe view and fit cloud to view.
for view in allviews:
viewport = view.ActiveViewport
viewport.ConstructionAxesVisible = False
viewport.ConstructionGridVisible = False
viewport.WorldAxesVisible = False
viewport.DisplayMode = wireframe
# Maximize view so ZoomBoundingBox can fill view with cloud.
if view.MainViewport.Name != final:
view.Maximized = True
ZoomBoundingBox(bBox)
# Save view for displaying last.
else: final_view = view
# Now make final view full screen.
if final_view:
final_view.Maximized = True;
ZoomBoundingBox(bBox)
I get this:
where all the view are indeed zoomed to the bounding box except the perspective view. If I change the code to this, where for the Perspective view I use ZoomExtents:
# Specify the final view to display at end of script.
final = 'Perspective'; final_view = None
# Get list of all views.
allviews = doc.Views.GetViewList(True, True)
# Process each view to remove clutter (axes & grid), switch to Wireframe view and fit cloud to view.
for view in allviews:
viewport = view.ActiveViewport
viewport.ConstructionAxesVisible = False
viewport.ConstructionGridVisible = False
viewport.WorldAxesVisible = False
viewport.DisplayMode = wireframe
# Maximize view so ZoomBoundingBox can fill view with cloud.
if view.MainViewport.Name != final:
view.Maximized = True
ZoomBoundingBox(bBox)
# Save view for displaying last.
else: final_view = view
# Now make final view full screen.
if final_view:
final_view.Maximized = True;
ZoomExtents()
then I get the expected result:
but this takes much longer as Rhino now has to compute the bounding box for the large, 238M pts pointcloud so it can zoom to its extents.
Why does ZoomBoundingBox not work the way I expected for the Perspective view? Is it because ZoomBoundingBox does not take into account the orientation of the Perspective view whereas ZoomExtents doew? If so is there a way to adjust the bounding box so that ZoomBoundingBox gives the same result as ZoomExtents? @dale
Regards,
Terry.