Fixed regression preventing lift to work correctly

This commit is contained in:
Alessandro Ranellucci 2012-10-30 10:45:55 +01:00
parent 887634e1e2
commit 4c6fe0b3d4
2 changed files with 11 additions and 13 deletions

View file

@ -53,13 +53,11 @@ my %role_speeds = (
sub change_layer {
my $self = shift;
my ($layer, %params) = @_;
my ($layer) = @_;
$self->layer($layer);
my $gcode = "";
$gcode .= $self->move_z($layer->print_z) unless $params{dont_move_z};
$gcode .= $Slic3r::Config->replace_options($Slic3r::Config->layer_gcode) . "\n"
if $Slic3r::Config->layer_gcode;
@ -74,9 +72,13 @@ sub move_z {
$z = $z * &Slic3r::SCALING_FACTOR;
my $gcode = "";
$gcode .= $self->retract(move_z => $z);
$gcode .= $self->G0(undef, $z, 0, $comment || 'move to next layer (' . $self->layer->id . ')')
if (!defined $self->z || $self->z != $z) && !$self->lifted;
my $current_z = $self->z;
if (!defined $current_z || $current_z != ($z + $self->lifted)) {
$gcode .= $self->retract(move_z => $z);
$gcode .= $self->G0(undef, $z, 0, $comment || 'move to next layer (' . $self->layer->id . ')')
unless ($current_z // -1) != ($self->z // -1);
}
return $gcode;
}
@ -226,7 +228,7 @@ sub retract {
my $retract = [undef, undef, -$length, $comment];
my $lift = ($self->extruder->retract_lift == 0 || defined $params{move_z})
? undef
: [undef, $self->z + $self->extruder->retract_lift, 0, 'lift plate during retraction'];
: [undef, $self->z + $self->extruder->retract_lift, 0, 'lift plate during travel'];
my $gcode = "";
if (($Slic3r::Config->g0 || $Slic3r::Config->gcode_flavor eq 'mach3') && $params{travel_to}) {

View file

@ -737,7 +737,7 @@ sub write_gcode {
}
# set new layer, but don't move Z as support material interfaces may need an intermediate one
$gcode .= $gcodegen->change_layer($self->objects->[$object_copies->[0][0]]->layers->[$layer_id], dont_move_z => 1);
$gcode .= $gcodegen->change_layer($self->objects->[$object_copies->[0][0]]->layers->[$layer_id]);
$gcodegen->elapsed_time(0);
# extrude skirt
@ -772,10 +772,6 @@ sub write_gcode {
my ($obj_idx, $copy) = @$obj_copy;
my $layer = $self->objects->[$obj_idx]->layers->[$layer_id];
# retract explicitely because changing the shift_[xy] properties below
# won't always trigger the automatic retraction
$gcode .= $gcodegen->retract;
$gcodegen->shift_x($shift[X] + unscale $copy->[X]);
$gcodegen->shift_y($shift[Y] + unscale $copy->[Y]);
@ -793,7 +789,7 @@ sub write_gcode {
for $layer->support_fills->shortest_path($gcodegen->last_pos);
}
# set actual Z
# set actual Z - this will force a retraction
$gcode .= $gcodegen->move_z($layer->print_z);
foreach my $region_id (0 .. ($self->regions_count-1)) {