ENH: limit slope start height range

Jira: 6654

Signed-off-by: qing.zhang <qing.zhang@bambulab.com>
Change-Id: I9dd45022e1350ace220901e70822d27773817221
This commit is contained in:
qing.zhang 2024-03-22 17:03:44 +08:00 committed by Lane.Wei
parent 4127979af6
commit 41c71a6aac
2 changed files with 33 additions and 1 deletions

View File

@ -2877,7 +2877,7 @@ void PrintConfigDef::init_fff_params()
def->sidetext = L("mm or %");
def->min = 0;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloatOrPercent(0.1, false));
def->set_default_value(new ConfigOptionFloatOrPercent(50, true));
def = this->add("seam_slope_entire_loop", coBool);
def->label = L("Scarf around entire wall");

View File

@ -224,6 +224,38 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
apply(config, &new_conf);
is_msg_dlg_already_exist = false;
}
//BBS: limit scarf seam start height range
bool apply_scarf_seam = config->opt_enum<SeamScarfType>("seam_slope_type") != SeamScarfType::None;
if (apply_scarf_seam) {
// scarf seam start height shouldn't small than zero
double layer_height = config->opt_float("layer_height");
double scarf_seam_slope_height = config->option<ConfigOptionFloatOrPercent>("seam_slope_start_height")->get_abs_value(layer_height);
if (scarf_seam_slope_height < EPSILON) {
const wxString msg_text = _(L("Too small scarf start height.\nReset to 50%"));
MessageDialog dialog(m_msg_dlg_parent, msg_text, "", wxICON_WARNING | wxOK);
DynamicPrintConfig new_conf = *config;
is_msg_dlg_already_exist = true;
dialog.ShowModal();
new_conf.set_key_value("seam_slope_start_height", new ConfigOptionFloatOrPercent(50, true));
apply(config, &new_conf);
is_msg_dlg_already_exist = false;
}
// scarf seam start height shouldn't bigger than layer height
if (scarf_seam_slope_height > config->opt_float("layer_height") + EPSILON) {
const wxString msg_text = _(L("Too big scarf start height.\nReset to 50%"));
MessageDialog dialog(m_msg_dlg_parent, msg_text, "", wxICON_WARNING | wxOK);
DynamicPrintConfig new_conf = *config;
is_msg_dlg_already_exist = true;
dialog.ShowModal();
new_conf.set_key_value("seam_slope_start_height", new ConfigOptionFloatOrPercent(50, true));
apply(config, &new_conf);
is_msg_dlg_already_exist = false;
}
}
//BBS: top_area_threshold showed if the top one wall function be applyed
bool top_one_wall_apply = config->opt_enum<TopOneWallType>("top_one_wall_type") == TopOneWallType::None;
toggle_line("top_area_threshold", !top_one_wall_apply);