diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index 74a203a7f..2cc69e668 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -612,7 +612,7 @@ void PerimeterGenerator::process() double min = 0.2 * perimeter_width * (1 - INSET_OVERLAP_TOLERANCE); //be sure we don't gapfill where the perimeters are already touching each other (negative spacing). min = std::max(min, double(Flow::new_from_spacing(EPSILON, nozzle_diameter, this->layer_height, false).scaled_width())); - double max = 3. * perimeter_spacing; + double max = 2. * perimeter_spacing; ExPolygons gaps_ex = diff_ex( offset2_ex(gaps, double(-min / 2), double(+min / 2)), offset2_ex(gaps, double(-max / 2), double(+max / 2)), @@ -621,8 +621,8 @@ void PerimeterGenerator::process() for (const ExPolygon &ex : gaps_ex) { //remove too small gaps that are too hard to fill. //ie one that are smaller than an extrusion with width of min and a length of max. - if (ex.area() > min*max) { - MedialAxis{ ex, coord_t(max), coord_t(min), coord_t(this->layer_height) }.build(polylines); + if (ex.area() > scale_(scale_(this->config->gap_fill_min_area.get_abs_value(unscaled(perimeter_width)*unscaled(perimeter_width))))) { + MedialAxis{ ex, coord_t(max*1.1), coord_t(min), coord_t(this->layer_height) }.build(polylines); } } if (!polylines.empty()) { diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 399641c26..a5d182ded 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -1142,13 +1142,22 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionInts { 200 }); def = this->add("gap_fill", coBool); - def->label = L("Gap fill"); + def->label = L(""); + def->full_label = L("Enable Gap Fill"); def->category = L("Advanced"); def->tooltip = L("Enable gap fill algorithm. It will extrude small lines between perimeters " "when there is not enough space for another perimeter or an infill."); def->mode = comExpert; def->set_default_value(new ConfigOptionBool(true)); + def = this->add("gap_fill_min_area", coFloatOrPercent); + def->label = L("Min surface"); + def->full_label = ("Min gap-fill surface"); + def->tooltip = L("This setting represents the minimum mm² for a gapfill extrusion to be created.\nCan be a % of (perimeter width)²"); + def->min = 0; + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloatOrPercent{ 100,true }); + def = this->add("gap_fill_speed", coFloat); def->label = L("Gap fill"); def->full_label = L("Gap fill speed"); @@ -1585,7 +1594,7 @@ void PrintConfigDef::init_fff_params() def->min = 0; def->max = 100; def->mode = comSimple; - def->set_default_value(new ConfigOptionInts { 35 }); + def->set_default_value(new ConfigOptionInts{ 35 }); def = this->add("min_layer_height", coFloats); def->label = L("Min"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index cabc0a370..77cc9bb38 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -586,14 +586,13 @@ public: ConfigOptionFloatOrPercent external_perimeter_extrusion_width; ConfigOptionFloatOrPercent external_perimeter_speed; ConfigOptionBool external_perimeters_first; - ConfigOptionBool perimeter_loop; - ConfigOptionEnum perimeter_loop_seam; ConfigOptionBool extra_perimeters; ConfigOptionBool only_one_perimeter_top; ConfigOptionFloat fill_angle; ConfigOptionPercent fill_density; ConfigOptionEnum fill_pattern; ConfigOptionBool gap_fill; + ConfigOptionFloatOrPercent gap_fill_min_area; ConfigOptionFloat gap_fill_speed; ConfigOptionInt infill_extruder; ConfigOptionFloatOrPercent infill_extrusion_width; @@ -609,6 +608,8 @@ public: ConfigOptionEnum no_perimeter_unsupported_algo; ConfigOptionInt perimeter_extruder; ConfigOptionFloatOrPercent perimeter_extrusion_width; + ConfigOptionBool perimeter_loop; + ConfigOptionEnum perimeter_loop_seam; ConfigOptionFloat perimeter_speed; // Total number of perimeters. ConfigOptionInt perimeters; @@ -649,14 +650,13 @@ protected: OPT_PTR(external_perimeter_extrusion_width); OPT_PTR(external_perimeter_speed); OPT_PTR(external_perimeters_first); - OPT_PTR(perimeter_loop); - OPT_PTR(perimeter_loop_seam); OPT_PTR(extra_perimeters); OPT_PTR(only_one_perimeter_top); OPT_PTR(fill_angle); OPT_PTR(fill_density); OPT_PTR(fill_pattern); OPT_PTR(gap_fill); + OPT_PTR(gap_fill_min_area); OPT_PTR(gap_fill_speed); OPT_PTR(infill_extruder); OPT_PTR(infill_extrusion_width); @@ -671,6 +671,8 @@ protected: OPT_PTR(no_perimeter_unsupported_algo); OPT_PTR(perimeter_extruder); OPT_PTR(perimeter_extrusion_width); + OPT_PTR(perimeter_loop); + OPT_PTR(perimeter_loop_seam); OPT_PTR(perimeter_speed); OPT_PTR(perimeters); OPT_PTR(small_perimeter_speed); diff --git a/src/slic3r/GUI/Preset.cpp b/src/slic3r/GUI/Preset.cpp index 96dc1d057..301e5626b 100644 --- a/src/slic3r/GUI/Preset.cpp +++ b/src/slic3r/GUI/Preset.cpp @@ -393,7 +393,11 @@ const std::vector& Preset::print_options() #endif /* HAS_PRESSURE_EQUALIZER */ "perimeter_speed", "small_perimeter_speed", "external_perimeter_speed", "infill_speed", "solid_infill_speed", "top_solid_infill_speed", "support_material_speed", "support_material_xy_spacing", "support_material_interface_speed", - "bridge_speed", "gap_fill", "gap_fill_speed", "travel_speed", "first_layer_speed", "perimeter_acceleration", "infill_acceleration", + "bridge_speed", + "gap_fill", + "gap_fill_min_area", + "gap_fill_speed", + "travel_speed", "first_layer_speed", "perimeter_acceleration", "infill_acceleration", "bridge_acceleration", "first_layer_acceleration", "default_acceleration", "skirts", "skirt_distance", "skirt_height", "min_skirt_length", "brim_width", "brim_ears", "brim_ears_max_angle", "support_material", "support_material_auto", "support_material_threshold", "support_material_enforce_layers", diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 8b50a0113..3b8c0b3c7 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1064,7 +1064,10 @@ void TabPrint::build() optgroup->append_single_option_line("no_perimeter_unsupported_algo"); optgroup = page->new_optgroup(_(L("Advanced"))); - optgroup->append_single_option_line("gap_fill"); + line = { _(L("Gap Fill")), "" }; + line.append_option(optgroup->get_option("gap_fill")); + line.append_option(optgroup->get_option("gap_fill_min_area")); + optgroup->append_line(line); line = { _(L("Seam")), "" }; line.append_option(optgroup->get_option("seam_position")); line.append_option(optgroup->get_option("seam_travel"));