Changing viewport to fit boundingbox of objects

Is there a clever/easy/fast way in Grasshopper to change the viewport zoom to fit a bounding box around a set of objects…fex so that the viewport is centered on the BB, and the BB is zoomed to be 1/3 the height or width of the active viewport (without changing the viewport)

I want to use it automatically capture screenshots with a predictable amount of space around the object.

Hej Anders -

You can use the Zoom Extents component:

-wim

See if this works for you:

I’m not sure that ZoomExtends will do the trick (there is a lot of context in the view and I want to zoom on a subset of surfaces (a building), but maybe I could scale the BB and the ZoomSelected…

Thank you Anders, I’ll give it a spin to see if it works as well as I think it might

thanks

1 Like

Hej Anders -

The component is fed with the object(s) to zoom to.
-wim

Hi Win,
I’m struggling a little with the tool and can’t get it to change the viewport…I’m sure that I’m using it wrong…please help

I didn’t quite get it either, but FWIW the script I posted works (on Rhino 7 too) :man_shrugging:

You’ll need to push the change into the document, via the Content Cache component