Limit only_retract_when_crossing_perimeters to travel moves that are completely enclosed in the upper layer's slices so that we avoid visible traces on top layers. #1091

This commit is contained in:
Alessandro Ranellucci 2013-06-03 12:25:32 +02:00
parent 7134df4638
commit 81bae56e92
2 changed files with 8 additions and 2 deletions

View File

@ -283,7 +283,7 @@ sub travel_to {
$travel->translate(-$self->shift_x, -$self->shift_y);
if ($travel->length < scale $self->extruder->retract_before_travel
|| ($self->config->only_retract_when_crossing_perimeters && first { $_->encloses_line($travel, scaled_epsilon) } @{$self->layer->slices})
|| ($self->config->only_retract_when_crossing_perimeters && first { $_->encloses_line($travel, scaled_epsilon) } @{$self->layer->upper_layer_slices})
|| ($role == EXTR_ROLE_SUPPORTMATERIAL && $self->layer->support_islands_enclose_line($travel))
) {
$self->straight_once(0);
@ -326,7 +326,7 @@ sub _plan {
my $need_retract = !$self->config->only_retract_when_crossing_perimeters;
if (!$need_retract) {
$need_retract = 1;
foreach my $slice (@{$self->layer->slices}) {
foreach my $slice (@{$self->layer->upper_layer_slices}) {
# discard the island if at any line is not enclosed in it
next if first { !$slice->encloses_line($_, scaled_epsilon) } @travel;
# okay, this island encloses the full travel path

View File

@ -54,6 +54,12 @@ sub support_material_contact_z {
return $self->print_z - ($self->height - $self->support_material_contact_height) / &Slic3r::SCALING_FACTOR;
}
sub upper_layer_slices {
my $self = shift;
my $upper_layer = $self->object->layers->[ $self->id + 1 ] or return [];
return $upper_layer->slices;
sub region {
my $self = shift;
my ($region_id) = @_;