diff --git a/src/slic3r/GUI/AmsMappingPopup.cpp b/src/slic3r/GUI/AmsMappingPopup.cpp index 6999ce065..3723c6520 100644 --- a/src/slic3r/GUI/AmsMappingPopup.cpp +++ b/src/slic3r/GUI/AmsMappingPopup.cpp @@ -334,6 +334,48 @@ void AmsMapingPopup::update_ams_data(std::map amsList) Fit(); } +std::vector AmsMapingPopup::parse_ams_mapping(std::map amsList) +{ + std::vector m_tray_data; + std::map::iterator ams_iter; + + for (ams_iter = amsList.begin(); ams_iter != amsList.end(); ams_iter++) { + + BOOST_LOG_TRIVIAL(trace) << "ams_mapping ams id " << ams_iter->first.c_str(); + + auto ams_indx = atoi(ams_iter->first.c_str()); + Ams* ams_group = ams_iter->second; + std::vector tray_datas; + std::map::iterator tray_iter; + + for (tray_iter = ams_group->trayList.begin(); tray_iter != ams_group->trayList.end(); tray_iter++) { + AmsTray* tray_data = tray_iter->second; + TrayData td; + + td.id = ams_indx * AMS_TOTAL_COUNT + atoi(tray_data->id.c_str()); + + if (!tray_data->is_exists) { + td.type = EMPTY; + } + else { + if (!tray_data->is_tray_info_ready()) { + td.type = THIRD; + } + else { + td.type = NORMAL; + td.colour = AmsTray::decode_color(tray_data->color); + td.name = tray_data->get_display_filament_type(); + td.filament_type = tray_data->get_filament_type(); + } + } + + m_tray_data.push_back(td); + } + } + + return m_tray_data; +} + void AmsMapingPopup::add_ams_mapping(std::vector tray_data) { auto sizer_mapping_list = new wxBoxSizer(wxHORIZONTAL); diff --git a/src/slic3r/GUI/AmsMappingPopup.hpp b/src/slic3r/GUI/AmsMappingPopup.hpp index a81883d19..143d22b8d 100644 --- a/src/slic3r/GUI/AmsMappingPopup.hpp +++ b/src/slic3r/GUI/AmsMappingPopup.hpp @@ -134,7 +134,8 @@ public: void on_left_down(wxMouseEvent &evt); virtual void OnDismiss() wxOVERRIDE; virtual bool ProcessLeftDown(wxMouseEvent &event) wxOVERRIDE; - void paintEvent(wxPaintEvent &evt); + void paintEvent(wxPaintEvent &evt); + std::vector parse_ams_mapping(std::map amsList); }; class AmsMapingTipPopup : public wxPopupTransientWindow diff --git a/src/slic3r/GUI/ReleaseNote.cpp b/src/slic3r/GUI/ReleaseNote.cpp index 1e182b2f4..5b8dfec7c 100644 --- a/src/slic3r/GUI/ReleaseNote.cpp +++ b/src/slic3r/GUI/ReleaseNote.cpp @@ -370,7 +370,7 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(*wxWHITE, StateColor::Normal)); - m_button_ok = new Button(this, _L("OK")); + m_button_ok = new Button(this, _L("Confirm")); m_button_ok->SetBackgroundColor(btn_bg_green); m_button_ok->SetBorderColor(*wxWHITE); m_button_ok->SetTextColor(*wxWHITE); @@ -414,8 +414,9 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons sizer_button->Add(m_button_cancel, 0, wxALL, FromDIP(5)); - m_sizer_right->Add(m_vebview_release_note, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(20)); - m_sizer_right->Add(sizer_button, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(20)); + m_sizer_right->Add(m_vebview_release_note, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(35)); + m_sizer_right->Add(sizer_button, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(35)); + m_sizer_right->Add(0, 0, 0, wxTOP,FromDIP(18)); SetSizer(m_sizer_right); diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index be9a74151..85435666b 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -1773,38 +1773,68 @@ bool SelectMachineDialog::is_same_printer_model() void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) { - wxString confirm_text = _L("Please check the following infomation and click Confirm to continue sending print:\n"); + std::vector confirm_text; + confirm_text.push_back(_L("Please check the following infomation and click Confirm to continue sending print:\n")); //Check Printer Model Id bool is_same_printer_type = is_same_printer_model(); if (!is_same_printer_type) - confirm_text += _L("The printer type used to generate G-code is not the same type as the currently selected physical printer. It is recommend to re-slice by selecting the same printer type.\n"); + confirm_text.push_back(_L("The printer type used to generate G-code is not the same type as the currently selected physical printer. It is recommend to re-slice by selecting the same printer type.\n")); //Check slice warnings bool has_slice_warnings = false; PartPlate* plate = m_plater->get_partplate_list().get_curr_plate(); DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); - if (dev) { - MachineObject* obj_ = dev->get_selected_machine(); - for (auto warning : plate->get_slice_result()->warnings) { - if (warning.msg == BED_TEMP_TOO_HIGH_THAN_FILAMENT) { - if ((obj_->printer_type == "BL-P001" || obj_->printer_type == "BL-P002")) { - confirm_text += Plater::get_slice_warning_string(warning) + "\n"; - has_slice_warnings = true; - } - } - else { + + if(!dev) return; + + MachineObject* obj_ = dev->get_selected_machine(); + for (auto warning : plate->get_slice_result()->warnings) { + if (warning.msg == BED_TEMP_TOO_HIGH_THAN_FILAMENT) { + if ((obj_->printer_type == "BL-P001" || obj_->printer_type == "BL-P002")) { + confirm_text.push_back(Plater::get_slice_warning_string(warning) + "\n"); has_slice_warnings = true; } } + else { + has_slice_warnings = true; + } + } + + + //check for unidentified material + auto mapping_result = m_mapping_popup.parse_ams_mapping(obj_->amsList); + auto has_unknown_filament = false; + + for (auto i = 0; i < m_ams_mapping_result.size(); i++) { + auto tid = m_ams_mapping_result[i].tray_id; + for (auto miter : mapping_result) { + //matching + if (miter.id == tid) { + if (miter.type == TrayType::THIRD || miter.type == TrayType::EMPTY) { + has_unknown_filament = true; + break; + } + } + } } - if (!is_same_printer_type - || has_slice_warnings - ) { + if (has_unknown_filament) { + has_slice_warnings = true; + confirm_text.push_back(_L("There are some unknown filaments in the AMS mappings. Please check whether they are the required filaments. If they are okay, press \"Confirm\" to start printing.") + "\n"); + } + + if (!is_same_printer_type || has_slice_warnings) { wxString confirm_title = _L("Warning"); SecondaryCheckDialog confirm_dlg(this, wxID_ANY, confirm_title); - confirm_dlg.update_text(confirm_text); + wxString info_msg = wxEmptyString; + + for (auto i = 0; i < confirm_text.size(); i++) { + if (i == 0) + continue; + info_msg += wxString::Format("%d:%s\n",i, confirm_text[i]); + } + confirm_dlg.update_text(info_msg); if (confirm_dlg.ShowModal() == wxID_YES) { this->on_ok(); }