mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 15:37:30 -06:00
Layer height can't be zero. Fixed #3268
This commit is contained in:
parent
9416af2247
commit
0325e28b50
1 changed files with 27 additions and 14 deletions
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
|
#include "libslic3r/libslic3r.h"
|
||||||
#include "wxExtensions.hpp"
|
#include "wxExtensions.hpp"
|
||||||
#include "PresetComboBoxes.hpp"
|
#include "PresetComboBoxes.hpp"
|
||||||
#include <wx/wupdlock.h>
|
#include <wx/wupdlock.h>
|
||||||
|
@ -1518,11 +1519,22 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
||||||
auto max_layer_height_from_nozzle=wxGetApp().preset_bundle->full_config().option<ConfigOptionFloats>("max_layer_height")->values;
|
auto max_layer_height_from_nozzle=wxGetApp().preset_bundle->full_config().option<ConfigOptionFloats>("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_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());
|
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;
|
const auto lh = m_config->opt_float("layer_height");
|
||||||
bool exceed_maximum_flag = m_config->opt_float("layer_height") > layer_height_ceil;
|
bool exceed_minimum_flag = lh < layer_height_floor;
|
||||||
|
bool exceed_maximum_flag = lh > layer_height_ceil;
|
||||||
|
|
||||||
if (exceed_maximum_flag || exceed_minimum_flag) {
|
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."));
|
if (lh < EPSILON) {
|
||||||
|
auto msg_text = _(L("Layer height is too small.\nIt will set to min_layer_height\n"));
|
||||||
|
MessageDialog dialog(wxGetApp().plater(), msg_text, "", wxICON_WARNING | wxOK);
|
||||||
|
dialog.SetButtonLabel(wxID_OK, _L("OK"));
|
||||||
|
dialog.ShowModal();
|
||||||
|
auto new_conf = *m_config;
|
||||||
|
new_conf.set_key_value("layer_height", new ConfigOptionFloat(layer_height_floor));
|
||||||
|
m_config_manipulation.apply(m_config, &new_conf);
|
||||||
|
} else {
|
||||||
|
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"));
|
msg_text += "\n\n" + _(L("Adjust to the set range automatically? \n"));
|
||||||
MessageDialog dialog(wxGetApp().plater(), msg_text, "", wxICON_WARNING | wxYES | wxNO);
|
MessageDialog dialog(wxGetApp().plater(), msg_text, "", wxICON_WARNING | wxYES | wxNO);
|
||||||
dialog.SetButtonLabel(wxID_YES, _L("Adjust"));
|
dialog.SetButtonLabel(wxID_YES, _L("Adjust"));
|
||||||
|
@ -1533,9 +1545,10 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
||||||
if (exceed_maximum_flag)
|
if (exceed_maximum_flag)
|
||||||
new_conf.set_key_value("layer_height", new ConfigOptionFloat(layer_height_ceil));
|
new_conf.set_key_value("layer_height", new ConfigOptionFloat(layer_height_ceil));
|
||||||
if (exceed_minimum_flag)
|
if (exceed_minimum_flag)
|
||||||
new_conf.set_key_value("layer_height",new ConfigOptionFloat(layer_height_floor));
|
new_conf.set_key_value("layer_height", new ConfigOptionFloat(layer_height_floor));
|
||||||
m_config_manipulation.apply(m_config, &new_conf);
|
m_config_manipulation.apply(m_config, &new_conf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
wxGetApp().plater()->update();
|
wxGetApp().plater()->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue