Reset E and compensate retraction after changing extruder
This commit is contained in:
parent
96574e601f
commit
3c00573805
@ -247,10 +247,7 @@ sub retract {
|
||||
|
||||
# reset extrusion distance during retracts
|
||||
# this makes sure we leave sufficient precision in the firmware
|
||||
if (!$Slic3r::use_relative_e_distances && $Slic3r::gcode_flavor !~ /^(?:mach3|makerbot)$/) {
|
||||
$gcode .= "G92 " . $Slic3r::extrusion_axis . "0\n" if $Slic3r::extrusion_axis;
|
||||
$self->extrusion_distance(0);
|
||||
}
|
||||
$gcode .= $self->reset_e if $Slic3r::gcode_flavor !~ /^(?:mach3|makerbot)$/;
|
||||
|
||||
return $gcode;
|
||||
}
|
||||
@ -272,6 +269,14 @@ sub unretract {
|
||||
return $gcode;
|
||||
}
|
||||
|
||||
sub reset_e {
|
||||
my $self = shift;
|
||||
|
||||
$self->extrusion_distance(0);
|
||||
return "G92 %s0%s\n", $Slic3r::extrusion_axis, ($Slic3r::gcode_comments ? ' ; reset extrusion distance' : '')
|
||||
if $Slic3r::extrusion_axis && !$Slic3r::use_relative_e_distances;
|
||||
}
|
||||
|
||||
sub set_acceleration {
|
||||
my $self = shift;
|
||||
my ($acceleration) = @_;
|
||||
@ -382,7 +387,10 @@ sub set_tool {
|
||||
return "" if $self->extruder_idx == $tool;
|
||||
|
||||
$self->extruder_idx($tool);
|
||||
return $self->retract . sprintf "T%d%s\n", $tool, ($Slic3r::gcode_comments ? ' ; change tool' : '');
|
||||
return $self->retract
|
||||
. sprintf "T%d%s\n", $tool, ($Slic3r::gcode_comments ? ' ; change tool' : '')
|
||||
. $self->reset_e
|
||||
. $self->unretract;
|
||||
}
|
||||
|
||||
sub set_fan {
|
||||
|
@ -530,8 +530,7 @@ sub write_gcode {
|
||||
print $fh "G90 ; use absolute coordinates\n";
|
||||
print $fh "G21 ; set units to millimeters\n";
|
||||
if ($Slic3r::gcode_flavor =~ /^(?:reprap|teacup)$/) {
|
||||
printf $fh "G92 %s0 ; reset extrusion distance\n", $Slic3r::extrusion_axis
|
||||
if $Slic3r::extrusion_axis && !$Slic3r::use_relative_e_distances;
|
||||
printf $fh $gcodegen->reset_e;
|
||||
if ($Slic3r::gcode_flavor =~ /^(?:reprap|makerbot)$/) {
|
||||
if ($Slic3r::use_relative_e_distances) {
|
||||
print $fh "M83 ; use relative distances for extrusion\n";
|
||||
|
Loading…
Reference in New Issue
Block a user