mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-09 00:31:19 +00:00
Belt G-code: drop the empty layers in one place
The by-layer collect_layers_to_print() dropped every merged layer group in which nothing prints, and the per-object overload drops every belt entry that prints nothing. The merged groups are built only from the per-object entries, so after the second drop every group holds at least one entry that prints and the first never removed anything. Remove it and keep its explanation at the drop that does the work. No output changes. Reported by raistlin7447 in the review of #14394. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c59eb1bcf9
commit
d29e3be0a0
+7
-27
@@ -2370,8 +2370,13 @@ std::vector<GCode::LayerToPrint> GCode::collect_layers_to_print(const PrintObjec
|
||||
PrintStateBase::WarningLevel::CRITICAL, warning, PrintStateBase::SlicingEmptyGcodeLayers);
|
||||
}
|
||||
|
||||
// Belt printers: drop the layers that print nothing (see the by-layer overload), so
|
||||
// the by-object export writes the same layer changes as the by-layer one.
|
||||
// Belt printers: drop the layers that print nothing at all. An object's slicing
|
||||
// frame starts at the belt below its leading end, so its first layers are empty,
|
||||
// and with several objects along the belt those empty layers fall between other
|
||||
// objects' printing layers. A layer change with no moves is noise in the file, and
|
||||
// the preview (libvgcode) numbers its layers from the moves it sees, so a gap folds
|
||||
// every later layer into the one before it. Both print sequences collect their
|
||||
// layers here, so neither writes such a layer.
|
||||
if (object.print()->config().belt_printer.value)
|
||||
layers_to_print.erase(
|
||||
std::remove_if(layers_to_print.begin(), layers_to_print.end(), [&object](const LayerToPrint <p) {
|
||||
@@ -2446,31 +2451,6 @@ std::vector<std::pair<coordf_t, std::vector<GCode::LayerToPrint>>> GCode::collec
|
||||
layers_to_print.emplace_back(std::move(merged));
|
||||
}
|
||||
|
||||
// Belt printers: drop the layers that print nothing at all. An object's
|
||||
// slicing frame starts at the belt below its leading end, so its first layers
|
||||
// are empty, and with several objects along the belt those empty layers fall
|
||||
// between other objects' printing layers. A layer change with no moves is
|
||||
// noise in the file, and the preview (libvgcode) numbers its layers from the
|
||||
// moves it sees, so a gap folds every later layer into the one before it.
|
||||
if (print.config().belt_printer.value) {
|
||||
auto prints_something = [](const LayerToPrint <p) {
|
||||
if (ltp.object_layer != nullptr && ltp.original_object != nullptr &&
|
||||
belt_object_layer_prints_something(*ltp.original_object, *ltp.object_layer))
|
||||
return true;
|
||||
if (ltp.support_layer != nullptr && ltp.support_layer->has_extrusions())
|
||||
return true;
|
||||
if (ltp.belt_brim_band != nullptr && ! ltp.belt_brim_band->fills.empty())
|
||||
return true;
|
||||
return false;
|
||||
};
|
||||
layers_to_print.erase(
|
||||
std::remove_if(layers_to_print.begin(), layers_to_print.end(),
|
||||
[&prints_something](const std::pair<coordf_t, std::vector<LayerToPrint>> &group) {
|
||||
return std::none_of(group.second.begin(), group.second.end(), prints_something);
|
||||
}),
|
||||
layers_to_print.end());
|
||||
}
|
||||
|
||||
return layers_to_print;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user