ENH:selecting AMS slots with consisten materials
When there are multiple AMS slots, priority should be given to selecting the AMS slot that is consistent with the filament idx JIRA:STUDIO-2564 Change-Id: I9aa208ba24f01ae20913f11c34a7f75a0a2581d5
This commit is contained in:
parent
743f485fad
commit
37feb7fbfa
|
@ -814,6 +814,7 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
|
|||
info.color = tray->second->color;
|
||||
info.type = tray->second->get_filament_type();
|
||||
info.id = tray_index;
|
||||
info.filament_id=tray->second->setting_id;
|
||||
tray_filaments.emplace(std::make_pair(tray_index, info));
|
||||
}
|
||||
}
|
||||
|
@ -936,9 +937,14 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
|
|||
if (distance_map[i][j].is_same_color
|
||||
&& distance_map[i][j].is_type_match) {
|
||||
if (min_val > distance_map[i][j].distance) {
|
||||
|
||||
min_val = distance_map[i][j].distance;
|
||||
picked_src_idx = i;
|
||||
picked_tar_idx = j;
|
||||
}
|
||||
else if (min_val == distance_map[i][j].distance && filaments[i].filament_id == tray_filaments[j].filament_id) {
|
||||
picked_src_idx = i;
|
||||
picked_tar_idx = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -950,6 +956,7 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
|
|||
result[picked_src_idx].color = tray->second.color;
|
||||
result[picked_src_idx].type = tray->second.type;
|
||||
result[picked_src_idx].distance = tray->second.distance;
|
||||
result[picked_src_idx].filament_id = tray->second.filament_id;
|
||||
}
|
||||
else {
|
||||
FilamentInfo info;
|
||||
|
|
|
@ -3549,16 +3549,19 @@ void SelectMachineDialog::set_default_normal()
|
|||
std::vector<std::string> materials;
|
||||
std::vector<std::string> brands;
|
||||
std::vector<std::string> display_materials;
|
||||
std::vector<std::string> m_filaments_id;
|
||||
|
||||
|
||||
auto preset_bundle = wxGetApp().preset_bundle;
|
||||
for (auto filament_name : preset_bundle->filament_presets) {
|
||||
for (auto iter = preset_bundle->filaments.lbegin(); iter != preset_bundle->filaments.end(); iter++) {
|
||||
if (filament_name.compare(iter->name) == 0) {
|
||||
std::string display_filament_type;
|
||||
std::string filament_type = iter->config.get_filament_type(display_filament_type);
|
||||
std::string m_filament_id=iter->filament_id;
|
||||
display_materials.push_back(display_filament_type);
|
||||
materials.push_back(filament_type);
|
||||
|
||||
m_filaments_id.push_back(m_filament_id);
|
||||
if (iter->vendor && !iter->vendor->name.empty())
|
||||
brands.push_back(iter->vendor->name);
|
||||
else
|
||||
|
@ -3650,6 +3653,7 @@ void SelectMachineDialog::set_default_normal()
|
|||
info.id = extruder;
|
||||
info.type = materials[extruder];
|
||||
info.brand = brands[extruder];
|
||||
info.filament_id=m_filaments_id[extruder];
|
||||
info.color = wxString::Format("#%02X%02X%02X%02X", colour_rgb.Red(), colour_rgb.Green(), colour_rgb.Blue(), colour_rgb.Alpha()).ToStdString();
|
||||
m_filaments.push_back(info);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue