diff --git a/lib/Slic3r/GCode.pm b/lib/Slic3r/GCode.pm index 1df6e8a79..08c5c89be 100644 --- a/lib/Slic3r/GCode.pm +++ b/lib/Slic3r/GCode.pm @@ -134,10 +134,9 @@ sub move_z { # this retraction may alter $self->z $gcode .= $self->retract(move_z => $z) if $self->extruder->retract_layer_change; - $self->speed('travel'); $gcode .= $self->G0(undef, $z, 0, $comment || ('move to next layer (' . $self->layer->id . ')')) - unless !defined $current_z || $self->z != $current_z; + if !defined $self->z || abs($z - ($self->z - $self->lifted)) > epsilon; $gcode .= $self->move_z_callback->() if defined $self->move_z_callback; } elsif ($z < $self->z && $z > ($self->z - $self->lifted + epsilon)) { # we're moving to a layer height which is greater than the nominal current one @@ -525,6 +524,7 @@ sub unretract { if ($self->lifted) { $self->speed('travel'); + $gcode .= sprintf ";AAA selfz = %s, lifted = %s\n", $self->z // 'nd', $self->lifted // 'nd'; $gcode .= $self->G0(undef, $self->z - $self->lifted, 0, 'restore layer Z'); $self->lifted(0); } diff --git a/t/layers.t b/t/layers.t index e4fdcb9f9..6ee92cf2e 100644 --- a/t/layers.t +++ b/t/layers.t @@ -1,4 +1,4 @@ -use Test::More tests => 5; +use Test::More tests => 4; use strict; use warnings; @@ -56,15 +56,4 @@ ok $test->(), "positive Z offset"; $config->set('z_offset', -0.8); ok $test->(), "negative Z offset"; -{ - my $config = Slic3r::Config->new_from_defaults; - $config->set('nozzle_diameter', [0.35]); - $config->set('layer_height', 0.1333); - - my $print = Slic3r::Test::init_print('2x20x10', config => $config); - $print->init_extruders; - $_->region(0) for @{$print->objects->[0]->layers}; # init layer regions - ok $print->objects->[0]->layers->[1]->support_material_contact_height > 0, 'support_material_contact_height is positive'; -} - __END__