ENH: remove the limit for number of tpu filaments

jira:STUDIO-11995

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Ifd3ff7bf870570f9691b7008d8ca6ee8245c046d
(cherry picked from commit cd3219e6654d126363c04d0135bece62dcf94e39)
This commit is contained in:
xun.zhang
2025-05-16 12:04:26 +08:00
committed by Noisyfox
parent 09bdbbbed2
commit 1e9d825dbb
4 changed files with 2 additions and 48 deletions

View File

@@ -697,32 +697,6 @@ void ToolOrdering::collect_extruders(const PrintObject &object, const std::vecto
}
}
bool ToolOrdering::check_tpu_group(const std::vector<unsigned int>&used_filaments,const std::vector<int>& filament_maps,const PrintConfig* config)
{
int check_extruder_id = -1;
int master_extruder_id = config->master_extruder_id.value - 1; // transfer to 0 based idx
std::map<int, std::vector<int>> extruder_filament_nums;
for (unsigned int filament_id : used_filaments) {
int extruder_id = filament_maps[filament_id];
extruder_filament_nums[extruder_id].push_back(filament_id);
std::string filament_type = config->filament_type.get_at(filament_id);
if (filament_type == "TPU") {
// if we meet two TPU filaments, just return false
if(check_extruder_id==-1)
check_extruder_id = filament_maps[filament_id];
else
return false;
}
}
// TPU can only place in master extruder, and it should have no other filaments in the same extruder
if (check_extruder_id != -1 && (check_extruder_id != master_extruder_id || extruder_filament_nums[check_extruder_id].size() > 1)) {
return false;
}
return true;
}
void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_t object_bottom_z, coordf_t max_layer_height)
{
@@ -1183,13 +1157,6 @@ void ToolOrdering::reorder_extruders_for_minimum_flush_volume(bool reorder_first
std::transform(filament_maps.begin(), filament_maps.end(), filament_maps.begin(), [](int value) { return value - 1; });
check_filament_printable_after_group(used_filaments, filament_maps, print_config);
if (nozzle_nums > 1 && !check_tpu_group(used_filaments, filament_maps, print_config)) {
int master_extruder_id = print_config->master_extruder_id.value - 1; // to 0 based
std::string nozzle_name = master_extruder_id == 0 ? _L("left") : _L("right");
std::string exception_str = _L("TPU is incompatible with AMS and must be printed seperately in the ") + nozzle_name + _L(" nozzle.\nPlease adjust the filament group accordingly.");
throw Slic3r::RuntimeError(exception_str);
}
}
else {
// we just need to change the map to 0 based