discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

import

JW
Joe Weinpert
Fri, May 30, 2025 8:19 PM

Could you please provide guidance on how to import an SVG file into
openSCAD and represent it as a list of points?

Thank you,

Joe Weinpert
joe.weinpert@gmail.com
www.jwstudio.art http://jwstudio.art

Could you please provide guidance on how to import an SVG file into openSCAD and represent it as a list of points? Thank you, Joe Weinpert joe.weinpert@gmail.com www.jwstudio.art <http://jwstudio.art>
JB
Jordan Brown
Sat, May 31, 2025 5:39 AM

On 5/30/2025 1:19 PM, Joe Weinpert via Discuss wrote:

Could you please provide guidance on how to import an SVG file into
openSCAD and represent it as a list of points?

Using base OpenSCAD, you can't.  You can import an SVG file as a
polygon, but you cannot extract the list of points.

However, it happens that I just saw something using the Pathbuilder
library that consumes SVG path text and returns points.  See
https://openscad.org/libraries.html#pathbuilder .

The documentation says that it accepts the full SVG syntax, but I think
that's a little misleading.  It looks like it accepts the SVG path
syntax.  That's important for two reasons:  (1) SVG per se is an
XML-based format of which paths are only one part, and (2) not all SVG
shapes are represented as paths.  I just created a test file and
happened to draw an ellipse; it's represented in the SVG with the
<ellipse> element, not as a path.

Anyhow, if you convert everything into paths then you might be able to
copy-and-paste the path strings out of the SVG and into OpenSCAD source,
and use Pathbuilder to process them.

On 5/30/2025 1:19 PM, Joe Weinpert via Discuss wrote: > Could you please provide guidance on how to import an SVG file into > openSCAD and represent it as a list of points? Using base OpenSCAD, you can't.  You can import an SVG file as a polygon, but you cannot extract the list of points. However, it happens that I just saw something using the Pathbuilder library that consumes SVG path text and returns points.  See https://openscad.org/libraries.html#pathbuilder . The documentation says that it accepts the full SVG syntax, but I think that's a little misleading.  It looks like it accepts the SVG *path* syntax.  That's important for two reasons:  (1) SVG per se is an XML-based format of which paths are only one part, and (2) not all SVG shapes are represented as paths.  I just created a test file and happened to draw an ellipse; it's represented in the SVG with the <ellipse> element, not as a path. Anyhow, if you convert everything into paths then you might be able to copy-and-paste the path strings out of the SVG and into OpenSCAD source, and use Pathbuilder to process them.
RW
Raymond West
Sat, May 31, 2025 8:55 AM

You can use search and replace in a text editor to convert an SVG file 
to an OpenSCAD polygon format. Then, if you want to do it a number of
times, then get ChatGPT to write a python script to do the same.

On 30/05/2025 21:19, Joe Weinpert via Discuss wrote:

Could you please provide guidance on how to import an SVG file into
openSCAD and represent it as a list of points?

Thank you,

Joe Weinpert
joe.weinpert@gmail.com
www.jwstudio.art http://jwstudio.art


OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

You can use search and replace in a text editor to convert an SVG file  to an OpenSCAD polygon format. Then, if you want to do it a number of times, then get ChatGPT to write a python script to do the same. On 30/05/2025 21:19, Joe Weinpert via Discuss wrote: > Could you please provide guidance on how to import an SVG file into > openSCAD and represent it as a list of points? > > Thank you, > > Joe Weinpert > joe.weinpert@gmail.com > www.jwstudio.art <http://jwstudio.art> > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
JW
Joe Weinpert
Sat, May 31, 2025 1:04 PM

Hi Jordan and Raymond,

Thanks for your insights. It sounds like the method I've been using is
indeed the way to go:

  1. Create a drawing in Aspire.
  2. Export it as an SVG.
  3. Use UltraEdit to extract only the path information.
  4. Copy and paste the path data into OpenSCAD as a string variable.
  5. Utilize Pathbuilder's svgPoints() function to create the list of
    points.
  6. Finally, use BOSL2's deduplicate() function to ensure a clean list.

Thanks again for confirming this approach.

Best,
Joe

On Sat, May 31, 2025 at 4:55 AM Raymond West via Discuss <
discuss@lists.openscad.org> wrote:

You can use search and replace in a text editor to convert an SVG file  to
an OpenSCAD polygon format. Then, if you want to do it a number of times,
then get ChatGPT to write a python script to do the same.
On 30/05/2025 21:19, Joe Weinpert via Discuss wrote:

Could you please provide guidance on how to import an SVG file into
openSCAD and represent it as a list of points?

Thank you,

Joe Weinpert
joe.weinpert@gmail.com
www.jwstudio.art http://jwstudio.art


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Hi Jordan and Raymond, Thanks for your insights. It sounds like the method I've been using is indeed the way to go: 1. Create a drawing in Aspire. 2. Export it as an SVG. 3. Use UltraEdit to extract only the path information. 4. Copy and paste the path data into OpenSCAD as a string variable. 5. Utilize Pathbuilder's `svgPoints()` function to create the list of points. 6. Finally, use BOSL2's `deduplicate()` function to ensure a clean list. Thanks again for confirming this approach. Best, Joe On Sat, May 31, 2025 at 4:55 AM Raymond West via Discuss < discuss@lists.openscad.org> wrote: > You can use search and replace in a text editor to convert an SVG file to > an OpenSCAD polygon format. Then, if you want to do it a number of times, > then get ChatGPT to write a python script to do the same. > On 30/05/2025 21:19, Joe Weinpert via Discuss wrote: > > Could you please provide guidance on how to import an SVG file into > openSCAD and represent it as a list of points? > > Thank you, > > Joe Weinpert > joe.weinpert@gmail.com > www.jwstudio.art <http://jwstudio.art> > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RV
Roel Vanhout
Sat, May 31, 2025 6:43 PM

There are a few Inkscape plugins that automate much of this - basically
letting you copy/paste from Inkscape into Openscad point lists. I don't
remember much of the details, and I have my own plugin that also copies
curve date in various formats to the clipboard, so I sometimes mix and
match depending on what exactly I'm doing. But it's worth looking into
existing plugins, manually copying and fixing up gets old fast.

Cheers

On Sat, May 31, 2025, 15:05 Joe Weinpert via Discuss <
discuss@lists.openscad.org> wrote:

Hi Jordan and Raymond,

Thanks for your insights. It sounds like the method I've been using is
indeed the way to go:

  1. Create a drawing in Aspire.
  2. Export it as an SVG.
  3. Use UltraEdit to extract only the path information.
  4. Copy and paste the path data into OpenSCAD as a string variable.
  5. Utilize Pathbuilder's svgPoints() function to create the list of
    points.
  6. Finally, use BOSL2's deduplicate() function to ensure a clean list.

Thanks again for confirming this approach.

Best,
Joe

On Sat, May 31, 2025 at 4:55 AM Raymond West via Discuss <
discuss@lists.openscad.org> wrote:

You can use search and replace in a text editor to convert an SVG file
to an OpenSCAD polygon format. Then, if you want to do it a number of
times, then get ChatGPT to write a python script to do the same.
On 30/05/2025 21:19, Joe Weinpert via Discuss wrote:

Could you please provide guidance on how to import an SVG file into
openSCAD and represent it as a list of points?

Thank you,

Joe Weinpert
joe.weinpert@gmail.com
www.jwstudio.art http://jwstudio.art


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

There are a few Inkscape plugins that automate much of this - basically letting you copy/paste from Inkscape into Openscad point lists. I don't remember much of the details, and I have my own plugin that also copies curve date in various formats to the clipboard, so I sometimes mix and match depending on what exactly I'm doing. But it's worth looking into existing plugins, manually copying and fixing up gets old fast. Cheers On Sat, May 31, 2025, 15:05 Joe Weinpert via Discuss < discuss@lists.openscad.org> wrote: > Hi Jordan and Raymond, > > Thanks for your insights. It sounds like the method I've been using is > indeed the way to go: > > 1. Create a drawing in Aspire. > 2. Export it as an SVG. > 3. Use UltraEdit to extract only the path information. > 4. Copy and paste the path data into OpenSCAD as a string variable. > 5. Utilize Pathbuilder's `svgPoints()` function to create the list of > points. > 6. Finally, use BOSL2's `deduplicate()` function to ensure a clean list. > > Thanks again for confirming this approach. > > Best, > Joe > > On Sat, May 31, 2025 at 4:55 AM Raymond West via Discuss < > discuss@lists.openscad.org> wrote: > >> You can use search and replace in a text editor to convert an SVG file >> to an OpenSCAD polygon format. Then, if you want to do it a number of >> times, then get ChatGPT to write a python script to do the same. >> On 30/05/2025 21:19, Joe Weinpert via Discuss wrote: >> >> Could you please provide guidance on how to import an SVG file into >> openSCAD and represent it as a list of points? >> >> Thank you, >> >> Joe Weinpert >> joe.weinpert@gmail.com >> www.jwstudio.art <http://jwstudio.art> >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jon Bondy
Sat, May 31, 2025 8:43 PM

I don't do these things, but it sure feels as if this comes up
repeatedly.  Maybe a Wiki page or similar?

On 5/31/2025 2:43 PM, Roel Vanhout via Discuss wrote:

There are a few Inkscape plugins that automate much of this -
basically letting you copy/paste from Inkscape into Openscad point
lists. I don't remember much of the details, and I have my own plugin
that also copies curve date in various formats to the clipboard, so I
sometimes mix and match depending on what exactly I'm doing. But it's
worth looking into existing plugins, manually copying and fixing up
gets old fast.

Cheers

On Sat, May 31, 2025, 15:05 Joe Weinpert via Discuss
discuss@lists.openscad.org wrote:

 Hi Jordan and Raymond,

 Thanks for your insights. It sounds like the method I've been
 using is indeed the way to go:

 1. Create a drawing in Aspire.
 2. Export it as an SVG.
 3. Use UltraEdit to extract only the path information.
 4. Copy and paste the path data into OpenSCAD as a string variable.
 5. Utilize Pathbuilder's `svgPoints()` function to create the list
 of points.
 6. Finally, use BOSL2's `deduplicate()` function to ensure a clean
 list.

 Thanks again for confirming this approach.

 Best,
 Joe

 On Sat, May 31, 2025 at 4:55 AM Raymond West via Discuss
 <discuss@lists.openscad.org> wrote:

     You can use search and replace in a text editor to convert an
     SVG file  to an OpenSCAD polygon format. Then, if you want to
     do it a number of times, then get ChatGPT to write a python
     script to do the same.

     On 30/05/2025 21:19, Joe Weinpert via Discuss wrote:
     Could you please provide guidance on how to import an SVG
     file into openSCAD and represent it as a list of points?

     Thank you,

     Joe Weinpert
     joe.weinpert@gmail.com
     www.jwstudio.art <http://jwstudio.art>


     _______________________________________________
     OpenSCAD mailing list
     To unsubscribe send an email todiscuss-leave@lists.openscad.org
     _______________________________________________
     OpenSCAD mailing list
     To unsubscribe send an email to discuss-leave@lists.openscad.org

 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email to discuss-leave@lists.openscad.org

OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

I don't do these things, but it sure feels as if this comes up repeatedly.  Maybe a Wiki page or similar? On 5/31/2025 2:43 PM, Roel Vanhout via Discuss wrote: > There are a few Inkscape plugins that automate much of this - > basically letting you copy/paste from Inkscape into Openscad point > lists. I don't remember much of the details, and I have my own plugin > that also copies curve date in various formats to the clipboard, so I > sometimes mix and match depending on what exactly I'm doing. But it's > worth looking into existing plugins, manually copying and fixing up > gets old fast. > > Cheers > > > > On Sat, May 31, 2025, 15:05 Joe Weinpert via Discuss > <discuss@lists.openscad.org> wrote: > > Hi Jordan and Raymond, > > Thanks for your insights. It sounds like the method I've been > using is indeed the way to go: > > 1. Create a drawing in Aspire. > 2. Export it as an SVG. > 3. Use UltraEdit to extract only the path information. > 4. Copy and paste the path data into OpenSCAD as a string variable. > 5. Utilize Pathbuilder's `svgPoints()` function to create the list > of points. > 6. Finally, use BOSL2's `deduplicate()` function to ensure a clean > list. > > Thanks again for confirming this approach. > > Best, > Joe > > On Sat, May 31, 2025 at 4:55 AM Raymond West via Discuss > <discuss@lists.openscad.org> wrote: > > You can use search and replace in a text editor to convert an > SVG file  to an OpenSCAD polygon format. Then, if you want to > do it a number of times, then get ChatGPT to write a python > script to do the same. > > On 30/05/2025 21:19, Joe Weinpert via Discuss wrote: >> Could you please provide guidance on how to import an SVG >> file into openSCAD and represent it as a list of points? >> >> Thank you, >> >> Joe Weinpert >> joe.weinpert@gmail.com >> www.jwstudio.art <http://jwstudio.art> >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email todiscuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG antivirus software. www.avg.com