From 15c7bb729085ec65fee8cc36a5058ac5e883ceb8 Mon Sep 17 00:00:00 2001 From: "xin.zhang" Date: Sun, 27 Apr 2025 17:22:17 +0800 Subject: [PATCH] ENH: add some check job jira: [STUDIO-11883] Change-Id: I9a112b10b18d4c4f4bee5c8076b22f46fb63b13f --- resources/printers/filaments_blacklist.json | 16 +- resources/printers/version.txt | 2 +- src/libslic3r/PresetBundle.cpp | 2 + src/libslic3r/PresetBundle.hpp | 1 + src/slic3r/GUI/DeviceManager.cpp | 204 +++++++++++--------- src/slic3r/GUI/PrePrintChecker.cpp | 3 + src/slic3r/GUI/PrePrintChecker.hpp | 6 +- src/slic3r/GUI/SelectMachine.cpp | 81 +++++++- 8 files changed, 209 insertions(+), 106 deletions(-) diff --git a/resources/printers/filaments_blacklist.json b/resources/printers/filaments_blacklist.json index e7f7e6975..82a7fdae3 100644 --- a/resources/printers/filaments_blacklist.json +++ b/resources/printers/filaments_blacklist.json @@ -85,26 +85,26 @@ { "vendor": "Bambu Lab", "type": "PET-CF", - "action": "prohibition", - "description": "Bambu CF: not supported" + "action": "warning", + "description": "CF/GF: hard and brittle" }, { "vendor": "Bambu Lab", "type": "PA6-CF", - "action": "prohibition", - "description": "Bambu CF: not supported" + "action": "warning", + "description": "CF/GF: hard and brittle" }, { "vendor": "Bambu Lab", "type": "PPS-CF", - "action": "prohibition", - "description": "Bambu CF: not supported" + "action": "warning", + "description": "CF/GF: hard and brittle" }, { "vendor": "Bambu Lab", "type": "PPA-CF", - "action": "prohibition", - "description": "Bambu CF: not supported" + "action": "warning", + "description": "CF/GF: hard and brittle" } ] } diff --git a/resources/printers/version.txt b/resources/printers/version.txt index f86cbb485..e9514d96e 100644 --- a/resources/printers/version.txt +++ b/resources/printers/version.txt @@ -1 +1 @@ -02.00.00.17 \ No newline at end of file +02.00.00.22 \ No newline at end of file diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 8efbe40fa..688d90d84 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -356,6 +356,8 @@ std::optional PresetBundle::get_filament_by_filament_id(const info.nozzle_temp_range_high = config.option("nozzle_temperature_range_high")->values[0]; if (config.has("nozzle_temperature_range_low")) info.nozzle_temp_range_low = config.option("nozzle_temperature_range_low")->values[0]; + if(config.has("temperature_vitrification")) + info.temperature_vitrification = config.option("temperature_vitrification")->values[0]; if (!printer_name.empty()) { std::vector compatible_printers = config.option("compatible_printers")->values; diff --git a/src/libslic3r/PresetBundle.hpp b/src/libslic3r/PresetBundle.hpp index 7a19cd05a..bf0039c70 100644 --- a/src/libslic3r/PresetBundle.hpp +++ b/src/libslic3r/PresetBundle.hpp @@ -57,6 +57,7 @@ struct FilamentBaseInfo std::string vendor; int nozzle_temp_range_low{ 220 }; int nozzle_temp_range_high{ 220 }; + int temperature_vitrification = INT_MAX; bool is_support{ false }; bool is_system{ true }; int filament_printable = 3; diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 2cd563315..74c92ba3f 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -7828,6 +7828,120 @@ void DeviceManager::OnSelectedMachineLost() { GUI::wxGetApp().sidebar().load_ams_list(string(), nullptr); } +// moved from tao.wang and zhimin.zeng +void check_filaments_for_ams_slot(std::string model_id, + std::string tag_vendor, + std::string tag_type, + int ams_id, + int slot_id, + std::string tag_name, + bool& in_blacklist, + std::string& ac, + std::string& info) +{ + if (tag_name.empty()) + { + tag_name = DeviceManager::get_filament_name_from_ams(ams_id, slot_id); + } + + std::unordered_map blacklist_prompt = + { + {"TPU: not supported", _L("TPU is not supported by AMS.")}, + {"Bambu CF: not supported", _L("Bambu PET-CF/PA6-CF/PPA-CF/PPS-CF is not supported by AMS.")}, + {"PVA: flexible", _L("Damp PVA will become flexible and get stuck inside AMS,please take care to dry it before use.")}, + {"CF/GF: hard and brittle", _L("CF/GF filaments are hard and brittle, It's easy to break or get stuck in AMS, please use with caution.")}, + {"PLA-Glow", _L("The rough surface of PLA Glow can accelerate wear on the AMS system, particularly on the internal components of the AMS Lite.")} + }; + + in_blacklist = false; + + if (DeviceManager::filaments_blacklist.contains("blacklist")) + { + for (auto prohibited_filament : DeviceManager::filaments_blacklist["blacklist"]) + { + + std::string vendor; + std::string type; + std::string action; + std::string description; + std::string name = "undefine"; + std::vector model_ids; + + if (prohibited_filament.contains("vendor") && + prohibited_filament.contains("type") && + prohibited_filament.contains("action") && + prohibited_filament.contains("description")) + { + vendor = prohibited_filament["vendor"].get(); + type = prohibited_filament["type"].get(); + action = prohibited_filament["action"].get(); + description = prohibited_filament["description"].get(); + } + else + { + return; + } + + if (prohibited_filament.contains("name")) + { + name = prohibited_filament["name"].get(); + } + + if (prohibited_filament.contains("model_id")) + { + for (auto res : prohibited_filament["model_id"]) + model_ids.emplace_back(res.get()); + } + + std::transform(vendor.begin(), vendor.end(), vendor.begin(), ::tolower); + std::transform(tag_vendor.begin(), tag_vendor.end(), tag_vendor.begin(), ::tolower); + std::transform(tag_type.begin(), tag_type.end(), tag_type.begin(), ::tolower); + std::transform(type.begin(), type.end(), type.begin(), ::tolower); + + + bool mactch_printer = false; + auto it = std::find(model_ids.begin(), model_ids.end(), model_id); + if (it != model_ids.end()) { mactch_printer = true; } + + // third party + if (vendor == "third party") + { + if ("bambu lab" != tag_vendor && tag_type == type) + { + if (name == "undefine" || (tag_name.find(name) != std::string::npos)) + { + + if (model_ids.empty() || mactch_printer) + { + in_blacklist = true; + ac = action; + info = blacklist_prompt[description].ToStdString(); + return; + } + } + } + } + else + { + if (vendor == tag_vendor && tag_type == type) + { + if (name == "undefine" || (tag_name.find(name) != std::string::npos)) + { + + if (model_ids.empty() || mactch_printer) + { + in_blacklist = true; + ac = action; + info = blacklist_prompt[description].ToStdString(); + return; + } + } + } + } + } + } +} + void DeviceManager::check_filaments_in_blacklist(std::string model_id, @@ -7851,94 +7965,8 @@ void DeviceManager::check_filaments_in_blacklist(std::string model_id, if (DeviceManager::is_virtual_slot(ams_id)) { check_filaments_for_vt_slot(tag_vendor, tag_type, ams_id, in_blacklist, ac, info); - return; - } - - if (tag_name.empty()) { - tag_name = get_filament_name_from_ams(ams_id, slot_id); - } - - std::unordered_map blacklist_prompt = - { - {"TPU: not supported", _L("TPU is not supported by AMS.")}, - {"Bambu CF: not supported", _L("Bambu PET-CF/PA6-CF/PPA-CF/PPS-CF is not supported by AMS.")}, - {"PVA: flexible", _L("Damp PVA will become flexible and get stuck inside AMS,please take care to dry it before use.")}, - {"CF/GF: hard and brittle", _L("CF/GF filaments are hard and brittle, It's easy to break or get stuck in AMS, please use with caution.")}, - {"PLA-Glow", _L("The rough surface of PLA Glow can accelerate wear on the AMS system, particularly on the internal components of the AMS Lite.")} - }; - - in_blacklist = false; - - if (filaments_blacklist.contains("blacklist")) { - for (auto prohibited_filament : filaments_blacklist["blacklist"]) { - - std::string vendor; - std::string type; - std::string action; - std::string description; - std::string name = "undefine"; - std::vector model_ids; - - if (prohibited_filament.contains("vendor") && - prohibited_filament.contains("type") && - prohibited_filament.contains("action") && - prohibited_filament.contains("description")) - { - vendor = prohibited_filament["vendor"].get(); - type = prohibited_filament["type"].get(); - action = prohibited_filament["action"].get(); - description = prohibited_filament["description"].get(); - } - else { - return; - } - - if (prohibited_filament.contains("name")) { - name = prohibited_filament["name"].get(); - } - - if (prohibited_filament.contains("model_id")) { - for (auto res : prohibited_filament["model_id"]) - model_ids.emplace_back(res.get()); - } - - std::transform(vendor.begin(), vendor.end(), vendor.begin(), ::tolower); - std::transform(tag_vendor.begin(), tag_vendor.end(), tag_vendor.begin(), ::tolower); - std::transform(tag_type.begin(), tag_type.end(), tag_type.begin(), ::tolower); - std::transform(type.begin(), type.end(), type.begin(), ::tolower); - - - bool mactch_printer = false; - auto it = std::find(model_ids.begin(), model_ids.end(), model_id); - if (it != model_ids.end()) {mactch_printer = true;} - - // third party - if (vendor == "third party") { - if ("bambu lab" != tag_vendor && tag_type == type) { - if (name == "undefine" || (tag_name.find(name) != std::string::npos)) { - - if (model_ids.empty() || mactch_printer) { - in_blacklist = true; - ac = action; - info = blacklist_prompt[description].ToUTF8().data(); - return; - } - } - } - } else { - if (vendor == tag_vendor && tag_type == type) { - if (name == "undefine" || (tag_name.find(name) != std::string::npos)) { - - if (model_ids.empty() || mactch_printer) { - in_blacklist = true; - ac = action; - info = blacklist_prompt[description].ToUTF8().data(); - return; - } - } - } - } - } + } else { + check_filaments_for_ams_slot(model_id, tag_vendor, tag_type, ams_id, slot_id, tag_name, in_blacklist, ac, info); } } diff --git a/src/slic3r/GUI/PrePrintChecker.cpp b/src/slic3r/GUI/PrePrintChecker.cpp index 4ace23b90..b22358e36 100644 --- a/src/slic3r/GUI/PrePrintChecker.cpp +++ b/src/slic3r/GUI/PrePrintChecker.cpp @@ -80,6 +80,9 @@ wxString PrePrintChecker::get_pre_state_msg(PrintDialogStatus status) case PrintStatusTPUUnsupportAutoCali: return _L("TPU 90A/TPU 85A is too soft and does not support automatic Flow Dynamics calibration."); case PrintStatusWarningKvalueNotUsed: return _L("Set dynamic flow calibration to 'OFF' to enable custom dynamic flow value."); case PrintStatusNotSupportedPrintAll: return _L("This printer does not support printing all plates"); + case PrintStatusWarningTpuRightColdPulling: return _L("Please cold pull before printing TPU to avoid clogging. You may use cold pull maintenance on the printer."); + case PrintStatusFilamentHighChamberTempCloseDoor: return _L("High chamber temperature is required. Please close the door."); + case PrintStatusFilamentHighChamberTempSoft: return _L("The filament on the extruder may soften. Please unload."); } return wxEmptyString; } diff --git a/src/slic3r/GUI/PrePrintChecker.hpp b/src/slic3r/GUI/PrePrintChecker.hpp index 5f0a62582..45b34c50b 100644 --- a/src/slic3r/GUI/PrePrintChecker.hpp +++ b/src/slic3r/GUI/PrePrintChecker.hpp @@ -67,7 +67,7 @@ enum PrintDialogStatus : unsigned int { PrintStatusAmsMappingU0Invalid, PrintStatusAmsMappingMixInvalid, PrintStatusTPUUnsupportAutoCali, - PrintStatusHasFilamentInBlackList, + PrintStatusHasFilamentInBlackListError, PrintStatusFilamentErrorEnd, PrintStatusErrorEnd,//->end error<- @@ -85,6 +85,10 @@ enum PrintDialogStatus : unsigned int { // Warnings for filament PrintStatusFilamentWarningBegin, PrintStatusWarningKvalueNotUsed, + PrintStatusWarningTpuRightColdPulling, + PrintStatusHasFilamentInBlackListWarning, + PrintStatusFilamentHighChamberTempCloseDoor, + PrintStatusFilamentHighChamberTempSoft, PrintStatusFilamentWarningEnd, PrintStatusWarningEnd,//->end error<- diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index ac1c1ec24..e84b8c2c1 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -1731,12 +1731,24 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vectoris_lan_mode_printer() && !agent->is_server_connected()) { @@ -3439,12 +3449,17 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_) DeviceManager::check_filaments_in_blacklist(obj_->printer_type, filament_brand, filament_type, m_ams_mapping_result[i].filament_id, ams_id, slot_id, "", in_blacklist, action, info); + if (in_blacklist) { - if (in_blacklist && action == "prohibition") { - std::vector error_msg; - error_msg.emplace_back(info); - show_status(PrintDialogStatus::PrintStatusHasFilamentInBlackList, error_msg); - return; + std::vector error_msg { info }; + if (action == "prohibition") { + show_status(PrintDialogStatus::PrintStatusHasFilamentInBlackListError, error_msg); + return; + } + else if (action == "warning") { + show_status(PrintDialogStatus::PrintStatusHasFilamentInBlackListWarning, error_msg);/** warning check **/ + return; + } } } @@ -3497,6 +3512,56 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_) } } + /*Check the tpu at right*/ + if (obj_->m_extder_data.total_extder_count == 2) { + for (const FilamentInfo& item : m_ams_mapping_result) { + if (item.ams_id.empty()) continue; + if (item.type.compare("TPU") != 0 && item.type.compare("TPU-AMS") != 0) { continue; } + + int extruder_id = obj_->get_extruder_id_by_ams_id(item.ams_id); + if (extruder_id == MAIN_NOZZLE_ID) + { + show_status(PrintDialogStatus::PrintStatusWarningTpuRightColdPulling); + break; + } + } + } + + /*Check high temperture slicing*/ + auto preset_full_config = wxGetApp().preset_bundle->full_config(); + auto chamber_temperatures = preset_full_config.option("chamber_temperatures"); + for (const FilamentInfo& item : m_ams_mapping_result) + { + try + { + int fila_id = atoi(item.filament_id.c_str()); + int chamber_temp = chamber_temperatures->values[fila_id]; + + // check close door + if (obj_->is_support_chamber_edit && chamber_temp >= obj_->chamber_temp_switch_heat) + { + show_status(PrintDialogStatus::PrintStatusFilamentHighChamberTempCloseDoor); + return; + } + + // check vitrification + if (obj_->is_filament_at_extruder()) + { + AmsTray* tray = obj_->get_curr_tray(); + if (tray) + { + auto filament_info = wxGetApp().preset_bundle->get_filament_by_filament_id(tray->setting_id); + if (filament_info && (filament_info->temperature_vitrification - chamber_temp <= 5)) + { + show_status(PrintDialogStatus::PrintStatusFilamentHighChamberTempSoft); + return; + } + } + } + } + catch (std::exception&) { assert(0); } + } + /** normal check **/ show_status(PrintDialogStatus::PrintStatusReadyToGo); }