ENH: support E3D print parts display

Jira: [STUDIO-14908]
Change-Id: Ie8273eb6f74a3e7508f440d2092bb48f2e1dbb10
(cherry picked from commit a4218e991e6367e3f1ee3802e785802df2ad6d41)
This commit is contained in:
hemai
2025-10-09 10:31:14 +08:00
committed by Noisyfox
parent c382a8a9c3
commit 104cbb7b9b
8 changed files with 28 additions and 16 deletions

View File

@@ -5,6 +5,7 @@
"stainless_steel": 20,
"tungsten_carbide": 85,
"brass": 2,
"E3D": 55,
"undefine": 0
}
}

View File

@@ -16,6 +16,7 @@ namespace Slic3r
ntStainlessSteel,
ntTungstenCarbide,
ntBrass,
ntE3D,
ntCount
};
}

View File

@@ -315,7 +315,8 @@ static std::unordered_map<NozzleType, std::string>NozzleTypeEumnToStr = {
{NozzleType::ntHardenedSteel, "hardened_steel"},
{NozzleType::ntStainlessSteel, "stainless_steel"},
{NozzleType::ntTungstenCarbide, "tungsten_carbide"},
{NozzleType::ntBrass, "brass"}
{NozzleType::ntBrass, "brass"},
{NozzleType::ntE3D, "E3D"}
};
static std::unordered_map<std::string, NozzleType>NozzleTypeStrToEumn = {
@@ -323,7 +324,8 @@ static std::unordered_map<std::string, NozzleType>NozzleTypeStrToEumn = {
{"hardened_steel", NozzleType::ntHardenedSteel},
{"stainless_steel", NozzleType::ntStainlessSteel},
{"tungsten_carbide", NozzleType::ntTungstenCarbide},
{"brass", NozzleType::ntBrass}
{"brass", NozzleType::ntBrass},
{"E3D", NozzleType::ntE3D}
};
// BBS

View File

@@ -62,8 +62,8 @@ static void s_parse_nozzle_type(const std::string& nozzle_type_str, DevNozzle& n
void DevNozzleSystemParser::ParseV1_0(const nlohmann::json& nozzletype_json,
const nlohmann::json& diameter_json,
const int& nozzle_flow_type,
DevNozzleSystem* system)
DevNozzleSystem* system,
std::optional<int> flag_e3d)
{
//Since both the old and new protocols push data.
// assert(system->m_nozzles.size() < 2);
@@ -100,10 +100,12 @@ void DevNozzleSystemParser::ParseV1_0(const nlohmann::json& nozzletype_json,
}
{
if (nozzle_flow_type != -1) {
if (flag_e3d.has_value()) {
// 0: BBL S_FLOW; 1:E3D H_FLOW (only P)
if (nozzle_flow_type == 1) {
if (flag_e3d.value() == 1) {
// note: E3D = E3D nozzle type + High Flow
nozzle.m_nozzle_flow = NozzleFlowType::H_FLOW;
nozzle.m_nozzle_type = NozzleType::ntE3D;
} else {
nozzle.m_nozzle_flow = NozzleFlowType::S_FLOW;
}

View File

@@ -45,7 +45,7 @@ namespace Slic3r
class DevNozzleSystemParser
{
public:
static void ParseV1_0(const nlohmann::json& nozzletype_json, const nlohmann::json& diameter_json, const int& nozzle_flow_type, DevNozzleSystem* system);
static void ParseV1_0(const nlohmann::json& nozzletype_json, const nlohmann::json& diameter_json, DevNozzleSystem* system, std::optional<int> flag_e3d);
static void ParseV2_0(const json& nozzle_json, DevNozzleSystem* system);
};
};

View File

@@ -2361,6 +2361,7 @@ void MachineObject::reset()
}
}
subtask_ = nullptr;
has_extra_flow_type = false;
m_partskip_ids.clear();
}
@@ -3377,14 +3378,14 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
if (jj.contains("nozzle_diameter") && jj.contains("nozzle_type"))
{
int nozzle_flow_type = -1;
if(jj.contains("flag3")){
int flag3 = jj["flag3"].get<int>();
nozzle_flow_type = get_flag_bits(flag3, 10, 3);
std::optional<int> flag_e3d;
if (jj.contains("flag3")) {
int flag3 = jj["flag3"].get<int>();
flag_e3d = std::make_optional(get_flag_bits(flag3, 10, 3));
has_extra_flow_type = true;
}
DevNozzleSystemParser::ParseV1_0(jj["nozzle_type"], jj["nozzle_diameter"], nozzle_flow_type, m_nozzle_system);
DevNozzleSystemParser::ParseV1_0(jj["nozzle_type"], jj["nozzle_diameter"], m_nozzle_system, flag_e3d);
}
}

View File

@@ -292,7 +292,10 @@ public:
bool is_multi_extruders() const;
int get_extruder_id_by_ams_id(const std::string& ams_id);
[[nodiscard]] bool is_nozzle_flow_type_supported() const { return is_enable_np; };
/* E3D has extra nozzle flow type info */
bool has_extra_flow_type{false};
[[nodiscard]] bool is_nozzle_flow_type_supported() const { return is_enable_np | has_extra_flow_type; };
[[nodiscard]] wxString get_nozzle_replace_url() const;
/*online*/

View File

@@ -1421,9 +1421,11 @@ void PrinterPartsDialog::EnableEditing(bool enable) {
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::ntHardenedSteel: return _L("Hardened Steel");
case Slic3r::ntStainlessSteel: return _L("Stainless Steel");
case Slic3r::ntTungstenCarbide: return _L("Tungsten Carbide");
case Slic3r::ntBrass: return _L("Brass");
case Slic3r::ntE3D: return "E3D";
default: break;
}