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

[Feature Request] Smart Layer Height based on horizonal surfaces #2449

Open Mithrandil opened 5 years ago

Mithrandil commented 5 years ago

It's quite annoying to be forced to design objects with the flat surfaces height based on the layer height at which they will be printed (Specially now that the layer height table has been removed)

(e.g. slicing a 10,1 mm high cube with 0,20 mm layer height leads to a 10.2 mm high cube)

So, i suggest a smart modification of the layer height based on the distance of flat surfaces from the heated bed, exploiting the layer editing feature to make it automatic,

(for instance, slicing a 10,1 mm high cube at "smart" 0.20 mm layer height could lead to 41 layers 0.20 mm thick + 10 layers 0.19 mm thick --> 10.1 mm high cube)

IMG_20190604_231102

YuSanka commented 5 years ago

Thanks for your suggestion. Actually, we working on rewriting of the layers table right now. And new implementation will be a part of one of next releases.

bubnikv commented 5 years ago

I know the upstream slic3r has some automagic logic such as you have described. The problem is, that it is only well applicable to simple objects. For objects with multiple horizontal steps the algorithm will likely be more involved and / or will not produce desirable results.

st 5. 6. 2019 v 9:03 odesílatel Oleksandra Yushchenko < notifications@github.com> napsal:

Thanks for your suggestion. Actually, we working on rewriting of the layers table right now. And new implementation will be a part of one of next releases.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/prusa3d/PrusaSlicer/issues/2449?email_source=notifications&email_token=ABMPSI2TLMNOGBHIDPCAEVTPY5QL3A5CNFSM4HTD6ER2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW6ZMNA#issuecomment-498964020, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMPSIYT6D67ZDKXCBE4EBTPY5QL3ANCNFSM4HTD6ERQ .

Mithrandil commented 5 years ago

Well, even if there are multiple steps, a simple algorithm could just divide the object (i.e. create a row in the layer table) for each interval between two steps, and calculate the needed layer height accordingly, whithin set limits.

If the geometry is to complex to be solved autometically the algorithm could just give up with an alert, encouraging the user to check the layer height table by hand.

Mithrandil commented 5 years ago

Here it is!

Python3 script which optimizes the layerheight in order to match right z values on flat surfaces (as per 1st post), approximated at 0.01 mm [layer height only supported in in PrusaSlicer2.1.0-alpha1 for the moment]

usage: python3 LH-optimizer.py <default_layer_height_in_mm> <file.stl> example: python3 LH-optimizer.py 0.40 mystlfule.stl

output:

 0.0  -->  0.2  -  0.2
 0.2  -->  0.9  -  0.35
 0.9  -->  3.0  -  0.42
 3.0  -->  5.0  -  0.4
 5.0  -->  11.24  -  0.39

LH-optimizer.py.txt

Mithrandil commented 4 years ago

New version of the script, with some improvements:

Usage:  NEW-LH-optimizer.py <file.3mf> <default_layer_height_in_mm> [max_layer_height_in_mm]

NEW-LH-optimizer.zip