Fix regression causing skirt to be printed at Z = 0 after a recent commit

This commit is contained in:
Alessandro Ranellucci 2012-10-28 19:24:24 +01:00
parent c57e94c065
commit 8da4151c6d
2 changed files with 6 additions and 3 deletions

View file

@ -9,7 +9,7 @@ has 'multiple_extruders' => (is => 'ro', default => sub {0} );
has 'layer' => (is => 'rw'); # this is not very correct, we should replace it with explicit layer_id and avoid using $self->layer->flow at all here because it's too general
has 'shift_x' => (is => 'rw', default => sub {0} );
has 'shift_y' => (is => 'rw', default => sub {0} );
has 'z' => (is => 'rw', default => sub {0} );
has 'z' => (is => 'rw');
has 'speed' => (is => 'rw');
has 'extruder' => (is => 'rw');
@ -76,7 +76,7 @@ sub move_z {
my $gcode = "";
$gcode .= $self->retract(move_z => $z);
$gcode .= $self->G0(undef, $z, 0, $comment || 'move to next layer (' . $self->layer->id . ')')
if $self->z != $z && !$self->lifted;
if (!defined $self->z || $self->z != $z) && !$self->lifted;
return $gcode;
}
@ -319,7 +319,7 @@ sub _G0_G1 {
($point->y * &Slic3r::SCALING_FACTOR) + $self->shift_y - $self->extruder->extruder_offset->[Y]; #**
$self->last_pos($point);
}
if (defined $z && $z != $self->z) {
if (defined $z && (!defined $self->z || $z != $self->z)) {
$self->z($z);
$gcode .= sprintf " Z%.${dec}f", $z;
}

View file

@ -709,6 +709,8 @@ sub write_gcode {
if ($skirt_done < $Slic3r::Config->skirt_height) {
$gcodegen->shift_x($shift[X]);
$gcodegen->shift_y($shift[Y]);
$gcode .= $gcodegen->set_extruder($self->extruders->[0]); # move_z requires extruder
$gcode .= $gcodegen->move_z($gcodegen->layer->print_z);
$gcode .= $gcodegen->set_acceleration($Slic3r::Config->perimeter_acceleration);
# skip skirt if we have a large brim
if ($layer_id < $Slic3r::Config->skirt_height) {
@ -723,6 +725,7 @@ sub write_gcode {
# extrude brim
if ($layer_id == 0 && !$brim_done) {
$gcode .= $gcodegen->move_z($gcodegen->layer->print_z);
$gcode .= $gcodegen->set_extruder($self->extruders->[$Slic3r::Config->support_material_extruder-1]);
$gcodegen->shift_x($shift[X]);
$gcodegen->shift_y($shift[Y]);