From d910f7934b4b267b90a9766da4cbb3cc2c69b7af Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 21 Jul 2020 08:43:20 +0200 Subject: [PATCH] Empty layer check fix The test gave false positive in case there were supposed to be both object and support extrusions on the first layer --- src/libslic3r/GCode.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 7fc531b92..35dc5a53b 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -617,10 +617,12 @@ std::vector GCode::collect_layers_to_print(const PrintObjec layers_to_print.emplace_back(layer_to_print); + bool has_extrusions = (layer_to_print.object_layer && layer_to_print.object_layer->has_extrusions()) + || (layer_to_print.support_layer && layer_to_print.support_layer->has_extrusions()); + // Check that there are extrusions on the very first layer. if (layers_to_print.size() == 1u) { - if ((layer_to_print.object_layer && ! layer_to_print.object_layer->has_extrusions()) - || (layer_to_print.support_layer && ! layer_to_print.support_layer->has_extrusions())) + if (! has_extrusions) throw std::runtime_error(_(L("There is an object with no extrusions on the first layer."))); } @@ -637,10 +639,6 @@ std::vector GCode::collect_layers_to_print(const PrintObjec // 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) - // Only check this layer in case it has some extrusions. - bool has_extrusions = (layer_to_print.object_layer && layer_to_print.object_layer->has_extrusions()) - || (layer_to_print.support_layer && layer_to_print.support_layer->has_extrusions()); - if (has_extrusions && layer_to_print.print_z() > maximal_print_z + 2. * EPSILON) { const_cast(object.print())->active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL, _(L("Empty layers detected, the output would not be printable.")) + "\n\n" +