ENH: enhance filament group alogrithm

1. Try to merge filaments before grouping
2. Set max match num for machine filamnet in match mode

jira:STUDIO-10392

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I2451d838e07ee02f493fda4dc702f3d13b2ad37b
(cherry picked from commit d15fc37ff2fa048e38a0b132bb3ae525ff666fab)
This commit is contained in:
xun.zhang
2025-02-13 21:23:47 +08:00
committed by Noisyfox
parent 1384226447
commit 229ef8884f
6 changed files with 132 additions and 31 deletions

View File

@@ -73,6 +73,7 @@ namespace Slic3r
std::vector<FlushMatrix> flush_matrix;
std::vector<std::vector<unsigned int>> layer_filaments;
std::vector<FilamentGroupUtils::FilamentInfo> filament_info;
std::vector<std::string> filament_ids;
std::vector<std::set<int>> unprintable_filaments;
} model_info;
@@ -133,6 +134,11 @@ namespace Slic3r
std::vector<int> calc_min_flush_group(int* cost = nullptr);
std::vector<int> calc_min_flush_group_by_enum(const std::vector<unsigned int>& used_filaments, int* cost = nullptr);
std::vector<int> calc_min_flush_group_by_pam2(const std::vector<unsigned int>& used_filaments, int* cost = nullptr, int timeout_ms = 300);
std::unordered_map<int, std::vector<int>> try_merge_filaments();
void rebuild_context(const std::unordered_map<int, std::vector<int>>& merged_filaments);
std::vector<int> seperate_merged_filaments(const std::vector<int>& filament_map, const std::unordered_map<int,std::vector<int>>& merged_filaments );
private:
FilamentGroupContext ctx;
std::vector<std::vector<int>> m_memoryed_groups;