Top/bottom surface pattern density (#9783)

* Create top surface density option

* Update tooltip

* Specify what 0% top infill means

* Add density for bottom layers

* Discourage users from using top/bottom density incorrectly

* Fix percent don't need translation

* Fix incorrect indentation

---------

Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
Jonathan Dyrekilde Sommerlund
2025-06-23 04:28:21 +02:00
committed by GitHub
parent 88fb8187d9
commit 51d844af2c
7 changed files with 93 additions and 63 deletions

View File

@@ -657,27 +657,27 @@ std::vector<SurfaceFill> group_fills(const Layer &layer, LockRegionParam &lock_p
if (params.pattern == ipCrossZag || params.pattern == ipLockedZag) { if (params.pattern == ipCrossZag || params.pattern == ipLockedZag) {
params.symmetric_infill_y_axis = region_config.symmetric_infill_y_axis; params.symmetric_infill_y_axis = region_config.symmetric_infill_y_axis;
} else if (params.pattern == ipZigZag) { } else if (params.pattern == ipZigZag) {
params.symmetric_infill_y_axis = region_config.symmetric_infill_y_axis; params.symmetric_infill_y_axis = region_config.symmetric_infill_y_axis;
} }
if (surface.is_solid()) { if (surface.is_solid()) {
params.density = 100.f; if (surface.is_external() && !is_bridge) {
//FIXME for non-thick bridges, shall we allow a bottom surface pattern? if (surface.is_top()) {
if (surface.is_solid_infill())
params.pattern = region_config.internal_solid_infill_pattern.value;
else if (surface.is_external() && ! is_bridge) {
if(surface.is_top())
params.pattern = region_config.top_surface_pattern.value; params.pattern = region_config.top_surface_pattern.value;
else params.density = float(region_config.top_surface_density);
} else { // Surface is bottom
params.pattern = region_config.bottom_surface_pattern.value; params.pattern = region_config.bottom_surface_pattern.value;
params.density = float(region_config.bottom_surface_density);
} }
else { } else if (surface.is_solid_infill()) {
params.pattern = region_config.internal_solid_infill_pattern.value;
params.density = 100.f;
} else {
if (region_config.top_surface_pattern == ipMonotonic || region_config.top_surface_pattern == ipMonotonicLine) if (region_config.top_surface_pattern == ipMonotonic || region_config.top_surface_pattern == ipMonotonicLine)
params.pattern = ipMonotonic; params.pattern = ipMonotonic;
else else
params.pattern = ipRectilinear; params.pattern = ipRectilinear;
params.density = 100.f;
} }
} else if (params.density <= 0) } else if (params.density <= 0)
continue; continue;

View File

@@ -783,7 +783,7 @@ bool Preset::has_cali_lines(PresetBundle* preset_bundle)
static std::vector<std::string> s_Preset_print_options { static std::vector<std::string> s_Preset_print_options {
"layer_height", "initial_layer_print_height", "wall_loops", "alternate_extra_wall", "slice_closing_radius", "spiral_mode", "spiral_mode_smooth", "spiral_mode_max_xy_smoothing", "spiral_starting_flow_ratio", "spiral_finishing_flow_ratio", "slicing_mode", "layer_height", "initial_layer_print_height", "wall_loops", "alternate_extra_wall", "slice_closing_radius", "spiral_mode", "spiral_mode_smooth", "spiral_mode_max_xy_smoothing", "spiral_starting_flow_ratio", "spiral_finishing_flow_ratio", "slicing_mode",
"top_shell_layers", "top_shell_thickness", "bottom_shell_layers", "bottom_shell_thickness", "top_shell_layers", "top_shell_thickness", "top_surface_density", "bottom_surface_density", "bottom_shell_layers", "bottom_shell_thickness",
"extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall", "overhang_reverse", "overhang_reverse_threshold","overhang_reverse_internal_only", "wall_direction", "extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall", "overhang_reverse", "overhang_reverse_threshold","overhang_reverse_internal_only", "wall_direction",
"seam_position", "staggered_inner_seams", "wall_sequence", "is_infill_first", "sparse_infill_density", "sparse_infill_pattern", "lattice_angle_1", "lattice_angle_2", "infill_overhang_angle", "top_surface_pattern", "bottom_surface_pattern", "seam_position", "staggered_inner_seams", "wall_sequence", "is_infill_first", "sparse_infill_density", "sparse_infill_pattern", "lattice_angle_1", "lattice_angle_2", "infill_overhang_angle", "top_surface_pattern", "bottom_surface_pattern",
"infill_direction", "solid_infill_direction", "counterbore_hole_bridging","infill_shift_step", "sparse_infill_rotate_template", "solid_infill_rotate_template", "symmetric_infill_y_axis","skeleton_infill_density", "infill_lock_depth", "skin_infill_depth", "skin_infill_density", "infill_direction", "solid_infill_direction", "counterbore_hole_bridging","infill_shift_step", "sparse_infill_rotate_template", "solid_infill_rotate_template", "symmetric_infill_y_axis","skeleton_infill_density", "infill_lock_depth", "skin_infill_depth", "skin_infill_density",

View File

@@ -5466,6 +5466,30 @@ void PrintConfigDef::init_fff_params()
def->min = 0; def->min = 0;
def->set_default_value(new ConfigOptionFloat(0.6)); def->set_default_value(new ConfigOptionFloat(0.6));
def = this->add("top_surface_density", coPercent);
def->label = L("Top surface density");
def->category = L("Strength");
def->tooltip = L("Density of top surface layer. A value of 100% creates a fully solid, smooth top layer. "
"Reducing this value results in a textured top surface, according to the chosen top surface pattern. "
"A value of 0% will result in only the walls on the top layer being created. "
"Intended for aesthetic or functional purposes, not to fix issues such as over-extrusion.");
def->sidetext = ("%");
def->min = 0;
def->max = 100;
def->set_default_value(new ConfigOptionPercent(100));
def = this->add("bottom_surface_density", coPercent);
def->label = L("Bottom surface density");
def->category = L("Strength");
def->tooltip = L("Density of the bottom surface layer. "
"Intended for aesthetic or functional purposes, not to fix issues such as over-extrusion.\n"
"WARNING: Lowering this value may negatively affect bed adhesion.");
def->sidetext = ("%");
def->min = 10;
def->max = 100;
def->set_default_value(new ConfigOptionPercent(100));
def = this->add("travel_speed", coFloat); def = this->add("travel_speed", coFloat);
def->label = L("Travel"); def->label = L("Travel");
def->tooltip = L("Speed of travel which is faster and without extrusion."); def->tooltip = L("Speed of travel which is faster and without extrusion.");

View File

@@ -939,6 +939,8 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloat, bridge_speed)) ((ConfigOptionFloat, bridge_speed))
((ConfigOptionFloatOrPercent, internal_bridge_speed)) ((ConfigOptionFloatOrPercent, internal_bridge_speed))
((ConfigOptionEnum<EnsureVerticalShellThickness>, ensure_vertical_shell_thickness)) ((ConfigOptionEnum<EnsureVerticalShellThickness>, ensure_vertical_shell_thickness))
((ConfigOptionPercent, top_surface_density))
((ConfigOptionPercent, bottom_surface_density))
((ConfigOptionEnum<InfillPattern>, top_surface_pattern)) ((ConfigOptionEnum<InfillPattern>, top_surface_pattern))
((ConfigOptionEnum<InfillPattern>, bottom_surface_pattern)) ((ConfigOptionEnum<InfillPattern>, bottom_surface_pattern))
((ConfigOptionEnum<InfillPattern>, internal_solid_infill_pattern)) ((ConfigOptionEnum<InfillPattern>, internal_solid_infill_pattern))

View File

@@ -1092,6 +1092,8 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "infill_anchor" || opt_key == "infill_anchor"
|| opt_key == "infill_anchor_max" || opt_key == "infill_anchor_max"
|| opt_key == "top_surface_line_width" || opt_key == "top_surface_line_width"
|| opt_key == "top_surface_density"
|| opt_key == "bottom_surface_density"
|| opt_key == "initial_layer_line_width" || opt_key == "initial_layer_line_width"
|| opt_key == "small_area_infill_flow_compensation" || opt_key == "small_area_infill_flow_compensation"
|| opt_key == "lattice_angle_1" || opt_key == "lattice_angle_1"

View File

@@ -104,8 +104,8 @@ std::map<std::string, std::vector<SimpleSettingData>> SettingsFactory::PART_CAT
{ {
{ L("Quality"), {{"ironing_type", "",8},{"ironing_flow", "",9},{"ironing_spacing", "",10},{"ironing_inset", "", 11},{"bridge_flow", "",11},{"make_overhang_printable", "",11},{"bridge_density", "", 1} { L("Quality"), {{"ironing_type", "",8},{"ironing_flow", "",9},{"ironing_spacing", "",10},{"ironing_inset", "", 11},{"bridge_flow", "",11},{"make_overhang_printable", "",11},{"bridge_density", "", 1}
}}, }},
{ L("Strength"), {{"wall_loops", "",1},{"top_shell_layers", L("Top Solid Layers"),1},{"top_shell_thickness", L("Top Minimum Shell Thickness"),1}, { L("Strength"), {{"wall_loops", "",1},{"top_shell_layers", L("Top Solid Layers"),1},{"top_shell_thickness", L("Top Minimum Shell Thickness"),1},{"top_surface_density", L("Top Surface Density"),1},
{"bottom_shell_layers", L("Bottom Solid Layers"),1}, {"bottom_shell_thickness", L("Bottom Minimum Shell Thickness"),1}, {"bottom_shell_layers", L("Bottom Solid Layers"),1}, {"bottom_shell_thickness", L("Bottom Minimum Shell Thickness"),1},{"bottom_surface_density", L("Bottom Surface Density"),1},
{"sparse_infill_density", "",1},{"sparse_infill_pattern", "",1},{"lattice_angle_1", "",1},{"lattice_angle_2", "",1},{"infill_overhang_angle", "",1},{"infill_anchor", "",1},{"infill_anchor_max", "",1},{"top_surface_pattern", "",1},{"bottom_surface_pattern", "",1}, {"internal_solid_infill_pattern", "",1}, {"sparse_infill_density", "",1},{"sparse_infill_pattern", "",1},{"lattice_angle_1", "",1},{"lattice_angle_2", "",1},{"infill_overhang_angle", "",1},{"infill_anchor", "",1},{"infill_anchor_max", "",1},{"top_surface_pattern", "",1},{"bottom_surface_pattern", "",1}, {"internal_solid_infill_pattern", "",1},
{"infill_combination", "",1}, {"infill_combination_max_layer_height", "",1}, {"infill_wall_overlap", "",1},{"top_bottom_infill_wall_overlap", "",1}, {"solid_infill_direction", "",1}, {"infill_direction", "",1}, {"bridge_angle", "",1}, {"internal_bridge_angle", "",1}, {"minimum_sparse_infill_area", "",1} {"infill_combination", "",1}, {"infill_combination_max_layer_height", "",1}, {"infill_wall_overlap", "",1},{"top_bottom_infill_wall_overlap", "",1}, {"solid_infill_direction", "",1}, {"infill_direction", "",1}, {"bridge_angle", "",1}, {"internal_bridge_angle", "",1}, {"minimum_sparse_infill_area", "",1}
}}, }},

View File

@@ -2197,9 +2197,11 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Top/bottom shells"), L"param_shell"); optgroup = page->new_optgroup(L("Top/bottom shells"), L"param_shell");
optgroup->append_single_option_line("top_shell_layers"); optgroup->append_single_option_line("top_shell_layers");
optgroup->append_single_option_line("top_shell_thickness"); optgroup->append_single_option_line("top_shell_thickness");
optgroup->append_single_option_line("top_surface_density");
optgroup->append_single_option_line("top_surface_pattern"); optgroup->append_single_option_line("top_surface_pattern");
optgroup->append_single_option_line("bottom_shell_layers"); optgroup->append_single_option_line("bottom_shell_layers");
optgroup->append_single_option_line("bottom_shell_thickness"); optgroup->append_single_option_line("bottom_shell_thickness");
optgroup->append_single_option_line("bottom_surface_density");
optgroup->append_single_option_line("bottom_surface_pattern"); optgroup->append_single_option_line("bottom_surface_pattern");
optgroup->append_single_option_line("top_bottom_infill_wall_overlap"); optgroup->append_single_option_line("top_bottom_infill_wall_overlap");