_-Export changed in R7 vs R6

I have a plugin that uses Rhino.RhinoApp.RunScript(command, false); to call the “_-Export” command. The full command looks something like this:

_-Export "C:\Users\James\Desktop\test.svg" _Enter

In Rhino 6, this opens the Export dialog window so users can pick options such as Size, View, and Output scale. I understand that this is a bug that was now fixed in R7.

In Rhino 7, this opens no windows and exports the SVG with all default options, which is not what I want. (this also freezes my viewport but is fixable by switching views and then coming back. try this command in the macroeditor and see for yourself)

How do I add in the options to the _-Export command? I’m talking about the SVG export options like Size, View, and Output scale, NOT the general options that come up like “Save file name ( Version=7 SaveSmall=No GeometryOnly=No SaveTextures=Yes SaveNotes=Yes SavePlugInData=Yes Browse )”

I was told by the tech support email to post this here.

Remove the - (dash) from the command to make it interactive.

Yes, that works in the MacroEditor, but does not work in my code. Here is what my code looks like


So the command should come out like
_Export "D:\James's Stuff\test.svg" _Enter

and only show the Export dialog, but it also shows the file save dialog, to choose the location and name the file, which I don’t want to happen.

I’m thinking it has to do with the \ characters in the “filepath” string, maybe, but I thought the "\"" surrounding the filepath string meant it was treated verbatim, so those don’t matter?

here’s a simple C# component:

    string directory = System.IO.Path.GetTempPath();
    string filename = DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss");
    filename += ".svg";
    string filepath = Path.Combine(directory, filename);

    string cmd = "_Export " + "\"" + filepath + "\"";
    //this comes out of the component as _Export "C:\Users\james\AppData\Local\Temp\2021-02-04-01-02-23.svg"

    //selects all objects in the rhino viewport
    foreach(var robj in Rhino.RhinoDoc.ActiveDoc.Objects)
      Rhino.RhinoDoc.ActiveDoc.Objects.Select(robj.Id, true);

    //does the thing!
    Rhino.RhinoApp.RunScript(cmd, false);

    A = cmd;

you can see the command it is sending here in the panel.

but the export window comes up! the location and name export window, not the SVG window that I want.

If I use C# to send the command with Rhino.RhinoApp.RunScript it comes up with the export window i dont want.
But if I use the MacroEditor to paste in that EXACT SAME command, it only shows me the SVG export window, like I want.

Most likely you need to do

string cmd = "_Export " + "\"" + filepath.Replace(@"\", @"\\") + "\"";

to get C:\\Users\\james\\AppData\\Local\\Temp\\2021-02-04-01-02-23.svg

1 Like

That doesn’t seem to change anything unfortunately.

edit: if you open a new R7 document, draw a simple curve and select it, open the macroeditor and paste _Export "C:\Users\james\Desktop\test.svg" (or your equivalent), and run the macro it does one of two things 50% of the time:

A. it opens the export location window
B. it opens the SVG export options window

I have been doing this repeatably. it does each thing about half of the time.

In this video I draw a curve, open the macroeditor, paste in _Export "C:\Users\james\Desktop\test.svg", and run the macro. This time it opened the export to location window. I add a - to the _Export so it says _-Export, it runs and freezes the window (another bug, not focused on that, but it is there), then I delete that hyphen, and run the same command I initially ran, this time it opens the SVG export options window! Two actions for the exact same command.

What is going on? Seems like a bug. Possibly a related bug is the difference in actions between the same command issued through the macroeditor vs Rhino.RhinoApp.RunScript!

Then I have no idea, sorry :disappointed:

My question basically boils down to this: in Rhino 7, how do I use C# to export selected geometry as an SVG to a prespecified file path and have the SVG Export Options window show up? (without asking the user to name and locate where to save the file)


How do I specify the SVG export options in the _-Export command and not show any window?

Hi @jaymezd,

The Export command has not changed between Rhino 6 and 7. However, the plug-in which does the exporting of SVG-formatted files has changed.

When you script a command by preceding it with a hyphen character, -Export for example, the command being script should not display any kind of dialog box. Doing so defeats the purpose of scripting the command.

Thus, the dialog display when you scripted SVG export in Rhino 6 was actually a bug. Now you might not think so. But other who assumed there would be no dialog box do.

I’ve logged this issue so we can try to figure out how to provide you the functionality you are looking for.


– Dale

1 Like

Yes I have been told by Rhino tech support that it was a bug I was using to my advantage. That’s okay if it does not come back, or there is no way to show the window now…

As long as there is a way to specify the options that were presented in that window: size, view, output scale. Are you saying there is no way to use _-Export and specify those options for an SVG export?


Yes, this is correct, which is why I’ve logged the issue.

– Dale

1 Like

@Trav Just checking in on this. Looking at the jetbrains link above it looks like this is targeted for Rhino 8?

1 Like