ENH: add top_area_threshold param

Jira: 4136

Signed-off-by: qing.zhang <qing.zhang@bambulab.com>
Change-Id: Ic8a3d05cea769ae92dd5f2f2fcd685d660075c95
This commit is contained in:
qing.zhang 2023-08-21 16:40:54 +08:00 committed by Lane.Wei
parent 022445b272
commit 7a7a9f4296
9 changed files with 20 additions and 3 deletions

View File

@ -1018,7 +1018,7 @@ void PerimeterGenerator::process_classic()
else
offset_top_surface = 0;
//don't takes into account too thin areas
double min_width_top_surface = std::max(double(ext_perimeter_spacing / 2 + 10), 1.0 * (double(perimeter_width)));
double min_width_top_surface = (this->object_config->top_area_threshold / 100) * std::max(double(ext_perimeter_spacing / 2 + 10), 1.0 * (double(perimeter_width)));
//BBS: get boungding box of last
BoundingBox last_box = get_extents(last);
@ -1408,7 +1408,7 @@ void PerimeterGenerator::process_arachne()
infill_contour = diff_ex(infill_contour, bridge_area);
}
//BBS: filter small area and extend top surface a bit to hide the wall line
double min_width_top_surface = std::max(double(ext_perimeter_spacing / 4 + 10), double(perimeter_width / 4));
double min_width_top_surface = (this->object_config->top_area_threshold / 100) * std::max(double(ext_perimeter_spacing / 4 + 10), double(perimeter_width / 4));
infill_contour = offset2_ex(infill_contour, -min_width_top_surface, min_width_top_surface + perimeter_width);
//BBS: get the inner surface that not export to top

View File

@ -796,7 +796,7 @@ static std::vector<std::string> s_Preset_print_options {
"detect_narrow_internal_solid_infill",
"gcode_add_line_number", "enable_arc_fitting", "infill_combination", /*"adaptive_layer_height",*/
"support_bottom_interface_spacing", "enable_overhang_speed", "overhang_1_4_speed", "overhang_2_4_speed", "overhang_3_4_speed", "overhang_4_4_speed",
"initial_layer_infill_speed", "top_one_wall_type", "only_one_wall_first_layer",
"initial_layer_infill_speed", "top_one_wall_type", "top_area_threshold", "only_one_wall_first_layer",
"timelapse_type", "internal_bridge_support_thickness",
"wall_generator", "wall_transition_length", "wall_transition_filter_deviation", "wall_transition_angle",
"wall_distribution_count", "min_feature_size", "min_bead_width", "post_process",

View File

@ -749,6 +749,15 @@ void PrintConfigDef::init_fff_params()
def->enum_labels.push_back(L("Topmost surface"));
def->set_default_value(new ConfigOptionEnum<TopOneWallType>(TopOneWallType::Alltop));
def = this->add("top_area_threshold", coPercent);
def->label = L("Top area threshold");
def->tooltip = L("This factor affects the acreage of top area. The small the number the big the top area.");
def->sidetext = L("%");
def->min = 0;
def->max = 500;
def->mode = comDevelop;
def->set_default_value(new ConfigOptionPercent(100));
def = this->add("only_one_wall_first_layer", coBool);
def->label = L("Only one wall on first layer");
def->category = L("Quality");

View File

@ -712,6 +712,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionPercent, min_feature_size))
((ConfigOptionPercent, min_bead_width))
((ConfigOptionEnum<TopOneWallType>, top_one_wall_type))
((ConfigOptionPercent, top_area_threshold))
((ConfigOptionBool, only_one_wall_first_layer))
// OrcaSlicer
((ConfigOptionPercent, seam_gap))

View File

@ -710,6 +710,7 @@ bool PrintObject::invalidate_state_by_config_options(
} else if (
opt_key == "wall_loops"
|| opt_key == "top_one_wall_type"
|| opt_key == "top_area_threshold"
|| opt_key == "only_one_wall_first_layer"
|| opt_key == "initial_layer_line_width"
|| opt_key == "inner_wall_line_width"

View File

@ -197,6 +197,9 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
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);
//BBS: ironing_spacing shouldn't be too small or equal to zero
if (config->opt_float("ironing_spacing") < 0.05)

View File

@ -8533,6 +8533,7 @@ void Plater::calib_flowrate(int pass)
_obj->config.set_key_value("wall_loops", new ConfigOptionInt(3));
_obj->config.set_key_value("top_one_wall_type", new ConfigOptionEnum<TopOneWallType>(TopOneWallType::Topmost));
_obj->config.set_key_value("sparse_infill_density", new ConfigOptionPercent(35));
_obj->config.set_key_value("top_area_threshold", new ConfigOptionPercent(100));
_obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(1));
_obj->config.set_key_value("top_shell_layers", new ConfigOptionInt(5));
_obj->config.set_key_value("detect_thin_wall", new ConfigOptionBool(true));

View File

@ -1884,6 +1884,7 @@ void TabPrint::build()
optgroup->append_single_option_line("top_solid_infill_flow_ratio");
optgroup->append_single_option_line("initial_layer_flow_ratio");
optgroup->append_single_option_line("top_one_wall_type");
optgroup->append_single_option_line("top_area_threshold");
optgroup->append_single_option_line("only_one_wall_first_layer");
optgroup->append_single_option_line("detect_overhang_wall");
optgroup->append_single_option_line("reduce_crossing_wall");

View File

@ -399,6 +399,7 @@ void CalibUtils::calib_flowrate(int pass, const CalibInfo& calib_info, std::stri
_obj->ensure_on_bed();
_obj->config.set_key_value("wall_loops", new ConfigOptionInt(3));
_obj->config.set_key_value("top_one_wall_type", new ConfigOptionEnum<TopOneWallType>(TopOneWallType::Topmost));
_obj->config.set_key_value("top_area_threshold", new ConfigOptionPercent(100));
_obj->config.set_key_value("sparse_infill_density", new ConfigOptionPercent(35));
_obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(1));
_obj->config.set_key_value("top_shell_layers", new ConfigOptionInt(5));