GHPython Zoom to preview geometry

Hello there,

I was wondering if somebody could tell me how to access the “Zoom to preview geometry” from GHPython.

Thank you!

maybe something like this?
x input: Item access\Geometry Base
y input: Item access\Boolean

import Rhino

def Zoom2Geo():
    BBox = x.GetBoundingBox(True)
    vp = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport

if y:

connect one gh geometry object into x, connect a button into y.


It works perfectly! Thank you so much. I thought somehow that RhinoDoc.[…].ActiveViewport wouldn’t work to preview unbaked geometries in Grasshopper, but obviously that is due to my lack of scripting skills :slight_smile:
Thanks again!