#90 : gap fiull min surface setting

This commit is contained in:
supermerill 2019-09-30 19:33:14 +02:00
parent 2d34b7c5fe
commit 8d04e48ff0
5 changed files with 29 additions and 11 deletions

View File

@ -612,7 +612,7 @@ void PerimeterGenerator::process()
double min = 0.2 * perimeter_width * (1 - INSET_OVERLAP_TOLERANCE); 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). //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())); 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( ExPolygons gaps_ex = diff_ex(
offset2_ex(gaps, double(-min / 2), double(+min / 2)), offset2_ex(gaps, double(-min / 2), double(+min / 2)),
offset2_ex(gaps, double(-max / 2), double(+max / 2)), offset2_ex(gaps, double(-max / 2), double(+max / 2)),
@ -621,8 +621,8 @@ void PerimeterGenerator::process()
for (const ExPolygon &ex : gaps_ex) { for (const ExPolygon &ex : gaps_ex) {
//remove too small gaps that are too hard to fill. //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. //ie one that are smaller than an extrusion with width of min and a length of max.
if (ex.area() > min*max) { 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), coord_t(min), coord_t(this->layer_height) }.build(polylines); MedialAxis{ ex, coord_t(max*1.1), coord_t(min), coord_t(this->layer_height) }.build(polylines);
} }
} }
if (!polylines.empty()) { if (!polylines.empty()) {

View File

@ -1142,13 +1142,22 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionInts { 200 }); def->set_default_value(new ConfigOptionInts { 200 });
def = this->add("gap_fill", coBool); 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->category = L("Advanced");
def->tooltip = L("Enable gap fill algorithm. It will extrude small lines between perimeters " 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."); "when there is not enough space for another perimeter or an infill.");
def->mode = comExpert; def->mode = comExpert;
def->set_default_value(new ConfigOptionBool(true)); 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 = this->add("gap_fill_speed", coFloat);
def->label = L("Gap fill"); def->label = L("Gap fill");
def->full_label = L("Gap fill speed"); def->full_label = L("Gap fill speed");
@ -1585,7 +1594,7 @@ void PrintConfigDef::init_fff_params()
def->min = 0; def->min = 0;
def->max = 100; def->max = 100;
def->mode = comSimple; 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 = this->add("min_layer_height", coFloats);
def->label = L("Min"); def->label = L("Min");

View File

@ -586,14 +586,13 @@ public:
ConfigOptionFloatOrPercent external_perimeter_extrusion_width; ConfigOptionFloatOrPercent external_perimeter_extrusion_width;
ConfigOptionFloatOrPercent external_perimeter_speed; ConfigOptionFloatOrPercent external_perimeter_speed;
ConfigOptionBool external_perimeters_first; ConfigOptionBool external_perimeters_first;
ConfigOptionBool perimeter_loop;
ConfigOptionEnum<SeamPosition> perimeter_loop_seam;
ConfigOptionBool extra_perimeters; ConfigOptionBool extra_perimeters;
ConfigOptionBool only_one_perimeter_top; ConfigOptionBool only_one_perimeter_top;
ConfigOptionFloat fill_angle; ConfigOptionFloat fill_angle;
ConfigOptionPercent fill_density; ConfigOptionPercent fill_density;
ConfigOptionEnum<InfillPattern> fill_pattern; ConfigOptionEnum<InfillPattern> fill_pattern;
ConfigOptionBool gap_fill; ConfigOptionBool gap_fill;
ConfigOptionFloatOrPercent gap_fill_min_area;
ConfigOptionFloat gap_fill_speed; ConfigOptionFloat gap_fill_speed;
ConfigOptionInt infill_extruder; ConfigOptionInt infill_extruder;
ConfigOptionFloatOrPercent infill_extrusion_width; ConfigOptionFloatOrPercent infill_extrusion_width;
@ -609,6 +608,8 @@ public:
ConfigOptionEnum<NoPerimeterUnsupportedAlgo> no_perimeter_unsupported_algo; ConfigOptionEnum<NoPerimeterUnsupportedAlgo> no_perimeter_unsupported_algo;
ConfigOptionInt perimeter_extruder; ConfigOptionInt perimeter_extruder;
ConfigOptionFloatOrPercent perimeter_extrusion_width; ConfigOptionFloatOrPercent perimeter_extrusion_width;
ConfigOptionBool perimeter_loop;
ConfigOptionEnum<SeamPosition> perimeter_loop_seam;
ConfigOptionFloat perimeter_speed; ConfigOptionFloat perimeter_speed;
// Total number of perimeters. // Total number of perimeters.
ConfigOptionInt perimeters; ConfigOptionInt perimeters;
@ -649,14 +650,13 @@ protected:
OPT_PTR(external_perimeter_extrusion_width); OPT_PTR(external_perimeter_extrusion_width);
OPT_PTR(external_perimeter_speed); OPT_PTR(external_perimeter_speed);
OPT_PTR(external_perimeters_first); OPT_PTR(external_perimeters_first);
OPT_PTR(perimeter_loop);
OPT_PTR(perimeter_loop_seam);
OPT_PTR(extra_perimeters); OPT_PTR(extra_perimeters);
OPT_PTR(only_one_perimeter_top); OPT_PTR(only_one_perimeter_top);
OPT_PTR(fill_angle); OPT_PTR(fill_angle);
OPT_PTR(fill_density); OPT_PTR(fill_density);
OPT_PTR(fill_pattern); OPT_PTR(fill_pattern);
OPT_PTR(gap_fill); OPT_PTR(gap_fill);
OPT_PTR(gap_fill_min_area);
OPT_PTR(gap_fill_speed); OPT_PTR(gap_fill_speed);
OPT_PTR(infill_extruder); OPT_PTR(infill_extruder);
OPT_PTR(infill_extrusion_width); OPT_PTR(infill_extrusion_width);
@ -671,6 +671,8 @@ protected:
OPT_PTR(no_perimeter_unsupported_algo); OPT_PTR(no_perimeter_unsupported_algo);
OPT_PTR(perimeter_extruder); OPT_PTR(perimeter_extruder);
OPT_PTR(perimeter_extrusion_width); OPT_PTR(perimeter_extrusion_width);
OPT_PTR(perimeter_loop);
OPT_PTR(perimeter_loop_seam);
OPT_PTR(perimeter_speed); OPT_PTR(perimeter_speed);
OPT_PTR(perimeters); OPT_PTR(perimeters);
OPT_PTR(small_perimeter_speed); OPT_PTR(small_perimeter_speed);

View File

@ -393,7 +393,11 @@ const std::vector<std::string>& Preset::print_options()
#endif /* HAS_PRESSURE_EQUALIZER */ #endif /* HAS_PRESSURE_EQUALIZER */
"perimeter_speed", "small_perimeter_speed", "external_perimeter_speed", "infill_speed", "solid_infill_speed", "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", "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", "bridge_acceleration", "first_layer_acceleration", "default_acceleration", "skirts", "skirt_distance", "skirt_height",
"min_skirt_length", "brim_width", "brim_ears", "brim_ears_max_angle", "min_skirt_length", "brim_width", "brim_ears", "brim_ears_max_angle",
"support_material", "support_material_auto", "support_material_threshold", "support_material_enforce_layers", "support_material", "support_material_auto", "support_material_threshold", "support_material_enforce_layers",

View File

@ -1064,7 +1064,10 @@ void TabPrint::build()
optgroup->append_single_option_line("no_perimeter_unsupported_algo"); optgroup->append_single_option_line("no_perimeter_unsupported_algo");
optgroup = page->new_optgroup(_(L("Advanced"))); 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 = { _(L("Seam")), "" };
line.append_option(optgroup->get_option("seam_position")); line.append_option(optgroup->get_option("seam_position"));
line.append_option(optgroup->get_option("seam_travel")); line.append_option(optgroup->get_option("seam_travel"));