From cd3219e6654d126363c04d0135bece62dcf94e39 Mon Sep 17 00:00:00 2001 From: "xun.zhang" Date: Fri, 16 May 2025 12:04:26 +0800 Subject: [PATCH] ENH: remove the limit for number of tpu filaments jira:STUDIO-11995 Signed-off-by: xun.zhang Change-Id: Ifd3ff7bf870570f9691b7008d8ca6ee8245c046d --- src/libslic3r/GCode/ToolOrdering.cpp | 33 ---------------------------- src/libslic3r/GCode/ToolOrdering.hpp | 2 -- src/libslic3r/Print.cpp | 9 -------- src/slic3r/GUI/PartPlate.cpp | 6 ++--- 4 files changed, 2 insertions(+), 48 deletions(-) diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index c809bd7fd..37fedcde4 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -675,32 +675,6 @@ void ToolOrdering::collect_extruders(const PrintObject &object, const std::vecto } } -bool ToolOrdering::check_tpu_group(const std::vector&used_filaments,const std::vector& 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> 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) { @@ -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; }); 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 diff --git a/src/libslic3r/GCode/ToolOrdering.hpp b/src/libslic3r/GCode/ToolOrdering.hpp index 29974bda4..eec6f387a 100644 --- a/src/libslic3r/GCode/ToolOrdering.hpp +++ b/src/libslic3r/GCode/ToolOrdering.hpp @@ -243,8 +243,6 @@ public: */ static std::vector get_recommended_filament_maps(const std::vector>& layer_filaments, const Print* print,const FilamentMapMode mode, const std::vector>& physical_unprintables, const std::vector>& geometric_unprintables); - static bool check_tpu_group(const std::vector&used_filaments,const std::vector& filament_maps,const PrintConfig* config); - // should be called after doing reorder FilamentChangeStats get_filament_change_stats(FilamentChangeMode mode); void cal_most_used_extruder(const PrintConfig &config); diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 86555a67a..3948856c1 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -2002,12 +2002,6 @@ void Print::process(std::unordered_map* slice_time, bool } // 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; }); - 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_instance_sequential_active = print_object_instances_ordering.begin(); @@ -2550,9 +2544,6 @@ std::vector> Print::get_physical_unprintable_filaments(const std:: if (m_config.filament_type.get_at(f) == "TPU") 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) { int extruder_id = get_unprintable_extruder_id(f); diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 54177b716..205ceb276 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -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 &tpu_filaments) { - bool tpu_valid = true; - - // only support at most 1 tpu - return tpu_filaments.size() <=1; + // do not limit the num of tpu filament in slicing + return true; } bool PartPlate::check_mixture_of_pla_and_petg(const DynamicPrintConfig &config)