mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-21 20:18:17 +08:00
Avoid unnecessary retractions during infill. #29
This commit is contained in:
parent
72d7e1a5de
commit
8e7d00bb34
@ -58,7 +58,7 @@ our $layer_height = 0.4;
|
|||||||
our $first_layer_height_ratio = 1;
|
our $first_layer_height_ratio = 1;
|
||||||
our $infill_every_layers = 1;
|
our $infill_every_layers = 1;
|
||||||
our $extrusion_width_ratio = undef;
|
our $extrusion_width_ratio = undef;
|
||||||
our $flow_speed_ratio = 1.2;
|
our $flow_speed_ratio = 1.1;
|
||||||
our $flow_width;
|
our $flow_width;
|
||||||
|
|
||||||
# print options
|
# print options
|
||||||
|
@ -10,7 +10,7 @@ has 'flow_ratio' => (is => 'rw', default => sub {1});
|
|||||||
has 'extrusion_distance' => (is => 'rw', default => sub {0} );
|
has 'extrusion_distance' => (is => 'rw', default => sub {0} );
|
||||||
has 'retracted' => (is => 'rw', default => sub {1} ); # this spits out some plastic at start
|
has 'retracted' => (is => 'rw', default => sub {1} ); # this spits out some plastic at start
|
||||||
has 'lifted' => (is => 'rw', default => sub {0} );
|
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 'last_f' => (is => 'rw', default => sub {0});
|
||||||
has 'dec' => (is => 'ro', default => sub { 3 } );
|
has 'dec' => (is => 'ro', default => sub { 3 } );
|
||||||
|
|
||||||
@ -85,11 +85,16 @@ sub extrude {
|
|||||||
|
|
||||||
# retract if distance from previous position is greater or equal to the one
|
# 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
|
# 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
|
my $distance_from_last_pos = $self->last_pos->distance_to($path->points->[0]) * $Slic3r::resolution;
|
||||||
&& ($Slic3r::fill_density == 0 || $distance_from_last_pos >= $Slic3r::flow_width / $Slic3r::fill_density * sqrt(2))) {
|
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]);
|
$gcode .= $self->retract(travel_to => $path->points->[0]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# go to first point of extrusion path
|
# go to first point of extrusion path
|
||||||
$gcode .= $self->G0($path->points->[0], undef, 0, "move to first $description point")
|
$gcode .= $self->G0($path->points->[0], undef, 0, "move to first $description point")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user