diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 348c9b9e9..6f41dcbb9 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -2176,6 +2176,32 @@ void SelectMachineDialog::auto_supply_with_ext(std::vector slots) { } } +bool SelectMachineDialog::is_nozzle_type_match(NozzleData data) { + if (data.total_nozzle_count <= 1 || data.nozzles.size() <= 1 || !wxGetApp().preset_bundle) + return false; + + //The default two extruders are left, right, but the order of the extruders on the machine is right, left. + std::vectorflow_type_of_machine; + for (auto it = data.nozzles.rbegin(); it != data.nozzles.rend(); it++) { + std::string str_flow = it->flow_type ? "Big Traffic" : "Normal"; + flow_type_of_machine.push_back(str_flow); + } + //get the nozzle type of preset --> flow_types + const Preset& current_printer = wxGetApp().preset_bundle->printers.get_selected_preset(); + const Preset* base_printer = wxGetApp().preset_bundle->printers.get_preset_base(current_printer); + auto flow_data = wxGetApp().app_config->get_nozzle_volume_types_from_config(base_printer->name); + std::vector flow_types; + boost::split(flow_types, flow_data, boost::is_any_of(",")); + + if (flow_types.size() <= 1 || flow_types.size() != flow_type_of_machine.size()) return false; + + //Only when all preset nozzle types and machine nozzle types are exactly the same, return true. + for (int i = 0; i < flow_types.size(); i++) { + if (flow_types[i] != flow_type_of_machine[i]) return false; + } + return true; +} + void SelectMachineDialog::prepare(int print_plate_idx) { m_print_plate_idx = print_plate_idx; @@ -2371,6 +2397,11 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector 1) @@ -3843,6 +3874,13 @@ void SelectMachineDialog::update_show_status() const auto& full_config = wxGetApp().preset_bundle->full_config(); size_t nozzle_nums = full_config.option("nozzle_diameter")->values.size(); + + //the nozzle type of preset and machine are different + if (nozzle_nums > 1 && !is_nozzle_type_match(obj_->m_nozzle_data)) { + show_status(PrintDialogStatus::PrintStatusNozzleMatchInvalid); + return; + } + if (!m_mapping_popup.m_supporting_mix_print && nozzle_nums == 1) { bool useAms = false; diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index 2df188d33..7c3b49bac 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -315,6 +315,7 @@ enum PrintDialogStatus { PrintStatusAmsMappingInvalid, PrintStatusAmsMappingU0Invalid, PrintStatusAmsMappingMixInvalid, + PrintStatusNozzleMatchInvalid, PrintStatusAmsMappingValid, PrintStatusAmsMappingByOrder, PrintStatusRefreshingMachineList, @@ -542,6 +543,7 @@ public: bool get_ams_mapping_result(std::string& mapping_array_str, std::string& mapping_array_str2, std::string& ams_mapping_info); bool can_hybrid_mapping(NozzleData data); void auto_supply_with_ext(std::vector slots); + bool is_nozzle_type_match(NozzleData data); PrintFromType get_print_type() {return m_print_type;}; wxString format_steel_name(std::string name);