discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Inline & Generated SVG

NS
Nathan Sokalski
Thu, Sep 28, 2023 1:52 AM

I would like to use SVG directly in my OpenSCAD model by generating the SVG string/code, because several components are more easily expressed in SVG than using the objects available in OpenSCAD (specifically paths that involve curves). I am aware that SVG files can be imported, however, this does not allow me to generate the code, which is one of the main requirements for my models. Is there any good way to do this?

Nathan Sokalski
njsokalski@hotmail.commailto:njsokalski@hotmail.com

I would like to use SVG directly in my OpenSCAD model by generating the SVG string/code, because several components are more easily expressed in SVG than using the objects available in OpenSCAD (specifically paths that involve curves). I am aware that SVG files can be imported, however, this does not allow me to generate the code, which is one of the main requirements for my models. Is there any good way to do this? Nathan Sokalski njsokalski@hotmail.com<mailto:njsokalski@hotmail.com>
JB
Jordan Brown
Thu, Sep 28, 2023 4:00 AM

On 9/27/2023 6:52 PM, Nathan Sokalski wrote:

I would like to use SVG directly in my OpenSCAD model by generating
the SVG string/code, because several components are more easily
expressed in SVG than using the objects available in OpenSCAD
(specifically paths that involve curves). I am aware that SVG files
can be imported, however, this does not allow me to generate the code,
which is one of the main requirements for my models. Is there any good
way to do this?

First, note that SVG can represent shapes that OpenSCAD can't handle. 
OpenSCAD only works in 2D and 3D closed figures, while SVG can represent
things like line segments.

Second... well, sort of.  There are libraries that can do stuff that is
sort of SVG-like.

https://github.com/BelfrySCAD/BOSL2/wiki/drawing.scad

... especially the turtle() function.

On 9/27/2023 6:52 PM, Nathan Sokalski wrote: > I would like to use SVG directly in my OpenSCAD model by generating > the SVG string/code, because several components are more easily > expressed in SVG than using the objects available in OpenSCAD > (specifically paths that involve curves). I am aware that SVG files > can be imported, however, this does not allow me to generate the code, > which is one of the main requirements for my models. Is there any good > way to do this? > First, note that SVG can represent shapes that OpenSCAD can't handle.  OpenSCAD only works in 2D and 3D closed figures, while SVG can represent things like line segments. Second... well, sort of.  There are libraries that can do stuff that is sort of SVG-like. https://github.com/BelfrySCAD/BOSL2/wiki/drawing.scad ... especially the turtle() function.
TP
Torsten Paul
Thu, Sep 28, 2023 7:57 AM

Have a look at pathbuilder listed at https://openscad.org/libraries.html

ciao,
Torsten.

Have a look at pathbuilder listed at https://openscad.org/libraries.html ciao, Torsten.