Slightly reworded the 'Empty layers detected' warning,

it mentions the layers between which the problem occurs,
not just the upper one (which may be unclear).
This commit is contained in:
Lukas Matena 2021-08-27 12:10:25 +02:00
parent fbe4695958
commit 7852ba061c

View File

@ -13,6 +13,7 @@
#include "ClipperUtils.hpp" #include "ClipperUtils.hpp"
#include "libslic3r.h" #include "libslic3r.h"
#include "LocalesUtils.hpp" #include "LocalesUtils.hpp"
#include "libslic3r/format.hpp"
#include <algorithm> #include <algorithm>
#include <cstdlib> #include <cstdlib>
@ -512,7 +513,8 @@ std::vector<GCode::LayerToPrint> GCode::collect_layers_to_print(const PrintObjec
bool has_extrusions = (layer_to_print.object_layer && layer_to_print.object_layer->has_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()); || (layer_to_print.support_layer && layer_to_print.support_layer->has_extrusions());
// Check that there are extrusions on the very first layer. // Check that there are extrusions on the very first layer. The case with empty
// first layer may result in skirt/brim in the air and maybe other issues.
if (layers_to_print.size() == 1u) { if (layers_to_print.size() == 1u) {
if (!has_extrusions) if (!has_extrusions)
throw Slic3r::SlicingError(_(L("There is an object with no extrusions in the first layer.")) + "\n" + throw Slic3r::SlicingError(_(L("There is an object with no extrusions in the first layer.")) + "\n" +
@ -534,11 +536,12 @@ std::vector<GCode::LayerToPrint> GCode::collect_layers_to_print(const PrintObjec
if (has_extrusions && layer_to_print.print_z() > maximal_print_z + 2. * EPSILON) { if (has_extrusions && layer_to_print.print_z() > maximal_print_z + 2. * EPSILON) {
const_cast<Print*>(object.print())->active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL, const_cast<Print*>(object.print())->active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL,
_(L("Empty layers detected. Make sure the object is printable.")) + "\n" + Slic3r::format(_(L("Empty layer detected between heights %1% and %2%. Make sure the object is printable.")),
_(L("Object name")) + ": " + object.model_object()->name + "\n" + _(L("Print z")) + ": " + (last_extrusion_layer ? last_extrusion_layer->print_z() : 0.),
std::to_string(layers_to_print.back().print_z()) + "\n\n" + _(L("This is " layers_to_print.back().print_z())
"usually caused by negligibly small extrusions or by a faulty model. Try to repair " + "\n" + Slic3r::format(_(L("Object name: %1%")), object.model_object()->name) + "\n\n"
"the model or change its orientation on the bed."))); + _(L("This is usually caused by negligibly small extrusions or by a faulty model. "
"Try to repair the model or change its orientation on the bed.")));
} }
// Remember last layer with extrusions. // Remember last layer with extrusions.