From 4092da7aef3e253cdceb8e306d78388a6cc3a49e Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 12 Jul 2023 09:52:59 +0200 Subject: [PATCH 1/2] Revert "Bugfix: When specific wipe tower extruder is set, the extruder indices for the placeholder parser are shifted" This reverts commit 2d6d37f68572419c7051178de9e4e61051641dc9. --- src/libslic3r/GCode/ToolOrdering.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index acc3bf2050..acddb137e5 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -470,16 +470,20 @@ void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_ bool ToolOrdering::insert_wipe_tower_extruder() { // In case that wipe_tower_extruder is set to non-zero, we must make sure that the extruder will be in the list. - // The list is 1-based, as is the config value ! bool changed = false; if (m_print_config_ptr->wipe_tower_extruder != 0) { for (LayerTools& lt : m_layer_tools) { if (lt.wipe_tower_partitions > 0) { - lt.extruders.emplace_back(m_print_config_ptr->wipe_tower_extruder); + lt.extruders.emplace_back(m_print_config_ptr->wipe_tower_extruder - 1); sort_remove_duplicates(lt.extruders); changed = true; } } + // Now convert the 0-based list to 1-based again. + for (LayerTools& lt : m_layer_tools) { + for (auto& extruder : lt.extruders) + ++extruder; + } } return changed; } From 917ae80cc2d992092ef82a5870fe7d82b0834aaf Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 12 Jul 2023 13:40:55 +0200 Subject: [PATCH 2/2] Bugfix: extruder indices mismatch when using specific extruder for the wipe tower (followup of 2d6d37f, which was wrong) --- src/libslic3r/GCode/ToolOrdering.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index acddb137e5..3d1298f3e3 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -169,6 +169,11 @@ ToolOrdering::ToolOrdering(const Print &print, unsigned int first_extruder, bool this->fill_wipe_tower_partitions(print.config(), object_bottom_z, max_layer_height); if (this->insert_wipe_tower_extruder()) { + // Now convert the 0-based list to 1-based again, because that is what reorder_extruder expects. + for (LayerTools& lt : m_layer_tools) { + for (auto& extruder : lt.extruders) + ++extruder; + } this->reorder_extruders(first_extruder); this->fill_wipe_tower_partitions(print.config(), object_bottom_z, max_layer_height); } @@ -478,12 +483,7 @@ bool ToolOrdering::insert_wipe_tower_extruder() sort_remove_duplicates(lt.extruders); changed = true; } - } - // Now convert the 0-based list to 1-based again. - for (LayerTools& lt : m_layer_tools) { - for (auto& extruder : lt.extruders) - ++extruder; - } + } } return changed; }