From fa41e15c684cfe0e3217e483b602afd92e06377b Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sat, 9 Mar 2013 17:07:11 +0100 Subject: [PATCH] Fixed regression causing thin walls to be processed twice, thus producing overlapping straight paths and zigzag. #1035 --- lib/Slic3r/Layer/Region.pm | 11 +++++++++++ lib/Slic3r/Polygon.pm | 5 +++++ lib/Slic3r/Polyline.pm | 1 - 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/Layer/Region.pm b/lib/Slic3r/Layer/Region.pm index 9739128e2..8317cdd84 100644 --- a/lib/Slic3r/Layer/Region.pm +++ b/lib/Slic3r/Layer/Region.pm @@ -277,6 +277,17 @@ sub make_perimeters { if ($Slic3r::Config->gap_fill_speed > 0 && $Slic3r::Config->fill_density > 0) { my $filler = Slic3r::Fill::Rectilinear->new(layer_id => $self->layer->id); + # we should probably use this code to handle thin walls and remove that logic from + # make_surfaces(), but we need to enable dynamic extrusion width before as we can't + # use zigzag for thin walls. + # in the mean time we subtract thin walls from the detected gaps so that we don't + # reprocess them, causing overlapping thin walls and zigzag. + @gaps = @{diff_ex( + [ map @$_, @gaps ], + [ map $_->grow($self->perimeter_flow->scaled_width), @{$self->{thin_walls}} ], + 1, + )}; + my $w = $self->perimeter_flow->width; my @widths = (1.5 * $w, $w, 0.5 * $w); # worth trying 0.2 too? foreach my $width (@widths) { diff --git a/lib/Slic3r/Polygon.pm b/lib/Slic3r/Polygon.pm index 4af44acc9..f5b275510 100644 --- a/lib/Slic3r/Polygon.pm +++ b/lib/Slic3r/Polygon.pm @@ -92,6 +92,11 @@ sub offset { return map Slic3r::Polygon->new($_), Slic3r::Geometry::Clipper::offset([$self], @_); } +sub grow { + my $self = shift; + return $self->split_at_first_point->grow(@_); +} + # this method subdivides the polygon segments to that no one of them # is longer than the length provided sub subdivide { diff --git a/lib/Slic3r/Polyline.pm b/lib/Slic3r/Polyline.pm index 078d3a1e9..631030604 100644 --- a/lib/Slic3r/Polyline.pm +++ b/lib/Slic3r/Polyline.pm @@ -84,7 +84,6 @@ sub length { return $length; } -# this only applies to polylines sub grow { my $self = shift; return Slic3r::Polygon->new(@$self, CORE::reverse @$self[1..($#$self-1)])->offset(@_);