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, 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.
i’ve been using your above code in Rhino 7 for a bunch of scripts and have a problem now using Rhino 8. In Rhino 7 it exported the svg file with a single <path> node for each curve object, eg exporting 2 curves resulted in:
<svg>
<path d="M...."/>
<path d="M...."/>
</svg>
Using Rhino 8 i now get this structure in the xml, again for 2 curves:
It seems that i get a a lot of extra path nodes, curves fall apart into pieces, polylines are broken into lines and everything seems to be grouped when opening the file in Illustrator. This is breaking a lot for me.
Two questions:
How to get the old behaviour of CaptureToSvg as it has been in Rhino 7 ?
I am modifying svgxml before saving it, eg. to add id attributes to each path node and other things. When i try to access the XmlDocument created by CaptureToSvg using any XPath language, it fails eg. try to access the <path> nodes like this:
print svgxml.SelectNodes("//path").Count
always returns 0. But the XPath syntax is correct. I would appreciate any help on this.
Below is the origin Rhino 7 file containing 4 curves. In Rhino 7 i get 4 <path> nodes in the svg file, they are ungrouped once imported into Illustrator. Doing the same capture in Rhino 8 i get 28 <path> nodes in the svg file nested under the new <g> node. This results into 28 curves in Illustrator. Grouped and nested under an extra layer…
I’ve zipped the files since svg did not upload: Example.zip (145.9 KB)