I'm struggling to zoom to extents, factoring in the Image aspect ratios

Hi Guys,

I’m trying to set up some scenes which are exportable via Ruby, so i’m adjusting the camera and adding a scene with an aspect ratio to SketchUp.

This works great, as I get the letterbox effect.

I’m then trying to zoom the model to extents, so that I can always export a complete image of the object in the shot. I have used view.zoom_extents for this (where view is the active_view)

This almost works, but unfortunately it zooms to the extents of the viewport.

Is there a way for this to be zoomed to the extents of the page/scene aspect ratio / safe area?

Do I need to do anything like page.camera.zoom_extents? (I have a feeling this doesn’t work)

Thanks again everyone.

Hi Doug!

I think I wrote something similar a while back. maybe this helps.

Btw, personally it’d make sense to me if zoom_to honored the safe frames. As I see it the “view” conceptually ends where the gray bars begin. Other programs would typically make these solid black but SketchUp is nice and visually (and technically) extends the view outside the “conceptual” view.

1 Like


I’ll need to look into this, maybe drill into the viewport resizer one. It’s really only during the operation of zoom to extents that I’m needing to get accuracy. I think once the camera is set up, it stays correct at any size viewport.

If this is an option that can be added to the API, it’d be awesome. Or if an aspect ratio exists, just treating this as the primary view bounds, it’d match a philosophy of automation as an equally valid output to the window.

page.camera.view_extents() would be sufficient to achieve the expectation for me. Instead of view.camera.zoom_extents()