Some constraints applied to support parameters.

This commit is contained in:
tamasmeszaros 2019-03-11 16:27:54 +01:00
parent 766353bbf3
commit 2da3f22fbc
2 changed files with 36 additions and 9 deletions

View file

@ -2574,6 +2574,7 @@ void PrintConfigDef::init_sla_params()
def->sidetext = L("mm");
def->cli = "";
def->min = 0;
def->mode = comAdvanced;
def->default_value = new ConfigOptionFloat(0.4);
def = this->add("support_head_penetration", coFloat);
@ -2674,7 +2675,7 @@ void PrintConfigDef::init_sla_params()
def->cli = "";
def->min = 0;
def->max = 90;
def->mode = comSimple;
def->mode = comExpert;
def->default_value = new ConfigOptionFloat(45);
def = this->add("support_max_bridge_length", coFloat);
@ -2684,7 +2685,7 @@ void PrintConfigDef::init_sla_params()
def->sidetext = L("mm");
def->cli = "";
def->min = 0;
def->mode = comSimple;
def->mode = comAdvanced;
def->default_value = new ConfigOptionFloat(15.0);
def = this->add("support_max_pillar_link_distance", coFloat);
@ -2695,7 +2696,7 @@ void PrintConfigDef::init_sla_params()
def->sidetext = L("mm");
def->cli = "";
def->min = 0; // 0 means no linking
def->mode = comSimple;
def->mode = comAdvanced;
def->default_value = new ConfigOptionFloat(10.0);
def = this->add("support_object_elevation", coFloat);
@ -2706,7 +2707,7 @@ void PrintConfigDef::init_sla_params()
def->cli = "";
def->min = 0;
def->max = 150; // This is the max height of print on SL1
def->mode = comSimple;
def->mode = comAdvanced;
def->default_value = new ConfigOptionFloat(5.0);
def = this->add("support_points_density_relative", coInt);

View file

@ -3337,11 +3337,37 @@ void TabSLAPrint::update()
return; // #ys_FIXME
// #ys_FIXME
// m_update_cnt++;
// ! something to update
// m_update_cnt--;
//
// if (m_update_cnt == 0)
m_update_cnt++;
double head_penetration = m_config->opt_float("support_head_penetration");
double head_width = m_config->opt_float("support_head_width");
if(head_penetration > head_width) {
wxString msg_text = _(L("Head penetration should not be greater than the head width."));
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Invalid Head penetration")), wxICON_WARNING | wxOK);
DynamicPrintConfig new_conf = *m_config;
if (dialog->ShowModal() == wxID_OK) {
new_conf.set_key_value("support_head_penetration", new ConfigOptionFloat(head_width));
}
load_config(new_conf);
}
double pinhead_d = m_config->opt_float("support_head_front_diameter");
double pillar_d = m_config->opt_float("support_pillar_diameter");
if(pinhead_d > pillar_d) {
wxString msg_text = _(L("Pinhead diameter should be smaller than the pillar diameter."));
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Invalid pinhead diameter")), wxICON_WARNING | wxOK);
DynamicPrintConfig new_conf = *m_config;
if (dialog->ShowModal() == wxID_OK) {
new_conf.set_key_value("support_head_front_diameter", new ConfigOptionFloat(pillar_d / 2.0));
}
load_config(new_conf);
}
m_update_cnt--;
if (m_update_cnt == 0)
wxGetApp().mainframe->on_config_changed(m_config);
}