FIX: empty filament map

1.Caused by uninitialized filament map in mapping for AMS

jira:NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I71ce6001fc6f2e72eb9303fcaba0bac16ad70dc9
This commit is contained in:
xun.zhang 2024-10-15 14:28:45 +08:00 committed by lane.wei
parent 1379b83846
commit 48023e4c15
2 changed files with 3 additions and 2 deletions

View File

@ -241,7 +241,7 @@ namespace Slic3r
}
}
if (tmp_cost < ams_color_dist_threshold && tmp_cost < best_cost) {
if (best_map.empty() || (tmp_cost < ams_color_dist_threshold && tmp_cost < best_cost)) {
best_cost = tmp_cost;
best_map = map;
}

View File

@ -23,6 +23,7 @@
namespace Slic3r {
const static bool g_wipe_into_objects = false;
constexpr double similar_color_threshold_de2000 = 20.0;
static std::set<int>get_filament_by_type(const std::vector<unsigned int>& used_filaments, const PrintConfig* print_config, const std::string& type)
{
@ -1002,7 +1003,7 @@ std::vector<int> ToolOrdering::get_recommended_filament_maps(const std::vector<s
colors.emplace_back(item.option<ConfigOptionStrings>("filament_colour")->get_at(0));
ams_colors[i] = std::move(colors);
}
ret = select_best_group_for_ams(memoryed_maps, used_filaments, used_colors, ams_colors);
ret = select_best_group_for_ams(memoryed_maps, used_filaments, used_colors, ams_colors, similar_color_threshold_de2000);
}
}