algorithmic modeling for Rhino
I received a random question in my email about how to programmatically launch a file dialogue to save a Grasshopper file.
Using a C# component you could drive this with a Boolean Toggle like so:
GH_DocumentIO docIO = new GH_DocumentIO(GrasshopperDocument);
if (save) docIO.Save();
If you want the document to automatically detect whether or not it's been saved and, if it hasn't, immediately launch the file save dialogue, do this:
GH_DocumentIO docIO = new GH_DocumentIO(GrasshopperDocument);
if (GrasshopperDocument.FilePath == null) docIO.Save();
Note that the GrasshopperDocument object exists as a Member in the C# component, otherwise you'd have to call it like this:
GH_Document doc = Grasshopper.Instances.ActiveCanvas.Document
Tags:
Thank you! Please tell me how to set the file name when saving?
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by