From ad8c9d4ea11eb338aa34509dbf8f9dba3d52a1c4 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 10 Feb 2012 14:42:54 +0100 Subject: [PATCH] Bugfix: model with rounded walls had small useless infill regions. #177 --- MANIFEST | 1 + lib/Slic3r/Print.pm | 4 +++- lib/Slic3r/Surface.pm | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/MANIFEST b/MANIFEST index 66051ba3c..11ae47182 100644 --- a/MANIFEST +++ b/MANIFEST @@ -49,3 +49,4 @@ t/geometry.t t/polyclip.t t/stl.t utils/post-processing/z-every-line.pl +utils/split_stl.pl diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index f33ff2b74..f9f0413c9 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -263,7 +263,9 @@ sub discover_horizontal_shells { my $layer = $self->layers->[$i]; foreach my $type (qw(top bottom)) { # find surfaces of current type for current layer - my @surfaces = grep $_->surface_type eq $type, @{$layer->fill_surfaces} or next; + # and offset them to take perimeters into account + my @surfaces = map $_->offset($Slic3r::perimeters * scale $Slic3r::flow_width), + grep $_->surface_type eq $type, @{$layer->fill_surfaces} or next; my $surfaces_p = [ map $_->p, @surfaces ]; Slic3r::debugf "Layer %d has %d surfaces of type '%s'\n", $i, scalar(@surfaces), $type; diff --git a/lib/Slic3r/Surface.pm b/lib/Slic3r/Surface.pm index 1b7b37888..95a97d7cc 100644 --- a/lib/Slic3r/Surface.pm +++ b/lib/Slic3r/Surface.pm @@ -37,6 +37,14 @@ sub group { return values %unique_types; } +sub offset { + my $self = shift; + return (ref $self)->new( + expolygon => $self->expolygon->offset_ex(@_), + map { $_ => $self->$_ } qw(surface_type depth_layers bridge_angle), + ); +} + sub add_hole { my $self = shift; my ($hole) = @_;