FIX:Color mapping,select the same material

The consumables synchronized by AMS are prepared to be set to the same slot as AMS in the disk. However, after initiating printing, the slot value of the modified consumables sorting is not the set material

Jira:STUDIO-2564
Change-Id: I839b10a1b8169091c4e495beb6a15354e436f325
This commit is contained in:
hu.wang 2023-08-24 11:04:51 +08:00 committed by Lane.Wei
parent 464bc7e906
commit 2ad11b3ed2
1 changed files with 10 additions and 1 deletions

View File

@ -945,8 +945,17 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
if (picked_src.find(i) != picked_src.end())
continue;
for (int j = 0; j < distance_map[i].size(); j++) {
if (picked_tar.find(j) != picked_tar.end())
if (picked_tar.find(j) != picked_tar.end()){
if (distance_map[i][j].is_same_color
&& distance_map[i][j].is_type_match
&& distance_map[i][j].distance < (float)0.0001) {
min_val = distance_map[i][j].distance;
picked_src_idx = i;
picked_tar_idx = j;
}
continue;
}
if (distance_map[i][j].is_same_color
&& distance_map[i][j].is_type_match) {
if (min_val > distance_map[i][j].distance) {