From b7d8444ac8adc9163eec65b140afa521cd9f2f04 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 6 Aug 2012 20:54:49 +0200 Subject: [PATCH] Take support material into account when generating brim. #490 #501 #567 --- lib/Slic3r/Polyline.pm | 6 ++++++ lib/Slic3r/Print.pm | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/Polyline.pm b/lib/Slic3r/Polyline.pm index 9a493b3e..786957da 100644 --- a/lib/Slic3r/Polyline.pm +++ b/lib/Slic3r/Polyline.pm @@ -85,6 +85,12 @@ sub length { return $length; } +# this only applies to polylines +sub grow { + my $self = shift; + return Slic3r::Polygon->new(@$self, CORE::reverse @$self[1..-2])->offset(@_); +} + sub nearest_point_to { my $self = shift; my ($point) = @_; diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index bd541bf6..ebe2a8ab 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -511,7 +511,12 @@ sub make_brim { my @islands = (); # array of polygons foreach my $obj_idx (0 .. $#{$self->objects}) { - my @object_islands = map $_->contour, @{ $self->objects->[$obj_idx]->layers->[0]->slices }; + my $layer0 = $self->objects->[$obj_idx]->layers->[0]; + my @object_islands = ( + (map $_->contour, @{$layer0->slices}), + (map { $_->isa('Slic3r::Polygon') ? $_ : $_->grow } @{$layer0->thin_walls}), + (map $_->unpack->polyline->grow, map @{$_->support_fills->paths}, grep $_->support_fills, $layer0), + ); foreach my $copy (@{$self->copies->[$obj_idx]}) { push @islands, map $_->clone->translate(@$copy), @object_islands; }