From 9e77e6e8b61db103b1c52cfb192ca6202bc2ff4b Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Wed, 4 Jul 2012 10:02:45 +0200 Subject: [PATCH 1/4] Removed comment about the shortest path search for honeycomb not being useful: it is. #512 --- lib/Slic3r/Fill/Honeycomb.pm | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Slic3r/Fill/Honeycomb.pm b/lib/Slic3r/Fill/Honeycomb.pm index 50b692031f..81a86b0d27 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 ], ); From 3714fbe0f9eb8cefe989ee21736d579cfac8ef4c Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Wed, 4 Jul 2012 10:35:03 +0200 Subject: [PATCH 2/4] Fixed regression causing random extrudates outside the object perimeter --- lib/Slic3r/Layer.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Slic3r/Layer.pm b/lib/Slic3r/Layer.pm index 686df1a982..e0a7b2962c 100644 --- a/lib/Slic3r/Layer.pm +++ b/lib/Slic3r/Layer.pm @@ -136,10 +136,10 @@ sub make_surfaces { my $self = shift; my ($loops) = @_; - my $safety_offset = scale 0.1; { + my $safety_offset = scale 0.1; # merge everything - my $expolygons = union_ex(safety_offset($loops, $safety_offset)); + my $expolygons = [ map $_->offset_ex(-$safety_offset), @{union_ex(safety_offset($loops, $safety_offset))} ]; Slic3r::debugf " %d surface(s) having %d holes detected from %d polylines\n", scalar(@$expolygons), scalar(map $_->holes, @$expolygons), scalar(@$loops); @@ -158,7 +158,7 @@ sub make_surfaces { push @{$self->slices}, map Slic3r::Surface->new (expolygon => $_, surface_type => S_TYPE_INTERNAL), map $_->offset_ex(+$distance), - $surface->expolygon->offset_ex(-2*$distance - $safety_offset); + $surface->expolygon->offset_ex(-2*$distance); } # now detect thin walls by re-outgrowing offsetted surfaces and subtracting From 96574e601f5272ff528303f5e1ff7b920fac757b Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Thu, 5 Jul 2012 10:32:29 +0200 Subject: [PATCH 3/4] Infill flow wasn't adjusted for non-solid surfaces --- lib/Slic3r/Fill.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Slic3r/Fill.pm b/lib/Slic3r/Fill.pm index 80edf518f6..b624e8aa1a 100644 --- a/lib/Slic3r/Fill.pm +++ b/lib/Slic3r/Fill.pm @@ -170,7 +170,7 @@ sub make_fill { ? ($surface->surface_type == S_TYPE_TOP ? EXTR_ROLE_TOPSOLIDFILL : EXTR_ROLE_SOLIDFILL) : EXTR_ROLE_FILL), depth_layers => $surface->depth_layers, - flow_spacing => $params->{flow_spacing}, + flow_spacing => $params->{flow_spacing} || $flow_spacing, ), @paths, ], ); From 3c0057380582700ddf975079b682932ae2db6b03 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 6 Jul 2012 19:57:58 +0200 Subject: [PATCH 4/4] Reset E and compensate retraction after changing extruder --- lib/Slic3r/GCode.pm | 18 +++++++++++++----- lib/Slic3r/Print.pm | 3 +-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/Slic3r/GCode.pm b/lib/Slic3r/GCode.pm index f3afcd9859..58d0eed519 100644 --- a/lib/Slic3r/GCode.pm +++ b/lib/Slic3r/GCode.pm @@ -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 { diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index a1904cd10d..6e9cc558a0 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";