diff --git a/lib/Slic3r/Fill/Honeycomb.pm b/lib/Slic3r/Fill/Honeycomb.pm index 50b692031..81a86b0d2 100644 --- a/lib/Slic3r/Fill/Honeycomb.pm +++ b/lib/Slic3r/Fill/Honeycomb.pm @@ -87,7 +87,6 @@ sub fill_surface { $self->cache->{$cache_id}, [ map @$_, $expolygon->offset_ex($overlap_distance) ], )}; - # this shortest path search is probably unneeded or not effective my $collection = Slic3r::ExtrusionPath::Collection->new( paths => [ map Slic3r::ExtrusionPath->new(polyline => $_, role => -1), @paths ], ); diff --git a/lib/Slic3r/GCode.pm b/lib/Slic3r/GCode.pm index a7e0834d4..a6b94355f 100644 --- a/lib/Slic3r/GCode.pm +++ b/lib/Slic3r/GCode.pm @@ -242,10 +242,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; } @@ -267,6 +264,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) = @_; @@ -377,7 +382,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 { diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index a1904cd10..6e9cc558a 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -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";