Bugfix: only_retract_when_crossing_perimeters might cause some missed retractions when printing multiple copies of the same object. #786

This commit is contained in:
Alessandro Ranellucci 2012-11-16 12:39:55 +01:00
parent a1a12ffe8e
commit 1c2bc94d5a
2 changed files with 13 additions and 1 deletions

View File

@ -135,8 +135,12 @@ sub extrude_path {
# retract if distance from previous position is greater or equal to the one # retract if distance from previous position is greater or equal to the one
# specified by the user # specified by the user
{ {
my $travel = Slic3r::Line->new($self->last_pos, $path->points->[0]); my $travel = Slic3r::Line->new($self->last_pos->clone, $path->points->[0]->clone);
if ($travel->length >= scale $self->extruder->retract_before_travel) { if ($travel->length >= scale $self->extruder->retract_before_travel) {
# move travel back to original layer coordinates.
# note that we're only considering the current object's islands, while we should
# build a more complete configuration space
$travel->translate(-$self->shift_x, -$self->shift_y);
if (!$Slic3r::Config->only_retract_when_crossing_perimeters || $path->role != EXTR_ROLE_FILL || !first { $_->encloses_line($travel, scaled_epsilon) } @{$self->layer->slices}) { if (!$Slic3r::Config->only_retract_when_crossing_perimeters || $path->role != EXTR_ROLE_FILL || !first { $_->encloses_line($travel, scaled_epsilon) } @{$self->layer->slices}) {
if ($self->last_path && $self->last_path->role == &EXTR_ROLE_EXTERNAL_PERIMETER) { if ($self->last_path && $self->last_path->role == &EXTR_ROLE_EXTERNAL_PERIMETER) {
my @lines = $self->last_path->lines; my @lines = $self->last_path->lines;

View File

@ -67,4 +67,12 @@ sub reverse {
@$self = reverse @$self; @$self = reverse @$self;
} }
sub translate {
my $self = shift;
my ($x, $y) = @_;
@$self = Slic3r::Geometry::move_points([$x, $y], @$self);
bless $_, 'Slic3r::Point' for @$self;
return $self;
}
1; 1;