prusa3d / PrusaSlicer

G-code generator for 3D printers (RepRap, Makerbot, Ultimaker etc.)
https://www.prusa3d.com/prusaslicer/
GNU Affero General Public License v3.0
7.72k stars 1.93k forks source link

Garbage G-Code segments causing printing artifacts #11573

Open mfish38 opened 12 months ago

mfish38 commented 12 months ago

Description of the bug

When slicing a model that has a curved surface the slicer is generating garbage g codes of very small movements and inserting them between line segments. This causes pronounced surface artifacts.

Post processing the g code to comment out these g-codes with the following regex replacement removes these artifacts and has no other adverse effects on print quality: replace

    (^G1 .*? E.000\d\d*$)

with

    ; $1

This issue is present in 2.7.0 alpha 1 and 2.6.0.

Before and after the regex replacement: 20231102_100836 20231102_100859

Project file & How to reproduce

A good test print is the prop from: https://www.printables.com/model/227852-strong-flying-propeller-pull-copter-no-supports

FlyinProp_stl.zip

Slice the file and export the g code. Search the file for G1 codes with E < 0.0009

You can navigate in the g code preview to a line with such a g code and see that there is a super tiny almost invisible line segment.

Capture

Adjusting the g code resolution of the slicing parameters has no effect on eliminating these segments.

Checklist of files included above

Version of PrusaSlicer

Version 2.7.0-alpha1+win64

Operating system

Windows 10 Pro 22H2 19045.3570

Printer model

Creality K1

sethml commented 11 months ago

I just verified that pull request #11811 seems to fix this problem. Here's a .3mf and before-and-after gcode files: FlyinProp_stl.zip

The number of very-short moves decreases from 2830 to 59 and the file size decreases almost 200KB!

% ls -l FlyinProp_stl\ *.gcode
-rw-r--r--  1 sethml  staff  1636974 Dec  1 02:56 FlyinProp_stl after.gcode
-rw-r--r--@ 1 sethml  staff  1801356 Dec  1 02:55 FlyinProp_stl before.gcode
% grep -c '^G1 .* E.000' FlyinProp_stl\ *.gcode
FlyinProp_stl after.gcode:59
FlyinProp_stl before.gcode:2830

The remaining very short moves seem to be in infill or non-external perimeters:

% grep '^G1 .* E.000\|TYPE' FlyinProp_stl\ after.gcode | grep -B1 G1
;TYPE:Perimeter
G1 X48.17 Y139.329 E.00074
--
;TYPE:Solid infill
G1 X104.268 Y106.803 E.00084
G1 X103.779 Y107.847 E.00084
G1 X105.711 Y107.8 E.00038
G1 X107.282 Y106.731 E.00084
G1 X116.611 Y109.969 E.00058
G1 X116.204 Y112.415 E.00084
G1 X112.46 Y116.147 E.00084
--
;TYPE:Solid infill
G1 X105.131 Y114.778 E.00084
G1 X104.836 Y113.997 E.00086
G1 X107.411 Y116.047 E.00084
G1 X106.925 Y113.106 E.00084
G1 X113.405 Y107.447 E.00084
G1 X106.592 Y112.28 E.00084
G1 X107.514 Y102.896 E.00082
G1 X112 Y103.633 E.00084
G1 X116.356 Y108.012 E.00084
G1 X115.946 Y107.024 E.00084
G1 X112.959 Y104.073 E.00084
--
;TYPE:Perimeter
G1 X107.809 Y113.867 E.00036
--
;TYPE:Perimeter
G1 X108.791 Y102.914 E.00098
--
;TYPE:Perimeter
G1 X110.78 Y105.77 E.00055
--
;TYPE:Perimeter
G1 X108.894 Y102.878 E.00014
--
;TYPE:Perimeter
G1 X108.361 Y113.975 E.00051
--
;TYPE:Perimeter
G1 X108.383 Y113.963 E.00014
--
;TYPE:Perimeter
G1 X110.608 Y102.909 E.00092
--
;TYPE:Perimeter
G1 X113.834 Y110.278 E.00082
--
;TYPE:Perimeter
G1 X106.205 Y109.655 E.00041
--
;TYPE:Perimeter
G1 X110.39 Y106.202 E.00033
--
;TYPE:Perimeter
G1 X110.375 Y106.206 E.00036
--
;TYPE:Perimeter
G1 X113.792 Y110.295 E.00069
--
;TYPE:Perimeter
G1 X111.749 Y103.174 E.00085
--
;TYPE:Perimeter
G1 X112.142 Y103.151 E.00004
--
;TYPE:Perimeter
G1 X116.519 Y114.459 E.00087
--
;TYPE:Perimeter
G1 X112.578 Y103.478 E.00009
--
;TYPE:Perimeter
G1 X110.42 Y106.195 E.00087
--
;TYPE:Perimeter
G1 X112.856 Y103.632 E.00082
--
;TYPE:Perimeter
G1 X116.257 Y114.863 E.00041
--
;TYPE:Perimeter
G1 X110.42 Y106.196 E.00098
--
;TYPE:Perimeter
G1 X116.19 Y114.972 E.00044
--
;TYPE:Perimeter
G1 X110.419 Y106.196 E.00096
--
;TYPE:Perimeter
G1 X113.792 Y110.295 E.00094
--
;TYPE:Perimeter
G1 X110.412 Y106.222 E.00062
--
;TYPE:Perimeter
G1 X115.643 Y115.67 E.00038
--
;TYPE:Solid infill
G1 X163.434 Y153.091 E.00046
--
;TYPE:Perimeter
G1 X114.753 Y116.544 E.00081
--
;TYPE:Solid infill
G1 X163.651 Y153.541 E.00075
G1 X120.915 Y41.727 E.00075
--
;TYPE:Perimeter
G1 X45.779 Y132.962 E.00012
--
;TYPE:Solid infill
G1 X107.28 Y111.35 E.00084
G1 X106.929 Y110.448 E.00084
G1 X113.182 Y109.591 E.00084
G1 X112.848 Y108.767 E.00084
G1 X112.492 Y107.861 E.00084
--
;TYPE:Solid infill
G1 X108.128 Y108.19 E.00084
G1 X109.671 Y112.715 E.00084
G1 X110.495 Y112.384 E.00084
G1 X111.399 Y112.03 E.00084
--
;TYPE:Bridge infill
G1 X111.677 Y108.2 E.00069