Layout api SketchUpModel zoom extents



When exploring the Layout api I am missing a method to programatically perform a zoom_extents on a SketchUpModel. I am aware I can zoom extents in SketchUp on the active_view-object, however, that view’s aspect_ratio might be different than the used bounds of the SketchUpModel in Layout.
Am I missing something or will I have to calculate the zooming myself using the SketchUpModel’s aspect ratio?


I can’t answer the question regarding the API but you do realize don’t you that anything you do in LayOut with respect to modifying the SketchUp scene, including zooming the camera breaks the dynamic link from the SketchUp scene to the LayOut viewport. This is not a good idea. Users who create modified scenes in LO frequently create problems for themselves. It doesn’t take much searching to find examples of that here in the forum.


I see.
Well, then there is nothing else than altering the Sketchup scene taking the eventual layout SketchUpModel aspect ratio into account prior to placing it in Layout.


If that aspect ratio is critical to you, you could use Eneroth Viewport Resizer to set the SketchUp model window to match the paper aspect ratio.


Actually changing the viewport size prior to performing a zoom_extents on the active_view is the least preferable route I’d like to take since it’s not 100% undo-able. Toolbars might change between a viewport change and an “undo” and will thus have an implication on my users’ ux.

Anyhow, I believe I have to come up with a ruby-solution myself. No problem.


As long as your solution doesn’t result in the viewport showing the scene as modified, that should be good.


The essential actually is: I need to perform a zoom_extents on a camera with a different aspect_ratio than the active_view. If only we could do this on a Camera object, instead of a View object.