vishpat / svg2gcode

Python script to convert svg to gcode for Marlin firmware
GNU General Public License v3.0
92 stars 37 forks source link

Can't convert SVG properly #4

Open Harvie opened 6 years ago

Harvie commented 6 years ago

I've tried two SVGs so far and both failed to convert properly and completely. I even tried to use inkscape to cleanup, simplify and convert SVGs to splines. without any succes. I attached SVGs here: svg_test.zip Here is preview of what happend:

SVG: image GCode (fliped and incomplete): image

SVG: (incomplete and possibly fliped) image Gcode: image

Also note that there's G1 between shapes. There should be G0 between shapes so we don't cut between them.

Harvie commented 6 years ago

i've partialy fixed the G0/G1 controversy: image

Harvie commented 6 years ago

After some more processing in inkscape and flipping resulting gcode upside down: image

To flip the code i did this:

- print "G%d X%0.1f Y%0.1f" % (feed, scale_x*x, scale_y*y)
+ print "G%d X%0.1f Y%0.1f" % (feed, scale_x*x, -scale_y*y)

In inkscape i needed to do following:

Object -> Ungroup (shift+ctrl+g) Path -> Break apart (shift+ctrl+k)

Is there way to do this automaticaly in svg2gcode?

Harvie commented 6 years ago

But still this does not work for second file. It surely improved:

image

But still there's half of the file missing. Exactly there are 2 incomplete shapes and 5 shapes missing and there are 5 pairs of preamble+postamble in the generated file indicating that svg2gcode is aware of these 5 shapes. But the g-code between pre/postambles is missing.