algorithmic modeling for Rhino
Hello
Does anyone know the python script to disable the grasshopper geometry preview from the Rhino python editor?
I've seen examples for disabling the preview for specific objects but I'd like to completely disable the preview.
I assume solutions will compute faster if the preview is disabled. Sometimes I forget to disable, so it would be useful to add a simple script to make sure it happens.
Tags:
Hi John, you can access the active Grasshopper document and set its preview mode like so:
import Grasshopper as gh
ghenv.Component.OnPingDocument().PreviewMode = gh.Kernel.GH_PreviewMode.Disabled
Note that GH_PreviewMode can be either Disabled, Wireframe or Shaded
Thankyou Anders
Hello Anders
I just tried this script, if I use it in the Rhino Python edit I get the message:
'ghenv' is not defined
Can I not call this function from Rhino?
ghenv is a property of the GHPython component itself (allowing us to access this component and the GH document which it lives in), which makes it difficult to access it from the scope of the EditPythonScript editor. That said, I'm pretty sure it should be possible to access Grasshopper and the currently active GH document to set the GH_PreviewMode somehow. Maybe see if you can access the Grasshopper namespace or load the Grasshopper plugin from the EditPythonScript editor and see what's possible (there are some threads on this as I recall).
Ps. I think the bigger question is why you need to operate from the EditPythonScript editor in the first place. You can always access the Rhino document from GHPython, whereas it is difficult to access the Grasshopper document from the EditPythonScript editor. So maybe it is worth reconsidering your overall logic to approaching your problem.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by