New option to disable retraction when moving between infill paths inside the same island. #29

This commit is contained in:
Alessandro Ranellucci 2012-08-25 16:30:11 +02:00
parent af1b64a086
commit 0c22250740
5 changed files with 20 additions and 9 deletions

View File

@ -170,6 +170,9 @@ The author of the Silk icon set is Mark James.
--layer-gcode Load layer-change G-code from the supplied file (default: nothing). --layer-gcode Load layer-change G-code from the supplied file (default: nothing).
--extra-perimeters Add more perimeters when needed (default: yes) --extra-perimeters Add more perimeters when needed (default: yes)
--randomize-start Randomize starting point across layers (default: yes) --randomize-start Randomize starting point across layers (default: yes)
--only-retract-when-crossing-perimeters
Disable retraction when travelling between infill paths inside the same island.
(default: no)
--solid-infill-below-area --solid-infill-below-area
Force solid infill when a region has a smaller area than this threshold Force solid infill when a region has a smaller area than this threshold
(mm^2, default: 70) (mm^2, default: 70)

View File

@ -470,6 +470,13 @@ our $Options = {
type => 'bool', type => 'bool',
default => 1, default => 1,
}, },
'only_retract_when_crossing_perimeters' => {
label => 'Only retract when crossing perimeters',
tooltip => 'Disables retraction when travelling between infill paths inside the same island.',
cli => 'only-retract-when-crossing-perimeters!',
type => 'bool',
default => 0,
},
'support_material' => { 'support_material' => {
label => 'Generate support material', label => 'Generate support material',
tooltip => 'Enable support material generation.', tooltip => 'Enable support material generation.',

View File

@ -132,17 +132,15 @@ sub extrude_path {
my $gcode = ""; my $gcode = "";
# 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
{ {
my $distance_from_last_pos = $self->last_pos->distance_to($path->points->[0]) * &Slic3r::SCALING_FACTOR; my $travel = Slic3r::Line->new($self->last_pos, $path->points->[0]);
my $distance_threshold = $self->extruder->retract_before_travel; if ($travel->length >= scale $self->extruder->retract_before_travel) {
$distance_threshold = 2 * ($self->layer ? $self->layer->flow->width : $Slic3r::flow->width) / $Slic3r::Config->fill_density * sqrt(2) if (!$Slic3r::Config->only_retract_when_crossing_perimeters || $path->role != EXTR_ROLE_FILL || !first { $_->expolygon->encloses_line($travel) } @{$self->layer->slices}) {
if 0 && $Slic3r::Config->fill_density > 0 && $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")

View File

@ -401,7 +401,7 @@ sub build {
}, },
{ {
title => 'Advanced', title => 'Advanced',
options => [qw(infill_every_layers fill_angle solid_infill_below_area)], options => [qw(infill_every_layers fill_angle solid_infill_below_area only_retract_when_crossing_perimeters)],
}, },
]); ]);

View File

@ -213,6 +213,9 @@ $j
--layer-gcode Load layer-change G-code from the supplied file (default: nothing). --layer-gcode Load layer-change G-code from the supplied file (default: nothing).
--extra-perimeters Add more perimeters when needed (default: yes) --extra-perimeters Add more perimeters when needed (default: yes)
--randomize-start Randomize starting point across layers (default: yes) --randomize-start Randomize starting point across layers (default: yes)
--only-retract-when-crossing-perimeters
Disable retraction when travelling between infill paths inside the same island.
(default: no)
--solid-infill-below-area --solid-infill-below-area
Force solid infill when a region has a smaller area than this threshold Force solid infill when a region has a smaller area than this threshold
(mm^2, default: $config->{solid_infill_below_area}) (mm^2, default: $config->{solid_infill_below_area})