Sorry had to re-create the PR as I did some chaos in my repo with CLI. xD

Fixes issue https://github.com/OrcaSlicer/OrcaSlicer/issues/10971

Description:
Fix wipe tower filament selection and clean up tool ordering. Added wipe_tower_filament handling to WipeTower2 (store config, mark non-selected tools as “soluble,” and use it in toolchange selection) and ensured the configured wipe‑tower extruder is included in the extruder list for ordering. Removed duplicated/merged tool‑ordering code (extra insert_wipe_tower_extruder definition, duplicate declaration, and redundant reorder block) so the tool order logic runs only once.

<img width="1819" height="799" alt="image" src="https://github.com/user-attachments/assets/cef39026-cf6a-46da-a87a-ef895774699f" />
This commit is contained in:
Argo
2026-02-10 03:56:38 +01:00
committed by GitHub
parent 039a693b25
commit ed3f0e2898
6 changed files with 55 additions and 13 deletions

View File

@@ -306,6 +306,26 @@ void ToolOrdering::handle_dontcare_extruder(unsigned int last_extruder_id)
}
}
bool ToolOrdering::insert_wipe_tower_extruder()
{
if (!m_print_config_ptr || !m_print_config_ptr->enable_prime_tower)
return false;
if (m_print_config_ptr->wipe_tower_filament == 0)
return false;
bool changed = false;
const unsigned int wipe_extruder = (unsigned int)(m_print_config_ptr->wipe_tower_filament - 1);
for (LayerTools &lt : m_layer_tools) {
if (lt.wipe_tower_partitions > 0) {
if (std::find(lt.extruders.begin(), lt.extruders.end(), wipe_extruder) == lt.extruders.end()) {
lt.extruders.emplace_back(wipe_extruder);
changed = true;
}
}
}
return changed;
}
void ToolOrdering::sort_and_build_data(const Print& print, unsigned int first_extruder, bool prime_multi_material)
{
// if first extruder is -1, we can decide the first layer tool order before doing reorder function
@@ -328,9 +348,13 @@ void ToolOrdering::sort_and_build_data(const Print& print, unsigned int first_ex
max_layer_height = calc_max_layer_height(print.config(), max_layer_height);
this->collect_extruder_statistics(prime_multi_material);
this->fill_wipe_tower_partitions(print.config(), object_bottom_z, max_layer_height);
if (this->insert_wipe_tower_extruder()) {
reorder_extruders_for_minimum_flush_volume(reorder_first_layer);
this->fill_wipe_tower_partitions(print.config(), object_bottom_z, max_layer_height);
}
this->collect_extruder_statistics(prime_multi_material);
}
void ToolOrdering::sort_and_build_data(const PrintObject& object , unsigned int first_extruder, bool prime_multi_material)
@@ -343,9 +367,13 @@ void ToolOrdering::sort_and_build_data(const PrintObject& object , unsigned int
double max_layer_height = calc_max_layer_height(object.print()->config(), object.config().layer_height);
this->collect_extruder_statistics(prime_multi_material);
this->fill_wipe_tower_partitions(object.print()->config(), object.layers().front()->print_z - object.layers().front()->height, max_layer_height);
if (this->insert_wipe_tower_extruder()) {
reorder_extruders_for_minimum_flush_volume(reorder_first_layer);
this->fill_wipe_tower_partitions(object.print()->config(), object.layers().front()->print_z - object.layers().front()->height, max_layer_height);
}
this->collect_extruder_statistics(prime_multi_material);
}