diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index ea798e94e..da1c50399 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1229,25 +1229,6 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons* if (layer_height > min_nozzle_diameter) return {L("Layer height cannot exceed nozzle diameter"), object, "layer_height"}; - double min_layer_height_from_nozzle = 0.01; - double max_layer_height_from_nozzle = std::numeric_limits::max(); - for (unsigned int extruder_id : extruders) { - min_layer_height_from_nozzle = std::max(min_layer_height_from_nozzle, m_config.min_layer_height.get_at(extruder_id)); - max_layer_height_from_nozzle = std::min(max_layer_height_from_nozzle, m_config.max_layer_height.get_at(extruder_id)); - } - - if (layer_height > max_layer_height_from_nozzle || - layer_height < min_layer_height_from_nozzle) { - return { L("Layer height cannot exceed the limit in Printer Settings -> Extruder -> Layer height limits"), object, "layer_height", STRING_EXCEPT_LAYER_HEIGHT_EXCEEDS_LIMIT }; - } - - for (auto range : object->m_model_object->layer_config_ranges) { - double range_layer_height = range.second.opt_float("layer_height"); - if (range_layer_height > max_layer_height_from_nozzle || - range_layer_height < min_layer_height_from_nozzle) - return { L("Layer height cannot exceed the limit in Printer Settings -> Extruder -> Layer height limits"), nullptr, "layer_height", STRING_EXCEPT_LAYER_HEIGHT_EXCEEDS_LIMIT }; - } - // Validate extrusion widths. std::string err_msg; if (!validate_extrusion_width(object->config(), "line_width", layer_height, err_msg)) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index c69844535..08c016ed2 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1508,6 +1508,33 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value) } } + if(opt_key=="layer_height"){ + auto min_layer_height_from_nozzle=wxGetApp().preset_bundle->full_config().option("min_layer_height")->values; + auto max_layer_height_from_nozzle=wxGetApp().preset_bundle->full_config().option("max_layer_height")->values; + auto layer_height_floor = *std::min_element(min_layer_height_from_nozzle.begin(), min_layer_height_from_nozzle.end()); + auto layer_height_ceil = *std::max_element(max_layer_height_from_nozzle.begin(), max_layer_height_from_nozzle.end()); + bool exceed_minimum_flag = m_config->opt_float("layer_height") < layer_height_floor; + bool exceed_maximum_flag = m_config->opt_float("layer_height") > layer_height_ceil; + + if (exceed_maximum_flag || exceed_minimum_flag) { + wxString msg_text = _(L("Layer height exceeds the limit in Printer Settings -> Extruder -> Layer height limits ,this may cause printing quality issues.")); + msg_text += "\n\n" + _(L("Adjust to the set range automatically? \n")); + MessageDialog dialog(wxGetApp().plater(), msg_text, "", wxICON_WARNING | wxYES | wxNO); + dialog.SetButtonLabel(wxID_YES, "Adjust"); + dialog.SetButtonLabel(wxID_NO, "Ignore"); + auto answer = dialog.ShowModal(); + auto new_conf = *m_config; + if (answer == wxID_YES) { + if (exceed_maximum_flag) + new_conf.set_key_value("layer_height", new ConfigOptionFloat(layer_height_ceil)); + if (exceed_minimum_flag) + new_conf.set_key_value("layer_height",new ConfigOptionFloat(layer_height_floor)); + m_config_manipulation.apply(m_config, &new_conf); + } + wxGetApp().plater()->update(); + } + } + // BBS #if 0 if (opt_key == "extruders_count")