ENH: update the ext mapping logic

jira: [STUDIO-11970]
Change-Id: Id4cd04da942c5457f0b17877a07c0e24b9c585ec
(cherry picked from commit 09d8050037095f03d3e8f92302f1c568d272a97d)
This commit is contained in:
xin.zhang 2025-05-12 17:19:48 +08:00 committed by Noisyfox
parent 2bbd4f89f8
commit 8065f11b60
3 changed files with 36 additions and 3 deletions

View file

@ -80,6 +80,8 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
, m_mapping_tip_popup(AmsMapingTipPopup(this))
, m_mapping_tutorial_popup(AmsTutorialPopup(this))
{
m_mapping_popup.EnableExtMappingFilaTypeCheck(false);
init_machine_bed_types();
#ifdef __WINDOWS__
SetDoubleBuffered(true);
@ -1956,9 +1958,38 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
MachineObject* obj_ = dev->get_selected_machine();
if (!obj_) return;
std::vector<ConfirmBeforeSendInfo> confirm_text;
// check more than one using in same external spool
std::unordered_set<string> main_external_spool_filas;
std::unordered_set<string> deputy_external_spool_filas;
for (const auto& mapping_info : m_ams_mapping_result) {
if (mapping_info.ams_id == VIRTUAL_AMS_MAIN_ID_STR){
main_external_spool_filas.insert(mapping_info.filament_id);
} else if (mapping_info.ams_id == VIRTUAL_AMS_DEPUTY_ID_STR) {
deputy_external_spool_filas.insert(mapping_info.filament_id);
}
}
if (main_external_spool_filas.size() > 1 || deputy_external_spool_filas.size() > 1) {
confirm_text.push_back(ConfirmBeforeSendInfo(_L("More than one filament types have been mapped to the same external spool, which may cause printing issues. The printer won't pause during printing.")));
has_slice_warnings = true;
} else {
//check filaments type in external spool
for (const auto& mapping_info : m_ams_mapping_result) {
if (mapping_info.ams_id != VIRTUAL_AMS_MAIN_ID_STR && mapping_info.ams_id != VIRTUAL_AMS_DEPUTY_ID_STR) {
continue;
}
const auto& mapped_fila_id = obj_->get_filament_id(mapping_info.ams_id, mapping_info.slot_id);
if (!mapped_fila_id.empty() && (mapped_fila_id != mapping_info.filament_id)) {
confirm_text.push_back(ConfirmBeforeSendInfo(_L("The filament type setting of external spool is different from the filament in the slicing file.")));
has_slice_warnings = true;
break;
}
}
}
//Check Printer Model Id
bool is_same_printer_type = is_same_printer_model();
if (!is_same_printer_type && (m_print_type == PrintFromType::FROM_NORMAL)) {
@ -1966,7 +1997,6 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
has_slice_warnings = true;
}
//check blacklist
for (auto i = 0; i < m_ams_mapping_result.size(); i++) {