algorithmic modeling for Rhino
Let's just say you're doing something dangerous and you would like to save a copy of the current definition, as it stands, to a temporary folder (C:\ghCrashPrevention\).
There's a lot of magic in GH_IO.dll, but I really can't get my head around it.
GrasshopperDocument.Write()?
Any help would be appreciated.
Tags:
Instances.DocumentEditor.ScriptAccess_SaveDocumentAs(Pach as String)
wonderful, thanks! works like a charm. A bit confusing usability wise, as then the definition thinks it's now saved in my temp location, and not in its original place, but alas. it works.
and i'll have to rely a bit more on the autosave functionality.
Got it working with your help. The magics are all in the bloody GH_Archive class.
With some further quick digging got this to work:
string ghSavePath = Path.Combine(FOLDERLOCATION, "ghdef.ghx");
GH_Archive myArchive = new GH_Archive();
myArchive.Path = ghSavePath;
myArchive.AppendObject(GrasshopperDocument, "Definition");
myArchive.WriteToFile(ghSavePath, true, false);
The above code will dump your gh definition in the location of your choice, slient and won't clash with where the def is currently saved.
xxx
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