Fixed the empty layer warning (again),
it did not work after top/bottom support contact z was separated
This commit is contained in:
parent
78a6406219
commit
aae8c7a844
@ -475,6 +475,7 @@ std::vector<GCode::LayerToPrint> GCode::collect_layers_to_print(const PrintObjec
|
|||||||
std::vector<GCode::LayerToPrint> layers_to_print;
|
std::vector<GCode::LayerToPrint> layers_to_print;
|
||||||
layers_to_print.reserve(object.layers().size() + object.support_layers().size());
|
layers_to_print.reserve(object.layers().size() + object.support_layers().size());
|
||||||
|
|
||||||
|
/*
|
||||||
// Calculate a minimum support layer height as a minimum over all extruders, but not smaller than 10um.
|
// Calculate a minimum support layer height as a minimum over all extruders, but not smaller than 10um.
|
||||||
// This is the same logic as in support generator.
|
// This is the same logic as in support generator.
|
||||||
//FIXME should we use the printing extruders instead?
|
//FIXME should we use the printing extruders instead?
|
||||||
@ -488,7 +489,7 @@ std::vector<GCode::LayerToPrint> GCode::collect_layers_to_print(const PrintObjec
|
|||||||
for (auto lh : object.print()->config().min_layer_height.values)
|
for (auto lh : object.print()->config().min_layer_height.values)
|
||||||
support_layer_height_min = std::min(support_layer_height_min, std::max(0.01, lh));
|
support_layer_height_min = std::min(support_layer_height_min, std::max(0.01, lh));
|
||||||
gap_over_supports += support_layer_height_min;
|
gap_over_supports += support_layer_height_min;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
std::vector<std::pair<double, double>> warning_ranges;
|
std::vector<std::pair<double, double>> warning_ranges;
|
||||||
|
|
||||||
@ -528,22 +529,23 @@ std::vector<GCode::LayerToPrint> GCode::collect_layers_to_print(const PrintObjec
|
|||||||
if ((layer_to_print.object_layer && layer_to_print.object_layer->has_extrusions())
|
if ((layer_to_print.object_layer && layer_to_print.object_layer->has_extrusions())
|
||||||
// Allow empty support layers, as the support generator may produce no extrusions for non-empty support regions.
|
// Allow empty support layers, as the support generator may produce no extrusions for non-empty support regions.
|
||||||
|| (layer_to_print.support_layer /* && layer_to_print.support_layer->has_extrusions() */)) {
|
|| (layer_to_print.support_layer /* && layer_to_print.support_layer->has_extrusions() */)) {
|
||||||
double support_contact_z = (last_extrusion_layer && last_extrusion_layer->support_layer)
|
double top_cd = object.config().support_material_contact_distance;
|
||||||
? gap_over_supports
|
double bottom_cd = object.config().support_material_bottom_contact_distance == 0. ? top_cd : object.config().support_material_bottom_contact_distance;
|
||||||
: 0.;
|
|
||||||
|
double extra_gap = (layer_to_print.support_layer ? bottom_cd : top_cd);
|
||||||
|
|
||||||
double maximal_print_z = (last_extrusion_layer ? last_extrusion_layer->print_z() : 0.)
|
double maximal_print_z = (last_extrusion_layer ? last_extrusion_layer->print_z() : 0.)
|
||||||
+ layer_to_print.layer()->height
|
+ layer_to_print.layer()->height
|
||||||
+ support_contact_z;
|
+ std::max(0., extra_gap);
|
||||||
// Negative support_contact_z is not taken into account, it can result in false positives in cases
|
// 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)
|
// 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)
|
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()));
|
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)
|
|
||||||
last_extrusion_layer = &layers_to_print.back();
|
|
||||||
}
|
}
|
||||||
|
// Remember last layer with extrusions.
|
||||||
|
if (has_extrusions)
|
||||||
|
last_extrusion_layer = &layers_to_print.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! warning_ranges.empty()) {
|
if (! warning_ranges.empty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user