Hi everyone,
I’ve been trying to script the „Save As“ command in Rhino Common as suggested in the earlier discussion.
I’m developing a Plug-In in C# (VS2010).
Here is the isolated Code im Runnning to export the file as a SAT file.
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string fileName = "test.sat";
path = System.IO.Path.Combine(path, fileName);
////Debug
//RhinoApp.WriteLine(path);
string command = string.Format("_-SaveAs \"{0}\" _Scheme \"Default\" _Enter", path);
//command = "-_SaveAs C:\\users\\martin\\Desktop\\test.sat Scheme Default Enter";
////Debug
//RhinoApp.WriteLine(command);
RhinoApp.RunScript(command, true);
return Result.Success;
}
The command string is in my case:
-_SaveAs C:\\users\\martin\\Desktop\\test.sat Scheme Default Enter
However the Plug-In doesn’t save any file printing only in the RhinoConsole:
Command: _-SaveAs
The funny thing:
This Python Script works:
import rhinoscriptsyntax as rs
command = "-_SaveAs C:\\users\\martin\\Desktop\\test.sat Scheme Default Enter"
rs.Command(command, True)
Does anyone know how to get this Code running in C#
Thanks
Martin
Continuing the discussion from RhinoCommon - SaveAs:
dale
(Dale Fugier)
2
If you want to run a Rhino command from within a RhinoCommon command, then you need to add the following attribute to the command’s class declaration:
[CommandStyle(Style.ScriptRunner)]
Does this help?
Hi Dale,
thank you. That helps a lot… and it works, too
Martin