From c3dde7477614faeff7dbc6995c458634f8ac840e Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 24 Feb 2013 16:40:14 +0100 Subject: [PATCH] Fix brim and extra perimeters after recent changes to ->slices --- lib/Slic3r/Print.pm | 2 +- lib/Slic3r/Print/Object.pm | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 322b8fa48..8676cd219 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -635,7 +635,7 @@ sub make_brim { polygon => Slic3r::Polygon->new($_), role => EXTR_ROLE_SKIRT, flow_spacing => $flow->spacing, - ) for Slic3r::Geometry::Clipper::offset(\@islands, $i * $flow->scaled_spacing, undef, JT_SQUARE); + ) for Slic3r::Geometry::Clipper::offset(\@islands, ($i - 0.5) * $flow->scaled_spacing, undef, JT_SQUARE); # -0.5 because islands are not represented by their centerlines # TODO: we need the offset inwards/offset outwards logic to avoid overlapping extrusions } } diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index 638482fbc..c33660230 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -208,15 +208,15 @@ sub make_perimeters { for my $layer_id (0 .. $self->layer_count-2) { my $layerm = $self->layers->[$layer_id]->regions->[$region_id]; my $upper_layerm = $self->layers->[$layer_id+1]->regions->[$region_id]; - my $perimeter_flow = $layerm->perimeter_flow; + my $perimeter_spacing = $layerm->perimeter_flow->scaled_spacing; - my $overlap = $perimeter_flow->scaled_spacing; # one perimeter + my $overlap = $perimeter_spacing; # one perimeter # compute polygons representing the thickness of the first external perimeter of # the upper layer slices my $upper = diff_ex( - [ map @$_, map $_->expolygon->offset_ex(+ 0.5 * $perimeter_flow->scaled_spacing), @{$upper_layerm->slices} ], - [ map @$_, map $_->expolygon->offset_ex(- $overlap + (0.5 * $perimeter_flow->scaled_spacing)), @{$upper_layerm->slices} ], + [ map @{$_->expolygon}, @{$upper_layerm->slices} ], + [ map @$_, map $_->expolygon->offset_ex(-$overlap), @{$upper_layerm->slices} ], ); next if !@$upper; @@ -225,10 +225,10 @@ sub make_perimeters { my $ignore = []; { my $diff = diff_ex( - [ map @$_, map $_->expolygon->offset_ex(- ($Slic3r::Config->perimeters-0.5) * $perimeter_flow->scaled_spacing), @{$layerm->slices} ], - [ map @{$_->expolygon}, @{$upper_layerm->slices} ], + [ map @$_, map $_->expolygon->offset_ex(- $Slic3r::Config->perimeters * $perimeter_spacing), @{$layerm->slices} ], + [ map @$_, map $_->expolygon->offset_ex(- 0.5*$perimeter_spacing), @{$upper_layerm->slices} ], ); - $ignore = [ map @$_, map $_->offset_ex($perimeter_flow->scaled_spacing), @$diff ]; + $ignore = [ map @$_, map $_->offset_ex($perimeter_spacing), @$diff ]; } foreach my $slice (@{$layerm->slices}) { @@ -238,9 +238,9 @@ sub make_perimeters { # of our slice my $hypothetical_perimeter; { - my $outer = [ map @$_, $slice->expolygon->offset_ex(- ($hypothetical_perimeter_num-1.5) * $perimeter_flow->scaled_spacing - scaled_epsilon) ]; + my $outer = [ map @$_, $slice->expolygon->offset_ex(- ($hypothetical_perimeter_num-1) * $perimeter_spacing - scaled_epsilon) ]; last CYCLE if !@$outer; - my $inner = [ map @$_, $slice->expolygon->offset_ex(- ($hypothetical_perimeter_num-0.5) * $perimeter_flow->scaled_spacing) ]; + my $inner = [ map @$_, $slice->expolygon->offset_ex(- $hypothetical_perimeter_num * $perimeter_spacing) ]; last CYCLE if !@$inner; $hypothetical_perimeter = diff_ex($outer, $inner); }