From 472a48acc6d317ccee111caf73a1d67157b080ac Mon Sep 17 00:00:00 2001 From: "xin.zhang" Date: Wed, 16 Apr 2025 14:16:53 +0800 Subject: [PATCH] ENH: add nozzle type ntTungstenCarbide jira: [STUDIO-11597] Change-Id: Ibec41549042d253aeb85ba81e93e7c26a4a56ed2 (cherry picked from commit 1352cff31427eadd2c85ce4c9602ab3379a5ae9e) --- resources/info/nozzle_info.json | 3 ++- src/libslic3r/Print.cpp | 1 + src/libslic3r/PrintConfig.cpp | 5 ++++- src/libslic3r/PrintConfig.hpp | 3 +++ src/slic3r/GUI/DeviceManager.cpp | 4 +++- src/slic3r/GUI/DeviceManager.hpp | 2 +- src/slic3r/GUI/PrintOptionsDialog.cpp | 1 + src/slic3r/GUI/SelectMachine.cpp | 3 +++ src/slic3r/GUI/SyncAmsInfoDialog.cpp | 11 ----------- src/slic3r/GUI/SyncAmsInfoDialog.hpp | 1 - src/slic3r/Utils/CalibUtils.cpp | 2 ++ 11 files changed, 20 insertions(+), 16 deletions(-) diff --git a/resources/info/nozzle_info.json b/resources/info/nozzle_info.json index e5e6631c09..7673f0a627 100644 --- a/resources/info/nozzle_info.json +++ b/resources/info/nozzle_info.json @@ -1,8 +1,9 @@ { - "version": "1.0.0.1", + "version": "1.0.0.2", "nozzle_hrc": { "hardened_steel": 55, "stainless_steel": 20, + "tungsten_carbide", 85, "brass": 2, "undefine": 0 } diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 0544fcfb51..687d963b08 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -2698,6 +2698,7 @@ int Print::get_hrc_by_nozzle_type(const NozzleType&type) nozzle_type_to_hrc = { {"hardened_steel",55}, {"stainless_steel",20}, + {"tungsten_carbide", 85}, {"brass",2}, {"undefine",0} }; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 2b2bf8788b..298b874e5a 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -421,7 +421,8 @@ CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(LayerSeq) static t_config_enum_values s_keys_map_NozzleType { { "undefine", int(NozzleType::ntUndefine) }, { "hardened_steel", int(NozzleType::ntHardenedSteel) }, - { "stainless_steel",int(NozzleType::ntStainlessSteel) }, + { "stainless_steel", int(NozzleType::ntStainlessSteel)}, + { "tungsten_carbide", int(NozzleType::ntTungstenCarbide)}, { "brass", int(NozzleType::ntBrass) } }; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(NozzleType) @@ -3198,10 +3199,12 @@ void PrintConfigDef::init_fff_params() def->enum_values.push_back("undefine"); def->enum_values.push_back("hardened_steel"); def->enum_values.push_back("stainless_steel"); + def->enum_values.push_back("tungsten_carbide"); def->enum_values.push_back("brass"); def->enum_labels.push_back(L("Undefine")); def->enum_labels.push_back(L("Hardened steel")); def->enum_labels.push_back(L("Stainless steel")); + def->enum_labels.push_back(L("Tungsten carbide")); def->enum_labels.push_back(L("Brass")); def->mode = comAdvanced; def->nullable = true; diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 8056d47391..f436250bfe 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -314,6 +314,7 @@ enum NozzleType { ntUndefine = 0, ntHardenedSteel, ntStainlessSteel, + ntTungstenCarbide, ntBrass, ntCount }; @@ -322,6 +323,7 @@ static std::unordered_mapNozzleTypeEumnToStr = { {NozzleType::ntUndefine, "undefine"}, {NozzleType::ntHardenedSteel, "hardened_steel"}, {NozzleType::ntStainlessSteel, "stainless_steel"}, + {NozzleType::ntTungstenCarbide, "tungsten_carbide"}, {NozzleType::ntBrass, "brass"} }; @@ -329,6 +331,7 @@ static std::unordered_mapNozzleTypeStrToEumn = { {"undefine", NozzleType::ntUndefine}, {"hardened_steel", NozzleType::ntHardenedSteel}, {"stainless_steel", NozzleType::ntStainlessSteel}, + {"tungsten_carbide", NozzleType::ntTungstenCarbide}, {"brass", NozzleType::ntBrass} }; diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 53c118e645..fbf80fc066 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -6221,6 +6221,8 @@ void MachineObject::parse_new_info(json print) nozzle_obj.nozzle_type = NozzleType::ntStainlessSteel; } else if (type.substr(2, 2) == std::string("01")) { nozzle_obj.nozzle_type = NozzleType::ntHardenedSteel; + } else if (type.substr(2, 2) == std::string("05")) { + nozzle_obj.nozzle_type = NozzleType::ntTungstenCarbide; } } else { nozzle_obj.tool_type = NozzleToolType::NONE_TOOLTYPE; @@ -6696,7 +6698,7 @@ bool DeviceManager::EnableMultiMachine = false; bool DeviceManager::key_field_only = false; std::vector nozzle_diameter_list{ 0.2f,0.4f,0.6f,0.8f }; -std::vector nozzle_type_list{ "hardened_steel", "stainless_steel" }; +std::vector nozzle_type_list {"hardened_steel", "stainless_steel", "tungsten_carbide"}; DeviceManager::DeviceManager(NetworkAgent* agent) { diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index eaf527d700..b3753778f2 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -188,7 +188,7 @@ struct Nozzle int id; NozzleToolType tool_type; // H nozzle or Cut NozzleFlowType nozzle_flow; // 0-common 1-high flow - NozzleType nozzle_type; // 0-stainless_steel 1-hardened_steel + NozzleType nozzle_type; // 0-stainless_steel 1-hardened_steel 5-tungsten_carbide float diameter = {0.4f}; // 0-0.2mm 1-0.4mm 2-0.6 mm3-0.8mm int max_temp = 0; int wear = 0; diff --git a/src/slic3r/GUI/PrintOptionsDialog.cpp b/src/slic3r/GUI/PrintOptionsDialog.cpp index 1a9368742b..459be793b9 100644 --- a/src/slic3r/GUI/PrintOptionsDialog.cpp +++ b/src/slic3r/GUI/PrintOptionsDialog.cpp @@ -792,6 +792,7 @@ wxString PrinterPartsDialog::GetString(NozzleType nozzle_type) const { switch (nozzle_type) { case Slic3r::ntHardenedSteel: return _L("Hardened Steel"); case Slic3r::ntStainlessSteel: return _L("Stainless Steel"); + case Slic3r::ntTungstenCarbide: return _L("Tungsten Carbide"); default: break; } diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 322be3a644..d4a7bd42b4 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -2308,6 +2308,9 @@ wxString SelectMachineDialog::format_steel_name(NozzleType type) else if (type == NozzleType::ntStainlessSteel) { return _L("Stainless Steel"); } + else if (type == NozzleType::ntTungstenCarbide) { + return _L("Tungsten Carbide"); + } return _L("Unknown"); } diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.cpp b/src/slic3r/GUI/SyncAmsInfoDialog.cpp index 3467858d0f..ca8bc1d4c4 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -2088,17 +2088,6 @@ void SyncAmsInfoDialog::show_errors(wxString &info) confirm_dlg.on_show(); } -wxString SyncAmsInfoDialog::format_steel_name(NozzleType type) -{ - if (type == NozzleType::ntHardenedSteel) { - return _L("Hardened Steel"); - } else if (type == NozzleType::ntStainlessSteel) { - return _L("Stainless Steel"); - } - - return wxEmptyString; -} - void SyncAmsInfoDialog::Enable_Auto_Refill(bool enable) { if (!m_ams_backup_tip) { return; } diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.hpp b/src/slic3r/GUI/SyncAmsInfoDialog.hpp index 8498dce8b7..228bc9a20b 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.hpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.hpp @@ -224,7 +224,6 @@ public: std::string get_print_status_info(PrintDialogStatus status); PrintFromType get_print_type() { return m_print_type; }; - wxString format_steel_name(NozzleType type); wxString format_text(wxString &m_msg); PrintDialogStatus get_status() { return m_print_status; } std::vector sort_string(std::vector strArray); diff --git a/src/slic3r/Utils/CalibUtils.cpp b/src/slic3r/Utils/CalibUtils.cpp index aefca8b8d9..0f62a773c6 100644 --- a/src/slic3r/Utils/CalibUtils.cpp +++ b/src/slic3r/Utils/CalibUtils.cpp @@ -133,6 +133,8 @@ static wxString to_wstring_name(std::string name) return _L("Hardened Steel"); } else if (name == "stainless_steel") { return _L("Stainless Steel"); + } else if (name == "tungsten_carbide") { + return _L("Tungsten Carbide"); } return wxEmptyString;