algorithmic modeling for Rhino
Hey all,
I am working on a python component that automates the generation of folders and saving out of both the active grasshopper document and active rhino document with names that are inputted. The following code works perfectly for gh, but can't see a similar way to do this for Rhino without first generating a new file and populating it with geometries, which I am trying to avoid... you can see right now all I generate is a blank Rhino file.
Can anyone show me how to SaveAs the current rhino document via python or C#. I don't find a rhinoscript command that works, which worries me that it's not that easy.
Thanks so much, David
if WRITE_DATA == True:
# create folder for files if not already created
if not os.path.exists(folder_path):
os.makedirs(folder_path)
# create blank Rhino file
f = io.File3dm()
f.Polish()
RH_Write = f.Write(rh_file_name, 5)
f.Dispose()
# save out active grasshopper file
f = gs.GH_RhinoScriptInterface()
GH_Write = f.SaveDocumentAs(gh_file_name)
Tags:
Answered my own question... for those interesting.
use Rhino.RhinoDoc.ActiveDoc.WriteFile()
you give it two arguments, the file path, and an object of Rhino.FileIO.FileWriteOptions()
Thanks David for this update, you just saved my day! I was trying to build a File3dm ObjectTable from scratch which was quite cumbersome :-)
glad it helped...
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