diff --git a/src/slic3r/GUI/AMSMaterialsSetting.cpp b/src/slic3r/GUI/AMSMaterialsSetting.cpp index cdb4ece1d3..61a4a37464 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.cpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.cpp @@ -1135,14 +1135,19 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt) }; int extruder_id = obj->get_extruder_id_by_ams_id(std::to_string(ams_id)); - NozzleVolumeType nozzle_volume_type = NozzleVolumeType::nvtStandard; - if (obj->m_extder_data.extders[extruder_id].current_nozzle_flow_type == NozzleFlowType::NONE_FLOWTYPE) { - MessageDialog dlg(nullptr, _L("There are unset nozzle types. Please set the nozzle types of all extruders before synchronizing."), _L("Warning"), wxICON_WARNING | wxOK); + if (obj->is_nozzle_flow_type_supported() && (obj->get_nozzle_flow_type(extruder_id) == NozzleFlowType::NONE_FLOWTYPE)) + { + MessageDialog dlg(nullptr, _L("The nozzle flow is not set. Please set the nozzle flow rate before editing the filament.\n'Device -> Print parts'"), _L("Warning"), wxICON_WARNING | wxOK); dlg.ShowModal(); } - else { - nozzle_volume_type = NozzleVolumeType(obj->m_extder_data.extders[extruder_id].current_nozzle_flow_type - 1); + + NozzleFlowType nozzle_flow_type = obj->get_nozzle_flow_type(extruder_id); + NozzleVolumeType nozzle_volume_type = NozzleVolumeType::nvtStandard; + if (nozzle_flow_type != NozzleFlowType::NONE_FLOWTYPE) + { + nozzle_volume_type = NozzleVolumeType(nozzle_flow_type - 1); } + if (obj->cali_version >= 0) { // add default item PACalibResult default_item; diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 191d916652..3b4896f038 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -5428,6 +5428,16 @@ std::string MachineObject::get_string_from_fantype(int type) return ""; } +NozzleFlowType MachineObject::get_nozzle_flow_type(int extruder_id) const +{ + if (is_nozzle_flow_type_supported() && m_extder_data.extders.size() > extruder_id) + { + return m_extder_data.extders[extruder_id].current_nozzle_flow_type; + } + + return NozzleFlowType::NONE_FLOWTYPE; +} + void MachineObject::converse_to_duct(bool is_suppt_part_fun, bool is_suppt_aux_fun, bool is_suppt_cham_fun) { m_air_duct_data.modes.clear(); diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 798a3c8862..08dc5344b5 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -743,6 +743,10 @@ public: int big_fan2_speed = 0; uint32_t fan_gear = 0; + /*extruder*/ + [[nodiscard]] bool is_nozzle_flow_type_supported() const { return is_enable_np; }; + [[nodiscard]] NozzleFlowType get_nozzle_flow_type(int extruder_id) const; + //new fan data AirDuctData m_air_duct_data; void converse_to_duct(bool is_suppt_part_fun, bool is_suppt_aux_fun, bool is_suppt_cham_fun); // Convert the data to duct type to make the newand old protocols consistent