slic3r / Slic3r

Open Source toolpath generator for 3D printers
https://slic3r.org/
GNU Affero General Public License v3.0
3.28k stars 1.29k forks source link

Bad gcode syntax with --gcode-flavor=no-extrusion #5159

Open adaviel opened 1 year ago

adaviel commented 1 year ago

I'm just getting started with 3D printing, playing with slic3r to see how it works before buying a printer. I was trying to write a gcode translator to my favourite drawing editor, so I was parsing the gcode output.

If I download an STL model from Thingiverse and run it through Slic3r, I get gcode as expected. If I select the option --gcode-flavor=no-extrusion, I get some gcode with a naked floating number, such as

G1 Z0.350 F7800.000 ; move to next layer (0) G1 -2.00000 F2400.00000 ; retract extruder 0 G1 X64.904 Y87.319 F7800.000 ; move to first skirt point G1 2.00000 F2400.00000 ; unretract extruder 0 G1 F1800 G1 X66.992 Y86.370 2.00000 ; skirt .. G1 X64.850 Y87.372 2.00000 ; skirt G1 0.00000 F2400.00000 ; retract extruder 0 G1 X106.240 Y130.400 F7800.000 ; move to first perimeter point G1 2.00000 F2400.00000 ; unretract extruder 0 G1 F1800 G1 X105.760 Y130.400 2.00000 ; perimeter

None of the online gcode guides that I have read describe this kind of extruder command. I had expected a letter code like X.

If this is indeed a bug, the code is generated in xs/src/libslic3r/GCodeWriter.cpp lines 494,527 in functions GCodeWriter::retract, unretract.

Slic3r version 1.3.0 on Linux.