Empty layer warning is now generated once per object
This commit is contained in:
parent
f31a2db495
commit
17b9189974
1 changed files with 21 additions and 9 deletions
|
@ -490,6 +490,8 @@ std::vector<GCode::LayerToPrint> GCode::collect_layers_to_print(const PrintObjec
|
|||
gap_over_supports += support_layer_height_min;
|
||||
}
|
||||
|
||||
std::vector<std::pair<double, double>> warning_ranges;
|
||||
|
||||
// Pair the object layers with the support layers by z.
|
||||
size_t idx_object_layer = 0;
|
||||
size_t idx_support_layer = 0;
|
||||
|
@ -535,15 +537,8 @@ std::vector<GCode::LayerToPrint> 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)
|
||||
|
||||
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,
|
||||
Slic3r::format(_(L("Empty layer detected between heights %1% and %2%. Make sure the object is printable.")),
|
||||
(last_extrusion_layer ? last_extrusion_layer->print_z() : 0.),
|
||||
layers_to_print.back().print_z())
|
||||
+ "\n" + Slic3r::format(_(L("Object name: %1%")), object.model_object()->name) + "\n\n"
|
||||
+ _(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.")));
|
||||
}
|
||||
if (has_extrusions && layer_to_print.print_z() > maximal_print_z + 2. * EPSILON)
|
||||
warning_ranges.emplace_back(std::make_pair((last_extrusion_layer ? last_extrusion_layer->print_z() : 0.), layers_to_print.back().print_z()));
|
||||
|
||||
// Remember last layer with extrusions.
|
||||
if (has_extrusions)
|
||||
|
@ -551,6 +546,23 @@ std::vector<GCode::LayerToPrint> GCode::collect_layers_to_print(const PrintObjec
|
|||
}
|
||||
}
|
||||
|
||||
if (! warning_ranges.empty()) {
|
||||
std::string warning;
|
||||
size_t i = 0;
|
||||
for (i = 0; i < std::min(warning_ranges.size(), size_t(3)); ++i)
|
||||
warning += Slic3r::format(_(L("Empty layer between %1% and %2%.")),
|
||||
warning_ranges[i].first, warning_ranges[i].second) + "\n";
|
||||
if (i < warning_ranges.size())
|
||||
warning += _(L("(Some lines not shown)")) + "\n";
|
||||
warning += "\n";
|
||||
warning += Slic3r::format(_(L("Object name: %1%")), object.model_object()->name) + "\n\n"
|
||||
+ _(L("Make sure the object is printable. 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."));
|
||||
|
||||
const_cast<Print*>(object.print())->active_step_add_warning(
|
||||
PrintStateBase::WarningLevel::CRITICAL, warning);
|
||||
}
|
||||
|
||||
return layers_to_print;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue