From c18914022147ad0edb3c12ad1011a158d9c1e9eb Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 13 Aug 2019 11:02:58 +0200 Subject: [PATCH] Fixed a false positive empty layer report Reported in https://github.com/prusa3d/PrusaSlicer/issues/2752 and was a result of setting support contact z distance to negative value. This lowered the maximum allowed print_z of the next layer, even though previous layer had object layers too, so the penalty from the contact z should not have been applied. Fixed simply by rejecting the negative contact_z. --- src/libslic3r/GCode.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 02fefceec..b691203c9 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -467,7 +467,10 @@ std::vector GCode::collect_layers_to_print(const PrintObjec : 0.; double maximal_print_z = (last_extrusion_layer ? last_extrusion_layer->print_z() : 0.) + layer_to_print.layer()->height - + support_contact_z; + + std::max(0., support_contact_z); + // Negative support_contact_z is not taken into account, it can result in false positives in cases + // where previous layer has object extrusions too (https://github.com/prusa3d/PrusaSlicer/issues/2752) + if (layer_to_print.print_z() > maximal_print_z + EPSILON) throw std::runtime_error(_(L("Empty layers detected, the output would not be printable.")) + "\n\n" +