diff --git a/src/slic3r/GUI/AMSMaterialsSetting.cpp b/src/slic3r/GUI/AMSMaterialsSetting.cpp index 53b9452d20..6aec0ee02a 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.cpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.cpp @@ -563,20 +563,19 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event) //check is it in the filament blacklist - if (!is_virtual_tray() && wxGetApp().app_config->get("skip_ams_blacklist_check") != "true") { + if (wxGetApp().app_config->get("skip_ams_blacklist_check") != "true") { bool in_blacklist = false; std::string action; std::string info; std::string filamnt_type; it->get_filament_type(filamnt_type); - auto vendor = dynamic_cast (it->config.option("filament_vendor")); + auto vendor = dynamic_cast(it->config.option("filament_vendor")); if (vendor && (vendor->values.size() > 0)) { std::string vendor_name = vendor->values[0]; - DeviceManager::check_filaments_in_blacklist(vendor_name, filamnt_type, in_blacklist, action, info); + DeviceManager::check_filaments_in_blacklist(vendor_name, filamnt_type, ams_id, in_blacklist, action, info); } - if (in_blacklist) { if (action == "prohibition") { MessageDialog msg_wingow(nullptr, wxString::FromUTF8(info), _L("Error"), wxICON_WARNING | wxOK); diff --git a/src/slic3r/GUI/CalibrationWizardPage.cpp b/src/slic3r/GUI/CalibrationWizardPage.cpp index 2d8cd96d20..415d3713cb 100644 --- a/src/slic3r/GUI/CalibrationWizardPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardPage.cpp @@ -278,13 +278,14 @@ FilamentComboBox::FilamentComboBox(wxWindow* parent, const wxPoint& pos, const w void FilamentComboBox::ShowPanel() { this->Show(); - m_radioBox->Show(); + set_select_mode(m_mode); } void FilamentComboBox::HidePanel() { this->Hide(); m_radioBox->Hide(); + m_checkBox->Hide(); } void FilamentComboBox::set_select_mode(CalibrationFilamentMode mode) diff --git a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp index f55e3df337..208fabc772 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp @@ -1206,11 +1206,11 @@ void CalibrationPresetPage::check_filament_compatible() std::string error_tips; int bed_temp = 0; - std::vector selected_filaments_list; - for (auto& item: selected_filaments) + std::vector selected_filaments_list; + for (auto &item : selected_filaments) selected_filaments_list.push_back(item.second); - if (!is_filaments_compatiable(selected_filaments_list, bed_temp, incompatiable_filament_name, error_tips)) { + if (!is_filaments_compatiable(selected_filaments, bed_temp, incompatiable_filament_name, error_tips)) { m_tips_panel->set_params(0, 0, 0.0f); if (!error_tips.empty()) { wxString tips = from_u8(error_tips); @@ -1231,7 +1231,7 @@ void CalibrationPresetPage::check_filament_compatible() Layout(); } -bool CalibrationPresetPage::is_filaments_compatiable(const std::vector& prests) +bool CalibrationPresetPage::is_filaments_compatiable(const std::map& prests) { std::string incompatiable_filament_name; std::string error_tips; @@ -1239,9 +1239,9 @@ bool CalibrationPresetPage::is_filaments_compatiable(const std::vector& return is_filaments_compatiable(prests, bed_temp, incompatiable_filament_name, error_tips); } -bool CalibrationPresetPage::is_filament_in_blacklist(Preset* preset, std::string& error_tips) +bool CalibrationPresetPage::is_filament_in_blacklist(int tray_id, Preset* preset, std::string& error_tips) { - if (m_ams_radiobox->GetValue() && wxGetApp().app_config->get("skip_ams_blacklist_check") != "true") { + if (!m_ext_spool_radiobox->GetValue() && wxGetApp().app_config->get("skip_ams_blacklist_check") != "true") { bool in_blacklist = false; std::string action; std::string info; @@ -1251,7 +1251,7 @@ bool CalibrationPresetPage::is_filament_in_blacklist(Preset* preset, std::string auto vendor = dynamic_cast (preset->config.option("filament_vendor")); if (vendor && (vendor->values.size() > 0)) { std::string vendor_name = vendor->values[0]; - DeviceManager::check_filaments_in_blacklist(vendor_name, filamnt_type, in_blacklist, action, info); + DeviceManager::check_filaments_in_blacklist(vendor_name, filamnt_type, tray_id, in_blacklist, action, info); } if (in_blacklist) { @@ -1281,7 +1281,7 @@ bool CalibrationPresetPage::is_filament_in_blacklist(Preset* preset, std::string return true; } -bool CalibrationPresetPage::is_filaments_compatiable(const std::vector &prests, +bool CalibrationPresetPage::is_filaments_compatiable(const std::map &prests, int& bed_temp, std::string& incompatiable_filament_name, std::string& error_tips) @@ -1291,22 +1291,23 @@ bool CalibrationPresetPage::is_filaments_compatiable(const std::vector bed_temp = 0; std::vector filament_types; for (auto &item : prests) { - if (!item) + const auto& item_preset = item.second; + if (!item_preset) continue; // update bed temperature BedType curr_bed_type = BedType(m_comboBox_bed_type->GetSelection() + btDefault + 1); - const ConfigOptionInts *opt_bed_temp_ints = item->config.option(get_bed_temp_key(curr_bed_type)); + const ConfigOptionInts *opt_bed_temp_ints = item_preset->config.option(get_bed_temp_key(curr_bed_type)); int bed_temp_int = 0; if (opt_bed_temp_ints) { bed_temp_int = opt_bed_temp_ints->get_at(0); } if (bed_temp_int <= 0) { - if (!item->alias.empty()) - incompatiable_filament_name = item->alias; + if (!item_preset->alias.empty()) + incompatiable_filament_name = item_preset->alias; else - incompatiable_filament_name = item->name; + incompatiable_filament_name = item_preset->name; return false; } else { @@ -1315,10 +1316,10 @@ bool CalibrationPresetPage::is_filaments_compatiable(const std::vector bed_temp = bed_temp_int; } std::string display_filament_type; - filament_types.push_back(item->config.get_filament_type(display_filament_type, 0)); + filament_types.push_back(item_preset->config.get_filament_type(display_filament_type, 0)); // check is it in the filament blacklist - if (!is_filament_in_blacklist(item, error_tips)) + if (!is_filament_in_blacklist(item.first, item_preset, error_tips)) return false; } @@ -2052,14 +2053,16 @@ void CalibrationPresetPage::select_default_compatible_filament() return; if (m_ams_radiobox->GetValue()) { - std::vector multi_select_filaments; + std::map selected_filament; for (auto &fcb : m_filament_comboBox_list) { if (!fcb->GetRadioBox()->IsEnabled()) continue; - + int tray_id = fcb->get_tray_id(); Preset* preset = const_cast(fcb->GetComboBox()->get_selected_preset()); if (m_cali_filament_mode == CalibrationFilamentMode::CALI_MODEL_SINGLE) { - if (preset && is_filaments_compatiable({preset})) { + selected_filament.clear(); + selected_filament[tray_id] = preset; + if (preset && is_filaments_compatiable(selected_filament)) { fcb->GetRadioBox()->SetValue(true); wxCommandEvent event(wxEVT_RADIOBUTTON); event.SetEventObject(this); @@ -2073,9 +2076,9 @@ void CalibrationPresetPage::select_default_compatible_filament() fcb->GetCheckBox()->SetValue(false); continue; } - multi_select_filaments.push_back(preset); - if (!is_filaments_compatiable(multi_select_filaments)) { - multi_select_filaments.pop_back(); + selected_filament.insert(std::make_pair(tray_id, preset)); + if (!is_filaments_compatiable(selected_filament)) { + selected_filament.erase(tray_id); fcb->GetCheckBox()->SetValue(false); } else @@ -2089,8 +2092,10 @@ void CalibrationPresetPage::select_default_compatible_filament() } } else if (m_ext_spool_radiobox->GetValue()){ + std::map selected_filament; Preset *preset = const_cast(m_virtual_tray_comboBox->GetComboBox()->get_selected_preset()); - if (preset && is_filaments_compatiable({preset})) { + selected_filament[m_virtual_tray_comboBox->get_tray_id()] = preset; + if (preset && is_filaments_compatiable(selected_filament)) { m_virtual_tray_comboBox->GetRadioBox()->SetValue(true); } else m_virtual_tray_comboBox->GetRadioBox()->SetValue(false); diff --git a/src/slic3r/GUI/CalibrationWizardPresetPage.hpp b/src/slic3r/GUI/CalibrationWizardPresetPage.hpp index efb115670b..ad39443df6 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.hpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.hpp @@ -241,9 +241,9 @@ protected: void on_recommend_input_value(); void check_filament_compatible(); - bool is_filaments_compatiable(const std::vector& prests); - bool is_filament_in_blacklist(Preset* preset, std::string& error_tips); - bool is_filaments_compatiable(const std::vector& prests, + bool is_filaments_compatiable(const std::map& prests); + bool is_filament_in_blacklist(int tray_id, Preset* preset, std::string& error_tips); + bool is_filaments_compatiable(const std::map &prests, int& bed_temp, std::string& incompatiable_filament_name, std::string& error_tips); diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 81b2e77644..4cdfaa9e2a 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -252,6 +252,15 @@ PrinterArch get_printer_arch_by_str(std::string arch_str) return PrinterArch::ARCH_CORE_XY; } +void check_filaments_for_vt_slot(const std::string &tag_vendor, const std::string &tag_type, int ams_id, bool &in_blacklist, std::string &ac, std::string &info) +{ + if (tag_type == "TPU" && ams_id != VIRTUAL_TRAY_MAIN_ID) { + ac = "prohibition"; + info = wxString(_L("TPU is not supported by deputy extruder.")).ToUTF8().data(); + in_blacklist = true; + } +} + void AmsTray::update_color_from_str(std::string color) { if (color.empty()) return; @@ -6896,8 +6905,20 @@ bool DeviceManager::load_filaments_blacklist_config() return true; } -void DeviceManager::check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, bool& in_blacklist, std::string& ac, std::string& info) +bool DeviceManager::is_virtual_slot(int ams_id) { + if (ams_id == VIRTUAL_TRAY_MAIN_ID || ams_id == VIRTUAL_TRAY_DEPUTY_ID) + return true; + return false; +} + +void DeviceManager::check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, int ams_id, bool& in_blacklist, std::string& ac, std::string& info) +{ + if (DeviceManager::is_virtual_slot(ams_id)) { + check_filaments_for_vt_slot(tag_vendor, tag_type, ams_id, in_blacklist, ac, info); + return; + } + std::unordered_map blacklist_prompt = { {"TPU: not supported", _L("TPU is not supported by AMS.")}, diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index b4fea72fd8..6ef2eb41b8 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -1217,8 +1217,10 @@ public: static void check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, bool& in_blacklist, std::string& ac, std::string& info); static std::vector get_resolution_supported(std::string type_str); static std::vector get_compatible_machine(std::string type_str); + static void check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, int ams_id, bool &in_blacklist, std::string &ac, std::string &info); static boost::bimaps::bimap get_all_model_id_with_name(); static std::string load_gcode(std::string type_str, std::string gcode_file); + static bool is_virtual_slot(int ams_id); static void update_local_machine(const MachineObject& m); }; diff --git a/src/slic3r/GUI/PartPlate.hpp b/src/slic3r/GUI/PartPlate.hpp index 5c86e1c5c0..fcce7c562b 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -434,7 +434,9 @@ public: { bool result = m_slice_result_valid; if (result) - result = m_gcode_result ? (!m_gcode_result->toolpath_outside) : false;// && !m_gcode_result->conflict_result.has_value() gcode conflict can also print + result = m_gcode_result ? + (!m_gcode_result->toolpath_outside && m_gcode_result->gcode_check_result.error_code == 0) : + false;// && !m_gcode_result->conflict_result.has_value() gcode conflict can also print return result; } diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 1ef377e5ad..47a9c71f43 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -1878,8 +1878,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) bool in_blacklist = false; std::string action; std::string info; - - DeviceManager::check_filaments_in_blacklist(filament_brand, filament_type, in_blacklist, action, info); + DeviceManager::check_filaments_in_blacklist(filament_brand, filament_type, tid, in_blacklist, action, info); if (in_blacklist && action == "warning") { wxString prohibited_error = wxString::FromUTF8(info); @@ -1944,9 +1943,8 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) bool in_blacklist = false; std::string action; std::string info; + DeviceManager::check_filaments_in_blacklist(filament_brand, filament_type, tid, in_blacklist, action, info); - DeviceManager::check_filaments_in_blacklist(filament_brand, filament_type, in_blacklist, action, info); - if (in_blacklist && action == "prohibition") { has_prohibited_filament = true; prohibited_error = wxString::FromUTF8(info);