Bugfix: When specific wipe tower extruder is set, the extruder indices for the placeholder parser are shifted

This commit is contained in:
Lukas Matena 2023-06-30 11:10:21 +02:00
parent d6c721b42e
commit 2d6d37f685

View File

@ -470,20 +470,16 @@ void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_
bool ToolOrdering::insert_wipe_tower_extruder() 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. // 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; bool changed = false;
if (m_print_config_ptr->wipe_tower_extruder != 0) { if (m_print_config_ptr->wipe_tower_extruder != 0) {
for (LayerTools& lt : m_layer_tools) { for (LayerTools& lt : m_layer_tools) {
if (lt.wipe_tower_partitions > 0) { if (lt.wipe_tower_partitions > 0) {
lt.extruders.emplace_back(m_print_config_ptr->wipe_tower_extruder - 1); lt.extruders.emplace_back(m_print_config_ptr->wipe_tower_extruder);
sort_remove_duplicates(lt.extruders); sort_remove_duplicates(lt.extruders);
changed = true; 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; return changed;
} }