algorithmic modeling for Rhino
Hey everyone,
i hope this is a simple question. I would like to save the active grasshopper and rhinofile from inside the python component. But i was not able to find a working solution in the Grasshopper SDK or Google ...
Thank you all for Help :)
Tobi
Tags:
Hi Tobias
here is how to do it:
import Grasshopper as gh
import osif active:
canvas_doc = ghenv.Component.OnPingDocument()
old_path = canvas_doc.FilePath
canvas_doc.FilePath = os.path.expandvars("%userprofile%\desktop\save_me.gh")
try:
if canvas_doc:
gh.Kernel.GH_DocumentIO(canvas_doc).Save()
finally:
canvas_doc.FilePath = old_path
import Rhinoif active:
options = Rhino.FileIO.FileWriteOptions()
options.SuppressDialogBoxes = True
Rhino.RhinoDoc.ActiveDoc.WriteFile(
os.path.expandvars("%userprofile%\desktop\save_me.3dm"), options)
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Thank you a lot :)
It worked perfectly fine !
I am really happy about this fast and helpful answer.
Have a nice evening
Tobias
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
© 2024 Created by Scott Davidson. Powered by