Fix of the layer_height / first_layer_height non zero test.

This commit is contained in:
bubnikv 2019-05-20 17:05:16 +02:00
parent b65d5683e2
commit 9bea752567

View File

@ -1248,30 +1248,24 @@ void TabPrint::update()
// layer_height shouldn't be equal to zero // layer_height shouldn't be equal to zero
if (m_config->opt_float("layer_height") < EPSILON) if (m_config->opt_float("layer_height") < EPSILON)
{ {
const wxString msg_text = _(L("Layer height can't be equal to zero.\n" const wxString msg_text = _(L("Zero layer height is not valid.\n\nThe layer height will be reset to 0.01."));
"\nShall I set its value to minimum (0.01)?")); auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Layer height")), wxICON_WARNING | wxOK);
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Layer height")), wxICON_WARNING | wxYES | wxNO);
DynamicPrintConfig new_conf = *m_config; DynamicPrintConfig new_conf = *m_config;
is_msg_dlg_already_exist = true; is_msg_dlg_already_exist = true;
if (dialog->ShowModal() == wxID_YES) dialog->ShowModal();
new_conf.set_key_value("layer_height", new ConfigOptionFloat(0.01)); new_conf.set_key_value("layer_height", new ConfigOptionFloat(0.01));
else {}
load_config(new_conf); load_config(new_conf);
is_msg_dlg_already_exist = false; is_msg_dlg_already_exist = false;
} }
if (fabs(m_config->option<ConfigOptionFloatOrPercent>("first_layer_height")->value - 0) < EPSILON) if (fabs(m_config->option<ConfigOptionFloatOrPercent>("first_layer_height")->value - 0) < EPSILON)
{ {
const wxString msg_text = _(L("First layer height can't be equal to zero.\n" const wxString msg_text = _(L("Zero first layer height is not valid.\n\nThe first layer height will be reset to 0.01."));
"\nShall I set its value to minimum (0.01)?")); auto dialog = new wxMessageDialog(parent(), msg_text, _(L("First layer height")), wxICON_WARNING | wxOK);
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("First layer height")), wxICON_WARNING | wxYES | wxNO);
DynamicPrintConfig new_conf = *m_config; DynamicPrintConfig new_conf = *m_config;
is_msg_dlg_already_exist = true; is_msg_dlg_already_exist = true;
if (dialog->ShowModal() == wxID_YES) dialog->ShowModal();
new_conf.set_key_value("first_layer_height", new ConfigOptionFloatOrPercent(0.01, false)); new_conf.set_key_value("first_layer_height", new ConfigOptionFloatOrPercent(0.01, false));
else {}
load_config(new_conf); load_config(new_conf);
is_msg_dlg_already_exist = false; is_msg_dlg_already_exist = false;
} }