diff --git a/src/slic3r/GUI/AMSMaterialsSetting.cpp b/src/slic3r/GUI/AMSMaterialsSetting.cpp index dbbe141e5..22b80b6cb 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.cpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.cpp @@ -146,7 +146,7 @@ void AMSMaterialsSetting::create_panel_normal(wxWindow* parent) m_sizer_filament->Add(m_comboBox_filament, 1, wxALIGN_CENTER, 0); - // make the style the same with disable m_input_k_val£¬ FIXME + // make the style the same with disable m_input_k_val, FIXME m_readonly_filament = new TextInput(parent, wxEmptyString, "", "", wxDefaultPosition, AMS_MATERIALS_SETTING_COMBOX_WIDTH, wxTE_CENTRE | wxTE_PROCESS_ENTER); m_readonly_filament->SetBorderColor(StateColor(std::make_pair(0xDBDBDB, (int)StateColor::Focused), std::make_pair(0x00AE42, (int)StateColor::Hovered), std::make_pair(0xDBDBDB, (int)StateColor::Normal))); @@ -1166,14 +1166,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 624082f52..100db365e 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -5380,6 +5380,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 998d40e20..6cc4547e3 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -731,6 +731,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