Ex-/Import SVG in Grasshopper WITHOUT Rhino

I am building a Generator for Popupcards in Grasshopper. So i generalised diffrent Foldtypes and Foldcombinations in Custom parametical Clusters. And the results are encouraging.

But behind the pure functionallity of working folds, movements and rotations it would be nice to trim the calculaed surfaces with simple curves, without braking the Rules of the Popup components.

So i want that Grasshopper exports for each Foldelement i created his own SVG. For Example
POP/Basecard.svg
POP/M-Fold01.svg
POP/M-Fold02.svg
POP/V-Fold01.svg
POP/V-Fold02.svg
POP/V-Fold03.svg
The Foldelement is just a Curve (for Cut) and some Lines (for Fold)

The other thing i want is to give a component a predefined curve from an SVG File as Mask.
So i can import a SVG Mask in Rhino reference it in Grasshopper and use Boolean Operations to trim the Foldelement. But i want it faster, if possible. Is it possible just to reference the Filename (Each svg File have only 1 Curve) and get the Curve without using Rhino first?
SVG Files are XML Files. Is it possible to read the string of a curve like
path
style=“fill:#ff6600;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1”
d=“m 78.89736,76.267726 c 15.32863,-2.524715 51.39599,-15.148292 60.41284,5.951117 9.01683,21.099407 36.96904,32.099957 3.06572,33.362307 -33.90332,1.26236 -81.512242,12.80392 -88.545378,4.32809 C 46.797406,111.43341 32.37046,85.10423 45.895722,83.841874 59.420984,82.579515 78.89736,76.267726 78.89736,76.267726 Z”
id=“path3713”
inkscape:connector-curvature=“0” /
and convert it to a curve Grasshopper / Rhino undersand?

This would be the prefered solution.
If i can select nodes in XML (and Ladybug and other plugin shows that this work) much complexer Documentstructures are possible.

It depends on how complicated your geometry/style will be. In most cases, you need to operate on XML. I don’t know which GH plugin is best for XML since XML I/O seems an infrequent request.

Pancake is able to import simple SVG (only geometry so far) but not exporting.

image

1 Like

Hi - A quick search on Food4Rhino shows that Aviary lets you export to SVG.


-wim

1 Like

Thank you. This really solve the second part of my problem