diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2011-10-06 17:24:21 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2011-10-06 19:13:42 +0400 |
commit | 5daaf454b1c60f4ccf7d9f760e798156cdf09d7d (patch) | |
tree | 026411abae1f7d1e45407e8c2188ffa3cbc0b1c5 /lib/Slic3r/Extruder.pm | |
parent | 33d7b8c7cfdc68f05a509b92b4f7c2a15154510a (diff) |
Faster algorithm for rectilinear fill
Diffstat (limited to 'lib/Slic3r/Extruder.pm')
-rw-r--r-- | lib/Slic3r/Extruder.pm | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/Slic3r/Extruder.pm b/lib/Slic3r/Extruder.pm index 3c8cd2bb3..e740bfb51 100644 --- a/lib/Slic3r/Extruder.pm +++ b/lib/Slic3r/Extruder.pm @@ -69,15 +69,11 @@ sub extrude { my $gcode = ""; - # reset extrusion distance counter - if (!$Slic3r::use_relative_e_distances) { - $self->extrusion_distance(0); - $gcode .= "G92 E0 ; reset extrusion distance\n"; - } - - # retract - if (Slic3r::Geometry::distance_between_points($self->last_pos, $path->points->[0]->p) * $Slic3r::resolution - >= $Slic3r::retract_before_travel) { + # retract if distance from previous position is greater or equal to the one + # specified by the user *and* to the maximum distance between infill lines + my $distance_from_last_pos = Slic3r::Geometry::distance_between_points($self->last_pos, $path->points->[0]->p) * $Slic3r::resolution; + if ($distance_from_last_pos >= $Slic3r::retract_before_travel + && $distance_from_last_pos >= $Slic3r::flow_width / $Slic3r::fill_density * sqrt(2)) { $gcode .= $self->retract; } |