ENH: refine filament group algorithm

1.Use max flow network to handle limit
2.Support setting master extruder id
3.Fix the issue in the KMedoids algorithm where data is overwritten
after each retry.

jira:NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Idd2bedf39f61e7a65eb4199852f60b8fbebe0a7d
(cherry picked from commit 3cfb49a1b9dc2c76066ec441f1028f99a4bf99c4)
This commit is contained in:
xun.zhang
2024-09-30 16:30:34 +08:00
committed by Noisyfox
parent be5d9d7c19
commit ae367bacfd
9 changed files with 345 additions and 73 deletions

View File

@@ -2138,8 +2138,7 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
}
// 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; });
// TODO: load master extruder id from config
if (!ToolOrdering::check_tpu_group(used_filaments, filament_maps, &m_config, 1)) {
if (!ToolOrdering::check_tpu_group(used_filaments, filament_maps, &m_config)) {
if (map_mode == FilamentMapMode::fmmManual) {
throw Slic3r::RuntimeError(std::string("Manual grouping error: TPU can only be placed in a nozzle alone."));
}