Ghostkeeper / SVGToolpathReader

Cura plug-in to read SVG files as toolpaths, for debugging printer movements.
GNU Affero General Public License v3.0
34 stars 7 forks source link

Travel Command is never skipped due to float precision #6

Closed omdathetkan closed 4 years ago

omdathetkan commented 4 years ago

Currently travel commands are skipped as follows:

if command.x == x and command_y == y:
    continue  # Travel move wouldn't have any effect.

However due to rounding and precision this does not work as expected as you can see from this generated gcode snippet:

G1 X71.495625 Y41.394862 E0.125294
G1 X71.245918 Y42.362580 E0.136261
G0 F1500 E-6.363739 Z2.200000 (RETRACT)
G0 X71.245900 Y42.363000 F6000.000000
G0 F1500 E0.136261 Z0.200000 (UN-RETRACT)
G1 Y51.863000 F1200.000000 E0.240502

Current: image

Intended: image

Ghostkeeper commented 4 years ago

This is fixed by your pull request. Thank you so much!