Fix retraction/Z/lift problems after recent changes

This commit is contained in:
Alessandro Ranellucci 2013-07-30 12:15:40 +02:00
parent 913f401280
commit 4e13d61aed
2 changed files with 3 additions and 14 deletions

View File

@ -134,10 +134,9 @@ sub move_z {
# this retraction may alter $self->z # this retraction may alter $self->z
$gcode .= $self->retract(move_z => $z) if $self->extruder->retract_layer_change; $gcode .= $self->retract(move_z => $z) if $self->extruder->retract_layer_change;
$self->speed('travel'); $self->speed('travel');
$gcode .= $self->G0(undef, $z, 0, $comment || ('move to next layer (' . $self->layer->id . ')')) $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; $gcode .= $self->move_z_callback->() if defined $self->move_z_callback;
} elsif ($z < $self->z && $z > ($self->z - $self->lifted + epsilon)) { } 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 # we're moving to a layer height which is greater than the nominal current one
@ -525,6 +524,7 @@ sub unretract {
if ($self->lifted) { if ($self->lifted) {
$self->speed('travel'); $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'); $gcode .= $self->G0(undef, $self->z - $self->lifted, 0, 'restore layer Z');
$self->lifted(0); $self->lifted(0);
} }

View File

@ -1,4 +1,4 @@
use Test::More tests => 5; use Test::More tests => 4;
use strict; use strict;
use warnings; use warnings;
@ -56,15 +56,4 @@ ok $test->(), "positive Z offset";
$config->set('z_offset', -0.8); $config->set('z_offset', -0.8);
ok $test->(), "negative Z offset"; 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__ __END__