ENH: remove the limit for number of tpu filaments

jira:STUDIO-11995

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Ifd3ff7bf870570f9691b7008d8ca6ee8245c046d
This commit is contained in:
xun.zhang 2025-05-16 12:04:26 +08:00 committed by lane.wei
parent 7b2df96734
commit cd3219e665
4 changed files with 2 additions and 48 deletions

View File

@ -675,32 +675,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) void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_t object_bottom_z, coordf_t max_layer_height)
{ {
@ -1156,13 +1130,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; }); 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); 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 { else {
// we just need to change the map to 0 based // we just need to change the map to 0 based

View File

@ -243,8 +243,6 @@ public:
*/ */
static std::vector<int> get_recommended_filament_maps(const std::vector<std::vector<unsigned int>>& layer_filaments, const Print* print,const FilamentMapMode mode, const std::vector<std::set<int>>& physical_unprintables, const std::vector<std::set<int>>& geometric_unprintables); static std::vector<int> get_recommended_filament_maps(const std::vector<std::vector<unsigned int>>& layer_filaments, const Print* print,const FilamentMapMode mode, const std::vector<std::set<int>>& physical_unprintables, const std::vector<std::set<int>>& geometric_unprintables);
static bool check_tpu_group(const std::vector<unsigned int>&used_filaments,const std::vector<int>& filament_maps,const PrintConfig* config);
// should be called after doing reorder // should be called after doing reorder
FilamentChangeStats get_filament_change_stats(FilamentChangeMode mode); FilamentChangeStats get_filament_change_stats(FilamentChangeMode mode);
void cal_most_used_extruder(const PrintConfig &config); void cal_most_used_extruder(const PrintConfig &config);

View File

@ -2002,12 +2002,6 @@ void Print::process(std::unordered_map<std::string, long long>* slice_time, bool
} }
// check map valid both in auto and mannual mode // check map valid both in auto and mannual mode
std::transform(filament_maps.begin(), filament_maps.end(), filament_maps.begin(), [](int value) {return value - 1; }); std::transform(filament_maps.begin(), filament_maps.end(), filament_maps.begin(), [](int value) {return value - 1; });
if (!ToolOrdering::check_tpu_group(used_filaments, filament_maps, &m_config)) {
int master_extruder_id = m_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);
}
// print_object_instances_ordering = sort_object_instances_by_max_z(print); // print_object_instances_ordering = sort_object_instances_by_max_z(print);
print_object_instance_sequential_active = print_object_instances_ordering.begin(); print_object_instance_sequential_active = print_object_instances_ordering.begin();
@ -2550,9 +2544,6 @@ std::vector<std::set<int>> Print::get_physical_unprintable_filaments(const std::
if (m_config.filament_type.get_at(f) == "TPU") if (m_config.filament_type.get_at(f) == "TPU")
tpu_filaments.insert(f); tpu_filaments.insert(f);
} }
if (tpu_filaments.size() > 1) {
throw Slic3r::RuntimeError(_u8L("Only supports up to one TPU filament."));
}
for (auto f : used_filaments) { for (auto f : used_filaments) {
int extruder_id = get_unprintable_extruder_id(f); int extruder_id = get_unprintable_extruder_id(f);

View File

@ -1356,10 +1356,8 @@ bool PartPlate::check_filament_printable(const DynamicPrintConfig &config, wxStr
bool PartPlate::check_tpu_printable_status(const DynamicPrintConfig & config, const std::vector<int> &tpu_filaments) bool PartPlate::check_tpu_printable_status(const DynamicPrintConfig & config, const std::vector<int> &tpu_filaments)
{ {
bool tpu_valid = true; // do not limit the num of tpu filament in slicing
return true;
// only support at most 1 tpu
return tpu_filaments.size() <=1;
} }
bool PartPlate::check_mixture_of_pla_and_petg(const DynamicPrintConfig &config) bool PartPlate::check_mixture_of_pla_and_petg(const DynamicPrintConfig &config)