Use G92 to apply Z offset. #486
This commit is contained in:
parent
709cbc1c15
commit
887634e1e2
2 changed files with 9 additions and 1 deletions
|
@ -71,7 +71,7 @@ sub move_z {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($z, $comment) = @_;
|
my ($z, $comment) = @_;
|
||||||
|
|
||||||
$z = $Slic3r::Config->z_offset + $z * &Slic3r::SCALING_FACTOR;
|
$z = $z * &Slic3r::SCALING_FACTOR;
|
||||||
|
|
||||||
my $gcode = "";
|
my $gcode = "";
|
||||||
$gcode .= $self->retract(move_z => $z);
|
$gcode .= $self->retract(move_z => $z);
|
||||||
|
|
|
@ -705,6 +705,14 @@ sub write_gcode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# apply Z offset
|
||||||
|
if ($Slic3r::Config->z_offset > 0) {
|
||||||
|
printf $fh "G1 Z%s ; set Z offset\n", $Slic3r::Config->z_offset;
|
||||||
|
print $fh "G92 Z0 ; set Z offset\n";
|
||||||
|
} elsif ($Slic3r::Config->z_offset < 0) {
|
||||||
|
printf $fh "G92 Z%s ; set Z offset\n", 1*(-$Slic3r::Config->z_offset);
|
||||||
|
}
|
||||||
|
|
||||||
# calculate X,Y shift to center print around specified origin
|
# calculate X,Y shift to center print around specified origin
|
||||||
my @print_bb = $self->bounding_box;
|
my @print_bb = $self->bounding_box;
|
||||||
my @shift = (
|
my @shift = (
|
||||||
|
|
Loading…
Reference in a new issue