ENH: Separate the number of color bleed layers from top_shell_layers

jira: none
Change-Id: I32c14be306ad3fa5970f8c8af8622e086cbca3d9
This commit is contained in:
zhimin.zeng 2025-02-26 14:19:24 +08:00 committed by lane.wei
parent 53e50e285c
commit c782fbb8d9
6 changed files with 31 additions and 11 deletions

View File

@ -1332,9 +1332,9 @@ static inline std::vector<std::vector<ExPolygons>> mmu_segmentation_top_and_bott
int granularity = 1; int granularity = 1;
for (size_t i = 0; i < print_object.num_printing_regions(); ++ i) { for (size_t i = 0; i < print_object.num_printing_regions(); ++ i) {
const PrintRegionConfig &config = print_object.printing_region(i).config(); const PrintRegionConfig &config = print_object.printing_region(i).config();
max_top_layers = std::max(max_top_layers, config.top_shell_layers.value); max_top_layers = std::max(max_top_layers, config.top_color_penetration_layers.value);
max_bottom_layers = std::max(max_bottom_layers, config.bottom_shell_layers.value); max_bottom_layers = std::max(max_bottom_layers, config.bottom_color_penetration_layers.value);
granularity = std::max(granularity, std::max(config.top_shell_layers.value, config.bottom_shell_layers.value) - 1); granularity = std::max(granularity, std::max(config.top_color_penetration_layers.value, config.bottom_color_penetration_layers.value) - 1);
} }
// Project upwards pointing painted triangles over top surfaces, // Project upwards pointing painted triangles over top surfaces,
@ -1473,9 +1473,9 @@ static inline std::vector<std::vector<ExPolygons>> mmu_segmentation_top_and_bott
// Minimum radius of a region to be printable. Used to filter regions by morphological opening. // Minimum radius of a region to be printable. Used to filter regions by morphological opening.
float small_region_threshold { 0.f }; float small_region_threshold { 0.f };
// Maximum number of top layers for a queried color. // Maximum number of top layers for a queried color.
int top_shell_layers { 0 }; int top_color_penetration_layers { 0 };
// Maximum number of bottom layers for a queried color. // Maximum number of bottom layers for a queried color.
int bottom_shell_layers { 0 }; int bottom_color_penetration_layers { 0 };
//BBS: spacing according to width and layer height //BBS: spacing according to width and layer height
float extrusion_spacing{ 0.f }; float extrusion_spacing{ 0.f };
}; };
@ -1493,8 +1493,8 @@ static inline std::vector<std::vector<ExPolygons>> mmu_segmentation_top_and_bott
float nozzle_diamter = float(print_config.nozzle_diameter.get_at(config.wall_filament - 1)); float nozzle_diamter = float(print_config.nozzle_diameter.get_at(config.wall_filament - 1));
float outer_wall_line_width = float(config.outer_wall_line_width) == 0.0 ? (default_line_width == 0.0 ? nozzle_diamter : default_line_width) : float(config.outer_wall_line_width.value); float outer_wall_line_width = float(config.outer_wall_line_width) == 0.0 ? (default_line_width == 0.0 ? nozzle_diamter : default_line_width) : float(config.outer_wall_line_width.value);
out.extrusion_width = std::max<float>(out.extrusion_width, outer_wall_line_width); out.extrusion_width = std::max<float>(out.extrusion_width, outer_wall_line_width);
out.top_shell_layers = std::max<int>(out.top_shell_layers, config.top_shell_layers); out.top_color_penetration_layers = std::max<int>(out.top_color_penetration_layers, config.top_color_penetration_layers);
out.bottom_shell_layers = std::max<int>(out.bottom_shell_layers, config.bottom_shell_layers); out.bottom_color_penetration_layers = std::max<int>(out.bottom_color_penetration_layers, config.bottom_color_penetration_layers);
out.small_region_threshold = config.gap_infill_speed.get_at(print_object.print()->get_extruder_id(config.wall_filament - 1)) > 0 ? out.small_region_threshold = config.gap_infill_speed.get_at(print_object.print()->get_extruder_id(config.wall_filament - 1)) > 0 ?
// Gap fill enabled. Enable a single line of 1/2 extrusion width. // Gap fill enabled. Enable a single line of 1/2 extrusion width.
0.5f * outer_wall_line_width : 0.5f * outer_wall_line_width :
@ -1527,7 +1527,7 @@ static inline std::vector<std::vector<ExPolygons>> mmu_segmentation_top_and_bott
append(triangles_by_color_top[color_idx][layer_idx + layer_idx_offset], top_ex); append(triangles_by_color_top[color_idx][layer_idx + layer_idx_offset], top_ex);
float offset = 0.f; float offset = 0.f;
ExPolygons layer_slices_trimmed = input_expolygons[layer_idx]; ExPolygons layer_slices_trimmed = input_expolygons[layer_idx];
for (int last_idx = int(layer_idx) - 1; last_idx > std::max(int(layer_idx - stat.top_shell_layers), int(0)); --last_idx) { for (int last_idx = int(layer_idx) - 1; last_idx > std::max(int(layer_idx - stat.top_color_penetration_layers), int(0)); --last_idx) {
//BBS: offset width should be 2*spacing to avoid too narrow area which has overlap of wall line //BBS: offset width should be 2*spacing to avoid too narrow area which has overlap of wall line
//offset -= stat.extrusion_width ; //offset -= stat.extrusion_width ;
offset -= (stat.extrusion_spacing + stat.extrusion_width); offset -= (stat.extrusion_spacing + stat.extrusion_width);
@ -1547,7 +1547,7 @@ static inline std::vector<std::vector<ExPolygons>> mmu_segmentation_top_and_bott
append(triangles_by_color_bottom[color_idx][layer_idx + layer_idx_offset], bottom_ex); append(triangles_by_color_bottom[color_idx][layer_idx + layer_idx_offset], bottom_ex);
float offset = 0.f; float offset = 0.f;
ExPolygons layer_slices_trimmed = input_expolygons[layer_idx]; ExPolygons layer_slices_trimmed = input_expolygons[layer_idx];
for (size_t last_idx = layer_idx + 1; last_idx < std::min(layer_idx + stat.bottom_shell_layers, num_layers); ++last_idx) { for (size_t last_idx = layer_idx + 1; last_idx < std::min(layer_idx + stat.bottom_color_penetration_layers, num_layers); ++last_idx) {
//BBS: offset width should be 2*spacing to avoid too narrow area which has overlap of wall line //BBS: offset width should be 2*spacing to avoid too narrow area which has overlap of wall line
//offset -= stat.extrusion_width; //offset -= stat.extrusion_width;
offset -= (stat.extrusion_spacing + stat.extrusion_width); offset -= (stat.extrusion_spacing + stat.extrusion_width);

View File

@ -846,7 +846,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", "slice_closing_radius", "spiral_mode", "spiral_mode_smooth", "spiral_mode_max_xy_smoothing", "slicing_mode", "layer_height", "initial_layer_print_height", "wall_loops", "slice_closing_radius", "spiral_mode", "spiral_mode_smooth", "spiral_mode_max_xy_smoothing", "slicing_mode",
"top_shell_layers", "top_shell_thickness", "bottom_shell_layers", "bottom_shell_thickness", "ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall", "top_shell_layers", "top_shell_thickness", "bottom_shell_layers", "bottom_shell_thickness", "ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall",
"detect_overhang_wall", "detect_overhang_wall", "top_color_penetration_layers", "bottom_color_penetration_layers",
"smooth_speed_discontinuity_area","smooth_coefficient", "smooth_speed_discontinuity_area","smooth_coefficient",
"seam_position", "wall_sequence", "is_infill_first", "sparse_infill_density", "sparse_infill_pattern", "sparse_infill_anchor", "sparse_infill_anchor_max", "seam_position", "wall_sequence", "is_infill_first", "sparse_infill_density", "sparse_infill_pattern", "sparse_infill_anchor", "sparse_infill_anchor_max",
"top_surface_pattern", "bottom_surface_pattern", "internal_solid_infill_pattern", "infill_direction", "bridge_angle","infill_shift_step", "infill_rotate_step", "top_surface_pattern", "bottom_surface_pattern", "internal_solid_infill_pattern", "infill_direction", "bridge_angle","infill_shift_step", "infill_rotate_step",

View File

@ -4195,6 +4195,20 @@ 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_color_penetration_layers", coInt);
def->label = L("Top color layers");
def->category = L("Strength");
def->tooltip = L("This is the number of layers affected by the top color.");
def->min = 1;
def->set_default_value(new ConfigOptionInt(4));
def = this->add("bottom_color_penetration_layers", coInt);
def->label = L("Bottom color layers");
def->category = L("Strength");
def->tooltip = L("This is the number of layers affected by the bottom color.");
def->min = 1;
def->set_default_value(new ConfigOptionInt(3));
def = this->add("travel_speed", coFloats); def = this->add("travel_speed", coFloats);
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

@ -945,6 +945,8 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloatsNullable, top_surface_speed)) ((ConfigOptionFloatsNullable, top_surface_speed))
((ConfigOptionFloatsOrPercentsNullable, small_perimeter_speed)) ((ConfigOptionFloatsOrPercentsNullable, small_perimeter_speed))
((ConfigOptionFloatsNullable, small_perimeter_threshold)) ((ConfigOptionFloatsNullable, small_perimeter_threshold))
((ConfigOptionInt, top_color_penetration_layers))
((ConfigOptionInt, bottom_color_penetration_layers))
//BBS //BBS
((ConfigOptionBoolsNullable, enable_overhang_speed)) ((ConfigOptionBoolsNullable, enable_overhang_speed))
((ConfigOptionFloatsNullable, overhang_1_4_speed)) ((ConfigOptionFloatsNullable, overhang_1_4_speed))

View File

@ -1042,7 +1042,9 @@ bool PrintObject::invalidate_state_by_config_options(
steps.emplace_back(posSupportMaterial); steps.emplace_back(posSupportMaterial);
} else if ( } else if (
opt_key == "bottom_shell_layers" opt_key == "bottom_shell_layers"
|| opt_key == "top_shell_layers") { || opt_key == "top_shell_layers"
|| opt_key == "top_color_penetration_layers"
|| opt_key == "bottom_color_penetration_layers") {
steps.emplace_back(posSlice); steps.emplace_back(posSlice);
#if (0) #if (0)

View File

@ -2082,9 +2082,11 @@ void TabPrint::build()
optgroup->append_single_option_line("top_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface"); optgroup->append_single_option_line("top_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface");
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_color_penetration_layers");
optgroup->append_single_option_line("bottom_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface"); optgroup->append_single_option_line("bottom_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface");
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_color_penetration_layers");
optgroup->append_single_option_line("internal_solid_infill_pattern"); optgroup->append_single_option_line("internal_solid_infill_pattern");
optgroup = page->new_optgroup(L("Sparse infill"), L"param_infill"); optgroup = page->new_optgroup(L("Sparse infill"), L"param_infill");