sameer / svg2gcode

Convert vector graphics to g-code for pen plotters, laser engravers, and other CNC machines
https://sameer.github.io/svg2gcode
MIT License
241 stars 48 forks source link

Straight lines not being converted to gcode #28

Closed ln0a closed 1 year ago

ln0a commented 1 year ago

First off I just want to say your tool is brilliant. Thanks so much for developing it! I'm having one small problem though, that if the svg path does not contain any curves, no gcode will be created. I have tried this as both open and closed paths and get the same result, and on the web and cli releases.

Any thoughts on why this might be?

sameer commented 1 year ago

Hi, glad to hear it's been helpful so far!

Do you mind sharing the SVG you used or a similar example so I can look into this further?

ln0a commented 1 year ago

Of course, thanks for having a look at this! I have found a solution, 'making compound paths' in the illustrator allows the gcode to be generated, but when trying to automate 100s of svgs this feels only a temporary solution. test2

sameer commented 1 year ago

I think I see the problem, this is related to #15. The SVG you shared contains a polygon object, whereas svg2gcode expects it to be a path:

<polygon class="st0" points="429.7,425.2 221,526.3 429.7,561 "/>

becomes

<path
   id="polygon4"
   class="st0"
   style="fill:none;stroke:#000000;stroke-miterlimit:10"
   d="M 429.7,425.2 221,526.3 429.7,561 Z" />

using Inkscape's Object to Path.

It should be possible to add support for these, they just aren't handled currently. Though they will not be filled until #15 is implemented.

sameer commented 1 year ago

Closing in favor of the mega tracker #38