Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add internal_infill_min_width setting #13775

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ static std::vector<std::string> s_Preset_print_options {
"wall_distribution_count", "min_feature_size", "min_bead_width",
"top_one_perimeter_type", "only_one_perimeter_first_layer",
"automatic_extrusion_widths", "automatic_infill_combination", "automatic_infill_combination_max_layer_height",
"internal_infill_min_width",
};

static std::vector<std::string> s_Preset_filament_options {
Expand Down
12 changes: 12 additions & 0 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2876,6 +2876,18 @@ void PrintConfigDef::init_fff_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(70));

def = this->add("internal_infill_min_width", coFloat);
def->label = L("Internal infill minimum width");
def->category = L("Infill");
def->tooltip = L("Force solid infill for regions that would be internal infill but are surrounded by solid infill "
"and are thinner than this. This can be used to avoid unneeded patches of internal infill which "
"can slow the print down due to excessive direction changes, or to get a cleaner top surface for "
"e.g. signs with raised text.");
def->sidetext = L("mm");
def->min = 0;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(0));

def = this->add("solid_infill_extruder", coInt);
def->label = L("Solid infill extruder");
def->category = L("Extruders");
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionInt, infill_every_layers))
((ConfigOptionFloatOrPercent, infill_overlap))
((ConfigOptionFloat, infill_speed))
((ConfigOptionFloat, internal_infill_min_width))
// Ironing options
((ConfigOptionBool, ironing))
((ConfigOptionEnum<IroningType>, ironing_type))
Expand Down
33 changes: 32 additions & 1 deletion src/libslic3r/PrintObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,38 @@ void PrintObject::detect_surfaces_type()
{
Polygons topbottom = to_polygons(top);
polygons_append(topbottom, to_polygons(bottom));
surfaces_append(surfaces_out, diff_ex(surfaces_prev, topbottom), stInternal);

Surfaces internal;
surfaces_append(internal, diff_ex(surfaces_prev, topbottom), stInternal);

float internal_infill_min_width = layerm->region().config().internal_infill_min_width.value;
if (internal_infill_min_width > 0) {
// convert thin patches of internal infill surrounded by other surfaces into top surfaces

float shrink_by = scale_(internal_infill_min_width) * 0.5;

// use extrusion width as basis for a heuristic for what should be considered a significant surrounding area
float edge_band_width = layerm->flow(frExternalPerimeter).scaled_width() * 10;

for (Surface &surface : internal) {
// keep as internal if this surface is not thin enough
if (!offset_ex(surface.expolygon, -shrink_by).empty()) {
continue;
}

// calculate an edge band around this surface to probe for adjacent surfaces
ExPolygons edge_band = diff_ex(offset_ex(surface.expolygon, edge_band_width), {surface.expolygon});

// keep as internal if this surface is not sufficiently surrounded by adjacent surfaces
if (area(intersection_ex(surfaces_prev, edge_band)) < area(edge_band) * 0.25) {
continue;
}

surface.surface_type = stTop;
}
}

surfaces_append(surfaces_out, std::move(internal));
}

surfaces_append(surfaces_out, std::move(top));
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,7 @@ void TabPrint::build()
optgroup->append_single_option_line("solid_infill_every_layers", category_path + "solid-infill-every-x-layers");
optgroup->append_single_option_line("fill_angle", category_path + "fill-angle");
optgroup->append_single_option_line("solid_infill_below_area", category_path + "solid-infill-threshold-area");
optgroup->append_single_option_line("internal_infill_min_width", category_path + "internal-infill-min-width");
optgroup->append_single_option_line("bridge_angle");
optgroup->append_single_option_line("only_retract_when_crossing_perimeters");
optgroup->append_single_option_line("infill_first");
Expand Down