Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2011-11-26 20:01:00 +0400
committerAlessandro Ranellucci <aar@cpan.org>2011-11-26 20:01:00 +0400
commit8e7d00bb34dff164dc06db6d37130c1f86ead5cf (patch)
tree4d07d09b7103c3b655d4892eb412c1107219d7ec
parent72d7e1a5de0ab91a47178521b69e230caac11eb3 (diff)
Avoid unnecessary retractions during infill. #29
-rw-r--r--lib/Slic3r.pm2
-rw-r--r--lib/Slic3r/Extruder.pm15
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm
index 190cf8be0..b75d13501 100644
--- a/lib/Slic3r.pm
+++ b/lib/Slic3r.pm
@@ -58,7 +58,7 @@ our $layer_height = 0.4;
our $first_layer_height_ratio = 1;
our $infill_every_layers = 1;
our $extrusion_width_ratio = undef;
-our $flow_speed_ratio = 1.2;
+our $flow_speed_ratio = 1.1;
our $flow_width;
# print options
diff --git a/lib/Slic3r/Extruder.pm b/lib/Slic3r/Extruder.pm
index f64b0e1a4..cb24fe973 100644
--- a/lib/Slic3r/Extruder.pm
+++ b/lib/Slic3r/Extruder.pm
@@ -10,7 +10,7 @@ has 'flow_ratio' => (is => 'rw', default => sub {1});
has 'extrusion_distance' => (is => 'rw', default => sub {0} );
has 'retracted' => (is => 'rw', default => sub {1} ); # this spits out some plastic at start
has 'lifted' => (is => 'rw', default => sub {0} );
-has 'last_pos' => (is => 'rw', default => sub { [0,0] } );
+has 'last_pos' => (is => 'rw', default => sub { Slic3r::Point->new(0,0) } );
has 'last_f' => (is => 'rw', default => sub {0});
has 'dec' => (is => 'ro', default => sub { 3 } );
@@ -85,10 +85,15 @@ sub extrude {
# 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]) * $Slic3r::resolution;
- if ($distance_from_last_pos >= $Slic3r::retract_before_travel
- && ($Slic3r::fill_density == 0 || $distance_from_last_pos >= $Slic3r::flow_width / $Slic3r::fill_density * sqrt(2))) {
- $gcode .= $self->retract(travel_to => $path->points->[0]);
+ {
+ my $distance_from_last_pos = $self->last_pos->distance_to($path->points->[0]) * $Slic3r::resolution;
+ my $distance_threshold = $Slic3r::retract_before_travel;
+ $distance_threshold = 2 * $Slic3r::flow_width / $Slic3r::fill_density * sqrt(2)
+ if $description =~ /fill/;
+
+ if ($distance_from_last_pos >= $distance_threshold) {
+ $gcode .= $self->retract(travel_to => $path->points->[0]);
+ }
}
# go to first point of extrusion path