From 92518d28fc95d7eec73c141a0b8b7fa000896096 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 24 Aug 2012 19:38:36 +0200 Subject: [PATCH] New option to configure the threshold for enforcing solid infill. #224 --- README.markdown | 3 +++ lib/Slic3r/Config.pm | 8 ++++++++ lib/Slic3r/GUI/Tab.pm | 2 +- lib/Slic3r/Layer.pm | 2 +- slic3r.pl | 3 +++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index fc5ce7f86..a335f0cb9 100644 --- a/README.markdown +++ b/README.markdown @@ -170,6 +170,9 @@ The author of the Silk icon set is Mark James. --layer-gcode Load layer-change G-code from the supplied file (default: nothing). --extra-perimeters Add more perimeters when needed (default: yes) --randomize-start Randomize starting point across layers (default: yes) + --solid-infill-below-area + Force solid infill when a region has a smaller area than this threshold + (mm^2, default: 70) Support material options: --support-material Generate support material for overhangs diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index 7af58122c..36aaa5ae7 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -449,6 +449,14 @@ our $Options = { max => 359, default => 45, }, + 'solid_infill_below_area' => { + label => 'Solid infill threshold area', + tooltip => 'Force solid infill for regions having a smaller area than the specified threshold.', + sidetext => 'mm²', + cli => 'solid-infill-below-area=f', + type => 'f', + default => 70, + }, 'extra_perimeters' => { label => 'Generate extra perimeters when needed', cli => 'extra-perimeters!', diff --git a/lib/Slic3r/GUI/Tab.pm b/lib/Slic3r/GUI/Tab.pm index 111800e0a..cd68593ae 100644 --- a/lib/Slic3r/GUI/Tab.pm +++ b/lib/Slic3r/GUI/Tab.pm @@ -401,7 +401,7 @@ sub build { }, { title => 'Advanced', - options => [qw(infill_every_layers fill_angle)], + options => [qw(infill_every_layers fill_angle solid_infill_below_area)], }, ]); diff --git a/lib/Slic3r/Layer.pm b/lib/Slic3r/Layer.pm index 2bd51d873..9fa69482f 100644 --- a/lib/Slic3r/Layer.pm +++ b/lib/Slic3r/Layer.pm @@ -365,7 +365,7 @@ sub prepare_fill_surfaces { # turn too small internal regions into solid regions { - my $min_area = ((7 * $self->infill_flow->spacing / &Slic3r::SCALING_FACTOR)**2) * PI; + my $min_area = scale scale $Slic3r::Config->solid_infill_below_area; # scaling an area requires two calls! my @small = grep $_->surface_type == S_TYPE_INTERNAL && $_->expolygon->contour->area <= $min_area, @surfaces; $_->surface_type(S_TYPE_INTERNALSOLID) for @small; Slic3r::debugf "identified %d small surfaces at layer %d\n", scalar(@small), $self->id if @small > 0; diff --git a/slic3r.pl b/slic3r.pl index a4f5ca4d1..0f9baa58c 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -213,6 +213,9 @@ $j --layer-gcode Load layer-change G-code from the supplied file (default: nothing). --extra-perimeters Add more perimeters when needed (default: yes) --randomize-start Randomize starting point across layers (default: yes) + --solid-infill-below-area + Force solid infill when a region has a smaller area than this threshold + (mm^2, default: $config->{solid_infill_below_area}) Support material options: --support-material Generate support material for overhangs