discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Fwd: Re: SVG to points array

RW
Raymond West
Thu, Feb 2, 2023 7:17 PM

It is simple enough to do a search and replace on the svg file,  using
any plain text editor, if svg is generated by openscad.

I think i mentioned how a few months ago. Afaik, all openscad generated
svg files just produce straight lines, so the only characters you need
to search and replace are M, L, z and  ','.

For svg files generated elsewhere, import into openscad, and export
again, openscad will have removed all the text, and other svg commands.

On 02/02/2023 18:17, Joe Weinpert wrote:

Thanks Steve

This is actually the way I have been doing it except I use UltraEdit
instead of MS Word for replacements within the Inkscape path.

Also, when I do the Extensions -> Modify Path -> Flatten Beziers each
point gets separated by the " L " (line to) svg command.  By replacing
these with "],[" it works great.

On Thu, Feb 2, 2023 at 12:20 PM Steve Lelievre
steve.lelievre.canada@gmail.com wrote:

 If you're an Inkscape user and and if the starting shape is a
 single loop and if it's a one-time exercise (so a manual process
 isn't too much of a burden) :

 If your starting shape in Inkscape has bezier curves, use 'Flatten
 Beziers' to convert the shape to have only straight segments.

 Open the XML editor, and select the desired path. Make sure 'Show
 Attributes' is turned on.

 Copy the d attribute and paste to something like MS Word. You'll
 have a leading and trailing control symbol, such M and Z, which
 should be deleted.

 That should leave a list of point coordinates with a space between
 each point and a comma between the x and y values. Then use
 Replace All to adjust the layout as required.

 The method is a bit of a kludge, but it has worked for me a few times.

 Steve





 On 2023-02-02 8:22 a.m., Joe Weinpert wrote:
 Is there a way to read an SVG file or to convert an SVG path to
 generate a usable points array?


 _______________________________________________
 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 todiscuss-leave@lists.openscad.org

It is simple enough to do a search and replace on the svg file,  using any plain text editor, if svg is generated by openscad. I think i mentioned how a few months ago. Afaik, all openscad generated svg files just produce straight lines, so the only characters you need to search and replace are M, L, z and  ','. For svg files generated elsewhere, import into openscad, and export again, openscad will have removed all the text, and other svg commands. On 02/02/2023 18:17, Joe Weinpert wrote: > Thanks Steve > > This is actually the way I have been doing it except I use UltraEdit > instead of MS Word for replacements within the Inkscape path. > > Also, when I do the Extensions -> Modify Path -> Flatten Beziers each > point gets separated by the " L " (line to) svg command.  By replacing > these with "],[" it works great. > > > > On Thu, Feb 2, 2023 at 12:20 PM Steve Lelievre > <steve.lelievre.canada@gmail.com> wrote: > > If you're an Inkscape user and and if the starting shape is a > single loop and if it's a one-time exercise (so a manual process > isn't too much of a burden) : > > If your starting shape in Inkscape has bezier curves, use 'Flatten > Beziers' to convert the shape to have only straight segments. > > Open the XML editor, and select the desired path. Make sure 'Show > Attributes' is turned on. > > Copy the d attribute and paste to something like MS Word. You'll > have a leading and trailing control symbol, such M and Z, which > should be deleted. > > That should leave a list of point coordinates with a space between > each point and a comma between the x and y values. Then use > Replace All to adjust the layout as required. > > The method is a bit of a kludge, but it has worked for me a few times. > > Steve > > > > > > On 2023-02-02 8:22 a.m., Joe Weinpert wrote: >> Is there a way to read an SVG file or to convert an SVG path to >> generate a usable points array? >> >> >> _______________________________________________ >> 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 todiscuss-leave@lists.openscad.org