ZoomBoundingBox not working in Perspective view

@dale, @stevebaer,

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.

Hi @Terry_Chappell,

Since you are scripting, why not just script the _Zoom _Extents command?

– Dale

Performance is lower with ZoomExtents. This is why I went to the trouble of using ZoomBoundingBox; its 10x faster when you already have the bounding box. Perhaps I just need to transform the bbox in some way so that perspective view is fit better. Ideas?

Hi @Terry_Chappell,

Can you provide me a sample model and some code that repeats this lack of zooming in perspective-projected views?

Thanks,

– Dale

Dale,

Yes I will work on getting you an example tomorrow. Now watching Celebrate America following inauguration earlier today. Thanks for helping,

Together we will overcome all obstacles.

Regards,
Terry.