Export SVG without dialog box

I’m trying to write a script for the automatic export to SVG.
After the following combination of commands:

import rhinoscriptsyntax as rs
filename = “test”
rs.Command("_-Export " + filename + “.svg _Enter”)

the dialog box appears where you need to specify parameters such as size, view, scale, and so on.
How to make that without the dialog box? But with the following parameters:
Size: custom, 10x10 cm
Output Type: Vector output
Output Color: Print Color
View and Output Scale: Top, Extents

Hi @bobrovnich,

This is definitely a bug.


– Dale

Since you are using python, you should be able to do this using RhinoCommon

import Rhino
import scriptcontext as sc
import System.Drawing
import rhinoscriptsyntax as rs

dpi = 300
size = System.Drawing.Size(8.5*dpi,11*dpi)
settings = Rhino.Display.ViewCaptureSettings(sc.doc.Views.ActiveView, size, dpi)
svgxml = Rhino.Display.ViewCapture.CaptureToSvg(settings)

filename = rs.SaveFileName()

Hi Bobrovnich, I’m running into the same problem while trying to export SVG. Did you manage to solve this? I am trying to initiate the export from grasshopper. I have very limited knowledge of scripting.