Fix a situation where extra perimeters prevented top shell to be fully propagated. #1387

This commit is contained in:
Alessandro Ranellucci 2013-08-13 09:45:33 +02:00
parent 36596bf569
commit 2b36778dc1
3 changed files with 11 additions and 4 deletions

View File

@ -79,6 +79,7 @@ use constant OVERLAP_FACTOR => 1;
use constant SMALL_PERIMETER_LENGTH => (6.5 / SCALING_FACTOR) * 2 * PI; use constant SMALL_PERIMETER_LENGTH => (6.5 / SCALING_FACTOR) * 2 * PI;
use constant LOOP_CLIPPING_LENGTH_OVER_SPACING => 0.15; use constant LOOP_CLIPPING_LENGTH_OVER_SPACING => 0.15;
use constant INFILL_OVERLAP_OVER_SPACING => 0.45; use constant INFILL_OVERLAP_OVER_SPACING => 0.45;
use constant EXTERNAL_INFILL_MARGIN => 3;
our $Config; our $Config;

View File

@ -416,7 +416,7 @@ sub prepare_fill_surfaces {
sub process_external_surfaces { sub process_external_surfaces {
my $self = shift; my $self = shift;
my $margin = scale 3; # TODO: ensure this is greater than the total thickness of the perimeters my $margin = scale &Slic3r::EXTERNAL_INFILL_MARGIN;
my @bottom = (); my @bottom = ();
foreach my $surface (grep $_->surface_type == S_TYPE_BOTTOM, @{$self->fill_surfaces}) { foreach my $surface (grep $_->surface_type == S_TYPE_BOTTOM, @{$self->fill_surfaces}) {

View File

@ -572,6 +572,8 @@ sub discover_horizontal_shells {
Slic3r::debugf "==> DISCOVERING HORIZONTAL SHELLS\n"; Slic3r::debugf "==> DISCOVERING HORIZONTAL SHELLS\n";
my $margin = scale &Slic3r::EXTERNAL_INFILL_MARGIN;
for my $region_id (0 .. ($self->print->regions_count-1)) { for my $region_id (0 .. ($self->print->regions_count-1)) {
for (my $i = 0; $i < $self->layer_count; $i++) { for (my $i = 0; $i < $self->layer_count; $i++) {
my $layerm = $self->layers->[$i]->regions->[$region_id]; my $layerm = $self->layers->[$i]->regions->[$region_id];
@ -584,9 +586,13 @@ sub discover_horizontal_shells {
EXTERNAL: foreach my $type (S_TYPE_TOP, S_TYPE_BOTTOM) { EXTERNAL: foreach my $type (S_TYPE_TOP, S_TYPE_BOTTOM) {
# find slices of current type for current layer # find slices of current type for current layer
# get both slices and fill_surfaces before the former contains the perimeters area # use slices instead of fill_surfaces because they also include the perimeter area
# and the latter contains the enlarged external surfaces # which needs to be propagated in shells; we need to grow slices like we did for
my $solid = [ map $_->expolygon, grep $_->surface_type == $type, @{$layerm->slices}, @{$layerm->fill_surfaces} ]; # fill_surfaces though. Using both ungrown slices and grown fill_surfaces will
# not work in some situations, as there won't be any grown region in the perimeter
# area (this was seen in a model where the top layer had one extra perimeter, thus
# its fill_surfaces was thinner than the lower layer's infill)
my $solid = [ map $_->expolygon->offset_ex($margin), grep $_->surface_type == $type, @{$layerm->slices} ];
next if !@$solid; next if !@$solid;
Slic3r::debugf "Layer %d has %s surfaces\n", $i, ($type == S_TYPE_TOP ? 'top' : 'bottom'); Slic3r::debugf "Layer %d has %s surfaces\n", $i, ($type == S_TYPE_TOP ? 'top' : 'bottom');