GH C# Component that Saves Rhino File


Im looking to make a preferably C# component in Grasshopper that when toggled by a Button saves the active Rhino Document.

Thank you,

Doe any of this help?

You can write out ActiveDoc.

This is what i tried

private void RunScript(bool Check, ref object SaveRhino)
//Save Rhino File
SaveRhino = RhinoDoc.ActiveDoc.Save(Check);

This is the error i got “1. Error (CS1501): No overload for method ‘Save’ takes 1 arguments (line 71)”

Not sure what to do here.

The method doesn’t take any arguments, but returns a boolean. Here’s a quick GHPython example that also checks if the file has been saved first: (3.4 KB)

Edit: The Save method appears to return false, but one can script the _Save command as a workaround: (2.6 KB)

In case you’re solely after a C# block.

Input to the C# block:
path(string) = Full path name with file extension
run(bool) = Boolean toggle (10.1 KB)

Personally I would use GhPython like AndersDeleuran above if it’s needed on the spot.

Nice one - thankyou. How’ve you managed to avoid “Old” from displaying over the top of the component, may I ask?