Path to Gcode - duplicate paths
Summary:
Gcode produced by the 'Path to Gcode' extension repeats every path twice. It makes our plotters go over every curve two times when once would suffice.
This was mentioned in the forum: https://inkscape.org/forums/cutplot/path-to-gcode-duplicate-lines-wrong-number-of-passes-workaround/
Steps to reproduce:
Use the 'Path to Gcode' extension on a shape (in my case, letters from the Hershey text extension).
What happened?
See the resulting gcode in a Gcode simulator like https://ncviewer.com/ (you need to remove the spaces after the Z's, X's and Y's for the file to show there). See the pen go over every path twice.
What should have happened?
I suppose it could be considered a feature, since sometimes it is desired to have a plotter or CNC machine go over a path multiple times, but in that case the number of passes should be an option.
Version Info:
Inkscape 1.0 (presumably also in the previous verions), on macOS Catalina.
Proposed solution:
As you can see in the forum, one way to avoid this problem is to choose 'Pass by pass' as the cutting order when running the extension.
What strikes me as odd in the gcodetools.py however, is that on line 3956, right after the option 'subpath by subpath' is handled, the script changes the value of self.options.path_to_gcode_order to 'path by path', which makes it go through the code for that condition as well.
Just commenting out that line solved the problem for me:
''' # self.options.path_to_gcode_order = 'path by path' '''
Because there are almost no comments, it's hard for me to understand what everything in gcodetools.py does. That also makes it hard to understand if this is in fact a bug or just bad coding ;-) More testing might be needed to see if this fix doesn't break some other functionality.