add top area threshold

This commit is contained in:
Wang YB
2024-01-18 10:16:47 +08:00
parent 12da7dac6a
commit 2eecb1ce8a
6 changed files with 29 additions and 4 deletions

View File

@@ -1302,9 +1302,14 @@ void PerimeterGenerator::process_arachne(
out_loops.append(extrusion_coll);
ExPolygons infill_contour = union_ex(wallToolPaths.getInnerContour());
//w17
const coord_t spacing = (perimeters.size() == 1) ? ext_perimeter_spacing2 : perimeter_spacing;
if (offset_ex(infill_contour, -float(spacing / 2.)).empty())
infill_contour.clear(); // Infill region is too small, so let's filter it out.
coord_t perimeter_width = params.perimeter_flow.scaled_width();
double min_width_top_surface = (params.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);
// create one more offset to be used as boundary for fill
// we offset by half the perimeter spacing (to get to the actual infill boundary)
@@ -1440,7 +1445,8 @@ void PerimeterGenerator::process_with_one_wall_arachne(
std::max(ext_perimeter_spacing, perimeter_width));
infill_contour = diff_ex(infill_contour, bridge_area);
}
double min_width_top_surface = std::max(double(ext_perimeter_spacing / 4 + 10), double(perimeter_width / 4));
//w17
double min_width_top_surface = (params.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);
ExPolygons surface_not_export_to_top = diff_ex(the_layer_surface, infill_contour);
@@ -1891,7 +1897,8 @@ void PerimeterGenerator::process_classic(
0.9 * (params.config.perimeters.value <= 1 ? 0. : (perimeter_spacing * (params.config.perimeters.value - 1))));
else
offset_top_surface = 0;
double min_width_top_surface = (100) *
//w17
double min_width_top_surface = (params.object_config.top_area_threshold/100 ) *
std::max(double(ext_perimeter_spacing / 2 + 10), 1.0 * (double(perimeter_width)));
BoundingBox last_box = get_extents(last);
last_box.offset(SCALED_EPSILON);

View File

@@ -477,6 +477,8 @@ static std::vector<std::string> s_Preset_print_options {
,"seam_gap"
//w16
, "top_one_wall_type"
//w17
,"top_area_threshold"
};
static std::vector<std::string> s_Preset_filament_options {

View File

@@ -3550,6 +3550,16 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<TopOneWallType>(TopOneWallType::Alltop));
//w17
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 = comAdvanced;
def->set_default_value(new ConfigOptionPercent(100));
def = this->add("wall_transition_length", coFloatOrPercent);
def->label = L("Perimeter transition length");
def->category = L("Advanced");

View File

@@ -592,6 +592,8 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionBool, detect_narrow_internal_solid_infill))
//w16
((ConfigOptionEnum<TopOneWallType>, top_one_wall_type))
//w17
((ConfigOptionPercent, top_area_threshold))
)
PRINT_CONFIG_CLASS_DEFINE(

View File

@@ -865,8 +865,10 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "wall_distribution_count"
|| opt_key == "min_feature_size"
|| opt_key == "min_bead_width"
//w15
|| opt_key == "top_one_wall_type"){
//w16
|| opt_key == "top_one_wall_type"
//w17
|| opt_key == "top_area_threshold") {
steps.emplace_back(posSlice);
} else if (
opt_key == "seam_position"

View File

@@ -1469,6 +1469,8 @@ void TabPrint::build()
optgroup->append_single_option_line("perimeter_generator");
//w16
optgroup->append_single_option_line("top_one_wall_type");
//w17
optgroup->append_single_option_line("top_area_threshold");
optgroup = page->new_optgroup(L("Fuzzy skin (experimental)"));
category_path = "fuzzy-skin_246186/#";