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.68k stars 1.93k forks source link

additional layer on sliced model, not present in the input STL #13463

Open el-bart opened 5 days ago

el-bart commented 5 days ago

Description of the bug

slicing a model with flat top surface: flat_top_model

results in gcode file with extra layers on sides: extra_layer

Project file & How to reproduce

extra the archive and start ./run, to get the output model. extra_layer.zip

compare the top most layer in sliced output vs. the input STL

Checklist of files included above

Version of PrusaSlicer

PrusaSlicer-2.8.0+linux-x64-GTK3-202406270929

Operating system

Debian/12

Printer model

Voron 2.4 with stealthburner

u89djt commented 5 days ago

(from a fellow user recognizing an old problem and cheking your model) There's are two corresponding steps in the top surface of your stl, and these take the levels either side just higher and just lower than half way up the layer height. They're only 0.00011027 mm (copied and pasted from Fusion :) ), so not surprising that was missed. Neither of the upper surface heights in your screenshot are where you want the top surface. The middle section is half a layer too low, and the outer regions are half a layer too high. You can change layer heights strategically to make it top out at the height you want. Happy to talk through. You might be thinking something like "but why doesn't the slicer stop at whatever height the model specifies." I'm not involved, so I don't have a definitive answer, but I imagine it has to do with the other millions of models the slicer has to cope with. You can choose settings to have it do what you need.

el-bart commented 4 days ago

thx @u89djt for spotting - u'r right. after adding object intersection to cap-off at a given height (i.e. lowering whole model by a fraction of a mm), the problem went away.

judging by the outcome, it looks like the problem is in algo used to determine "shall i add 1 more layer?". it's apparently only monitoring threshold ("is there any part of the model above current height?") - if so, new layer is added. it's simple, but prone to such edge cases.

the way to solve it would be to change the algorithm's approach to instead optimize for minimal error between the model and actual layered (g-code) structure. i.e. "would adding new layer be more quantization error vs. not adding it?". the analysis can be made on per "island" basis. this way an optimal stop condition can be created, regardless of the actual model shape.

does not sound like a high prio, through. it's a rare case, indeed.

u89djt commented 4 days ago

Your model is 22.9mm high and you've chosen a layer height of 0.2mm, so the top is hovering around the middle of the highest extrusion layer that might be produced. If it's above half way, material is laid down. If you chop it off, your print will be 22.8mm high. If you want it to be 22.9mm high, you need to, for example, set the final layer height to 0.1mm, or maybe a couple of layers there or in the middle to 0.15mm so the object ends at a boundary between intended layers.