FIX: disable unprintable logic for single ext

1.Disable unprintable logic for single extruder printers

jira: NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Iecb4cc80455288925d3acb5688b81aa9ef1c3a8a
This commit is contained in:
xun.zhang 2024-10-21 19:48:58 +08:00 committed by lane.wei
parent acd6016fc8
commit c6ddd329e3
1 changed files with 33 additions and 1 deletions

View File

@ -36,6 +36,20 @@ static std::set<int>get_filament_by_type(const std::vector<unsigned int>& used_f
return target_filaments; return target_filaments;
} }
/**
* @brief Determines the unprintable filaments for each extruder based on its physical attributes
*
* Currently, the criteria for determining unprintable filament include the following:
* 1. TPU filaments can only be placed in the master extruder and must be grouped alone.
* 2. We only support at most 1 tpu filament.
* 3. An extruder can only accommodate filament with a hardness requirement lower than that of its nozzle.
* If extruder num is 1, just return an empty vector.
*
* @param used_filaments Totally used filaments when slicing
* @param config Config that stores releted params
* @return A vector of sets representing unprintable filaments for each extruder
*/
std::vector<std::set<int>> ToolOrdering::get_physical_unprintables(const std::vector<unsigned int>& used_filaments, const PrintConfig* config) std::vector<std::set<int>> ToolOrdering::get_physical_unprintables(const std::vector<unsigned int>& used_filaments, const PrintConfig* config)
{ {
// master saved in config is 1 based,so we should transfer to 0 based here // master saved in config is 1 based,so we should transfer to 0 based here
@ -45,8 +59,12 @@ std::vector<std::set<int>> ToolOrdering::get_physical_unprintables(const std::ve
throw Slic3r::RuntimeError(std::string("Only supports up to one TPU filament.")); throw Slic3r::RuntimeError(std::string("Only supports up to one TPU filament."));
} }
int extruder_num = config->nozzle_diameter.size();
// consider tpu, only place tpu in extruder with ams // consider tpu, only place tpu in extruder with ams
std::vector<std::set<int>>physical_unprintables(config->nozzle_diameter.size()); std::vector<std::set<int>>physical_unprintables(extruder_num);
if (extruder_num < 2)
return physical_unprintables;
int extruder_without_tpu = 1 - master_extruder_id; int extruder_without_tpu = 1 - master_extruder_id;
for (auto& f : tpu_filaments) for (auto& f : tpu_filaments)
physical_unprintables[extruder_without_tpu].insert(f); physical_unprintables[extruder_without_tpu].insert(f);
@ -66,11 +84,25 @@ std::vector<std::set<int>> ToolOrdering::get_physical_unprintables(const std::ve
return physical_unprintables; return physical_unprintables;
} }
/**
* @brief Determines the unprintable filaments for each extruder based on its printable area.
*
* The returned array will always have the same size as the number of extruders.
* If extruder num is 1, just return an empty vector.
* If an extruder has no unprintable filaments, an empty set will also be returned
*
* @param unprintable_arrs An array of unprintable filaments for each extruder
* @param config Containing extruder nums or any other info requested
* @return A vector of sets representing unprintable filaments for each extruder
*/
std::vector<std::set<int>> ToolOrdering::get_geometrical_unprintables(const std::vector<std::vector<int>>& unprintable_arrs, const PrintConfig* config) std::vector<std::set<int>> ToolOrdering::get_geometrical_unprintables(const std::vector<std::vector<int>>& unprintable_arrs, const PrintConfig* config)
{ {
auto arrs_idx_switched = unprintable_arrs; auto arrs_idx_switched = unprintable_arrs;
int extruder_nums = config->nozzle_diameter.size(); int extruder_nums = config->nozzle_diameter.size();
std::vector<std::set<int>> unprintables(extruder_nums); std::vector<std::set<int>> unprintables(extruder_nums);
if(extruder_nums < 2)
return unprintables;
for (auto& arr : arrs_idx_switched) for (auto& arr : arrs_idx_switched)
for (auto& item : arr) for (auto& item : arr)
item -= 1; item -= 1;