From 1bff6b33ce5cc4b81a34af6ae53ea91fd56dfa4a Mon Sep 17 00:00:00 2001 From: "maosheng.wei" Date: Mon, 27 Nov 2023 11:14:19 +0800 Subject: [PATCH] FIX: check recommended nozzle temperature Jira: XXXX Change-Id: I4dbb274cf27ef9c6d20a8479b29af1069652b2bc --- src/slic3r/GUI/ConfigManipulation.cpp | 32 +++++++++++++++++++++++++++ src/slic3r/GUI/ConfigManipulation.hpp | 1 + src/slic3r/GUI/Tab.cpp | 10 +++++++++ 3 files changed, 43 insertions(+) diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 6594978af..821d31bc0 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -50,6 +50,38 @@ void ConfigManipulation::toggle_line(const std::string& opt_key, const bool togg cb_toggle_line(opt_key, toggle); } +void ConfigManipulation::check_nozzle_recommended_temperature_range(DynamicPrintConfig *config) { + if (is_msg_dlg_already_exist) + return; + + int temperature_range_low = config->has("nozzle_temperature_range_low") ? + config->opt_int("nozzle_temperature_range_low", (unsigned int)0) : + 0; + int temperature_range_high = config->has("nozzle_temperature_range_high") ? + config->opt_int("nozzle_temperature_range_high", (unsigned int)0) : + 0; + + if (temperature_range_low != 0 && temperature_range_high != 0) { + wxString msg_text; + bool need_check = false; + if (temperature_range_low < 190 || temperature_range_high > 300) { + msg_text += _L("The recommended minimum temperature is less than 190 degree or the recommended maximum temperature is greater than 300 degree.\n"); + need_check = true; + } + if (temperature_range_low > temperature_range_high) { + msg_text += _L("The recommended minimum temperature cannot be higher than the recommended minimum temperature.\n"); + need_check = true; + } + if (need_check) { + msg_text += _L("Please check.\n"); + MessageDialog dialog(m_msg_dlg_parent, msg_text, "", wxICON_WARNING | wxOK); + is_msg_dlg_already_exist = true; + dialog.ShowModal(); + is_msg_dlg_already_exist = false; + } + } +} + void ConfigManipulation::check_nozzle_temperature_range(DynamicPrintConfig *config) { if (is_msg_dlg_already_exist) diff --git a/src/slic3r/GUI/ConfigManipulation.hpp b/src/slic3r/GUI/ConfigManipulation.hpp index da856c416..af8296890 100644 --- a/src/slic3r/GUI/ConfigManipulation.hpp +++ b/src/slic3r/GUI/ConfigManipulation.hpp @@ -74,6 +74,7 @@ public: void apply_null_fff_config(DynamicPrintConfig *config, std::vector const &keys, std::map const & configs); //BBS: FFF filament nozzle temperature range + void check_nozzle_recommended_temperature_range(DynamicPrintConfig *config); void check_nozzle_temperature_range(DynamicPrintConfig* config); void check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config); void check_filament_max_volumetric_speed(DynamicPrintConfig *config); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index e04e1a74f..aa26a4c95 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2903,6 +2903,16 @@ void TabFilament::build() line.append_option(optgroup->get_option("nozzle_temperature_range_high")); optgroup->append_line(line); + optgroup->m_on_change = [this, optgroup](t_config_option_key opt_key, boost::any value) { + DynamicPrintConfig &filament_config = wxGetApp().preset_bundle->filaments.get_edited_preset().config; + + update_dirty(); + if (!m_postpone_update_ui && (opt_key == "nozzle_temperature_range_low" || opt_key == "nozzle_temperature_range_high")) { + m_config_manipulation.check_nozzle_recommended_temperature_range(&filament_config); + } + on_value_change(opt_key, value); + }; + optgroup = page->new_optgroup(L("Print temperature"), L"param_temperature"); optgroup->append_single_option_line("chamber_temperatures","chamber-temperature");