diff --git a/src/slic3r/GUI/AMSMaterialsSetting.cpp b/src/slic3r/GUI/AMSMaterialsSetting.cpp index c938e1052..ed62f0c4e 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.cpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.cpp @@ -570,20 +570,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 d07a04ad8..4e26bd316 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 5c8a00011..70f463781 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp @@ -1249,13 +1249,13 @@ 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); check_filament_cali_reliability(selected_filaments_list); - 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); @@ -1276,7 +1276,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; @@ -1284,9 +1284,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; @@ -1296,7 +1296,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) { @@ -1326,7 +1326,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) @@ -1336,22 +1336,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 { @@ -1360,10 +1361,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; } @@ -2153,14 +2154,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); @@ -2174,9 +2177,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 @@ -2190,8 +2193,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 4df430434..a6d4c5128 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.hpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.hpp @@ -245,9 +245,9 @@ protected: void check_nozzle_diameter_for_auto_cali(); 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 0f3a1e53d..43bb4c4f9 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -257,6 +257,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; @@ -6616,8 +6625,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 aea8ea57f..5eafd45ed 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -1164,8 +1164,11 @@ 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 bool load_filaments_blacklist_config(); + 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); }; // change the opacity diff --git a/src/slic3r/GUI/PartPlate.hpp b/src/slic3r/GUI/PartPlate.hpp index b37234504..3abed6287 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -423,7 +423,7 @@ public: bool result = m_slice_result_valid; if (result) result = m_gcode_result ? - (!m_gcode_result->toolpath_outside && !m_gcode_result->filament_printable_reuslt.has_value()) : + (!m_gcode_result->toolpath_outside && m_gcode_result->gcode_check_result.error_code == 0 && !m_gcode_result->filament_printable_reuslt.has_value()) : 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 09b5d52bb..b5a9984a5 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -2767,8 +2767,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); @@ -2833,8 +2832,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 == "prohibition") { has_prohibited_filament = true;