From 248ed8589acb539656696d87b39e5a0365cf2aab Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 28 Nov 2011 22:52:35 +0100 Subject: [PATCH] Bugfix: error when concentric infill. #73 --- lib/Slic3r/ExtrusionPath.pm | 11 +++++++++-- lib/Slic3r/Fill/Concentric.pm | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/Slic3r/ExtrusionPath.pm b/lib/Slic3r/ExtrusionPath.pm index e819dcf58..68de0d835 100644 --- a/lib/Slic3r/ExtrusionPath.pm +++ b/lib/Slic3r/ExtrusionPath.pm @@ -19,6 +19,7 @@ sub clip_end { while ($distance > 0) { my $last_point = pop @{$self->points}; + last if !@{$self->points}; my $last_segment_length = $last_point->distance_to($self->points->[-1]); if ($last_segment_length <= $distance) { @@ -63,7 +64,11 @@ sub split_at_acute_angles { # if the angle between $p[-2], $p[-1], $p3 is too acute # then consider $p3 only as a starting point of a new # path and stop the current one as it is - push @paths, (ref $self)->cast([@p]); + push @paths, (ref $self)->cast( + [@p], + role => $self->role, + depth_layers => $self->depth_layers, + ); @p = ($p3); push @p, grep $_, shift @points or last; } else { @@ -169,6 +174,7 @@ sub detect_arcs { # points 0..$i form a linear path push @paths, (ref $self)->new( points => [ @points[0..$i] ], + role => $self->role, depth_layers => $self->depth_layers, ) if $i > 0; @@ -187,7 +193,8 @@ sub detect_arcs { # remaining points form a linear path push @paths, (ref $self)->new( points => [@points], - depth_layers => $self->depth_layers + role => $self->role, + depth_layers => $self->depth_layers, ) if @points > 1; return @paths; diff --git a/lib/Slic3r/Fill/Concentric.pm b/lib/Slic3r/Fill/Concentric.pm index bcc0cba2e..2c59e17d4 100644 --- a/lib/Slic3r/Fill/Concentric.pm +++ b/lib/Slic3r/Fill/Concentric.pm @@ -41,7 +41,7 @@ sub fill_surface { # split the loop at the starting point and make a path my $path = $loop->split_at($cur_pos); - + # clip the path to avoid the extruder to get exactly on the first point of the loop $path->clip_end($Slic3r::flow_width / $Slic3r::resolution);