Don't perform wiping if we have just changed layer and no extrusions were performed before the first retraction. Includes regression test. #2214

This commit is contained in:
Alessandro Ranellucci 2014-12-24 12:02:42 +01:00
parent 9dd228df01
commit 19548fe301
2 changed files with 17 additions and 2 deletions

View file

@ -96,6 +96,10 @@ sub change_layer {
$gcode .= $self->retract;
}
$gcode .= $self->writer->travel_to_z($z, 'move to next layer (' . $self->layer->id . ')');
# forget last wiping path as wiping after raising Z is pointless
$self->wipe->path(undef);
return $gcode;
}

View file

@ -1,4 +1,4 @@
use Test::More tests => 19;
use Test::More tests => 20;
use strict;
use warnings;
@ -24,14 +24,24 @@ use Slic3r::Test;
{
my $config = Slic3r::Config->new_from_defaults;
$config->set('wipe', [1]);
$config->set('retract_layer_change', [0]);
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
my $have_wipe = 0;
my @retract_speeds = ();
my $extruded_on_this_layer = 0;
my $wiping_on_new_layer = 0;
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
my ($self, $cmd, $args, $info) = @_;
if ($info->{retracting} && $info->{dist_XY} > 0) {
if ($info->{travel} && $info->{dist_Z}) {
# changing layer
$extruded_on_this_layer = 0;
} elsif ($info->{extruding} && $info->{dist_XY}) {
$extruded_on_this_layer = 1;
} elsif ($info->{retracting} && $info->{dist_XY} > 0) {
$have_wipe = 1;
$wiping_on_new_layer = 1 if !$extruded_on_this_layer;
my $move_time = $info->{dist_XY} / ($args->{F} // $self->F);
push @retract_speeds, abs($info->{dist_E}) / $move_time;
}
@ -39,6 +49,7 @@ use Slic3r::Test;
ok $have_wipe, "wipe";
ok !defined (first { abs($_ - $config->retract_speed->[0]*60) < 5 } @retract_speeds), 'wipe moves don\'t retract faster than configured speed';
ok !$wiping_on_new_layer, 'no wiping after layer change';
}
{