Merge branch 'per-extruder-retraction-settings'
Conflicts: lib/Slic3r/Config.pm lib/Slic3r/GUI/Tab.pm
This commit is contained in:
commit
9ca21c835c
@ -8,6 +8,9 @@ use constant PI => 4 * atan2(1, 1);
|
|||||||
# cemetery of old config settings
|
# cemetery of old config settings
|
||||||
our @Ignore = qw(duplicate_x duplicate_y multiply_x multiply_y support_material_tool);
|
our @Ignore = qw(duplicate_x duplicate_y multiply_x multiply_y support_material_tool);
|
||||||
|
|
||||||
|
my $serialize_comma = sub { join ',', @{$_[0]} };
|
||||||
|
my $deserialize_comma = sub { [ split /,/, $_[0] ] };
|
||||||
|
|
||||||
our $Options = {
|
our $Options = {
|
||||||
|
|
||||||
# miscellaneous options
|
# miscellaneous options
|
||||||
@ -52,8 +55,8 @@ our $Options = {
|
|||||||
sidetext => 'mm',
|
sidetext => 'mm',
|
||||||
cli => 'print-center=s',
|
cli => 'print-center=s',
|
||||||
type => 'point',
|
type => 'point',
|
||||||
serialize => sub { join ',', @{$_[0]} },
|
serialize => $serialize_comma,
|
||||||
deserialize => sub { [ split /[,x]/, $_[0] ] },
|
deserialize => $deserialize_comma,
|
||||||
default => [100,100],
|
default => [100,100],
|
||||||
},
|
},
|
||||||
'gcode_flavor' => {
|
'gcode_flavor' => {
|
||||||
@ -126,8 +129,8 @@ our $Options = {
|
|||||||
cli => 'nozzle-diameter=f@',
|
cli => 'nozzle-diameter=f@',
|
||||||
type => 'f',
|
type => 'f',
|
||||||
sidetext => 'mm',
|
sidetext => 'mm',
|
||||||
serialize => sub { join ',', @{$_[0]} },
|
serialize => $serialize_comma,
|
||||||
deserialize => sub { [ split /,/, $_[0] ] },
|
deserialize => $deserialize_comma,
|
||||||
default => [0.5],
|
default => [0.5],
|
||||||
},
|
},
|
||||||
'filament_diameter' => {
|
'filament_diameter' => {
|
||||||
@ -136,8 +139,8 @@ our $Options = {
|
|||||||
sidetext => 'mm',
|
sidetext => 'mm',
|
||||||
cli => 'filament-diameter=f@',
|
cli => 'filament-diameter=f@',
|
||||||
type => 'f',
|
type => 'f',
|
||||||
serialize => sub { join ',', @{$_[0]} },
|
serialize => $serialize_comma,
|
||||||
deserialize => sub { [ split /,/, $_[0] ] },
|
deserialize => $deserialize_comma,
|
||||||
default => [3],
|
default => [3],
|
||||||
},
|
},
|
||||||
'extrusion_multiplier' => {
|
'extrusion_multiplier' => {
|
||||||
@ -145,8 +148,8 @@ our $Options = {
|
|||||||
tooltip => 'This factor changes the amount of flow proportionally. You may need to tweak this setting to get nice surface finish and correct single wall widths. Usual values are between 0.9 and 1.1. If you think you need to change this more, check filament diameter and your firmware E steps.',
|
tooltip => 'This factor changes the amount of flow proportionally. You may need to tweak this setting to get nice surface finish and correct single wall widths. Usual values are between 0.9 and 1.1. If you think you need to change this more, check filament diameter and your firmware E steps.',
|
||||||
cli => 'extrusion-multiplier=f@',
|
cli => 'extrusion-multiplier=f@',
|
||||||
type => 'f',
|
type => 'f',
|
||||||
serialize => sub { join ',', @{$_[0]} },
|
serialize => $serialize_comma,
|
||||||
deserialize => sub { [ split /,/, $_[0] ] },
|
deserialize => $deserialize_comma,
|
||||||
default => [1],
|
default => [1],
|
||||||
},
|
},
|
||||||
'temperature' => {
|
'temperature' => {
|
||||||
@ -156,7 +159,7 @@ our $Options = {
|
|||||||
cli => 'temperature=i@',
|
cli => 'temperature=i@',
|
||||||
type => 'i',
|
type => 'i',
|
||||||
max => 300,
|
max => 300,
|
||||||
serialize => sub { join ',', @{$_[0]} },
|
serialize => $serialize_comma,
|
||||||
deserialize => sub { $_[0] ? [ split /,/, $_[0] ] : [0] },
|
deserialize => sub { $_[0] ? [ split /,/, $_[0] ] : [0] },
|
||||||
default => [200],
|
default => [200],
|
||||||
},
|
},
|
||||||
@ -166,7 +169,7 @@ our $Options = {
|
|||||||
sidetext => '°C',
|
sidetext => '°C',
|
||||||
cli => 'first-layer-temperature=i@',
|
cli => 'first-layer-temperature=i@',
|
||||||
type => 'i',
|
type => 'i',
|
||||||
serialize => sub { join ',', @{$_[0]} },
|
serialize => $serialize_comma,
|
||||||
deserialize => sub { $_[0] ? [ split /,/, $_[0] ] : [0] },
|
deserialize => sub { $_[0] ? [ split /,/, $_[0] ] : [0] },
|
||||||
max => 300,
|
max => 300,
|
||||||
default => [200],
|
default => [200],
|
||||||
@ -557,42 +560,52 @@ END
|
|||||||
label => 'Length',
|
label => 'Length',
|
||||||
tooltip => 'When retraction is triggered, filament is pulled back by the specified amount (the length is measured on raw filament, before it enters the extruder).',
|
tooltip => 'When retraction is triggered, filament is pulled back by the specified amount (the length is measured on raw filament, before it enters the extruder).',
|
||||||
sidetext => 'mm (zero to disable)',
|
sidetext => 'mm (zero to disable)',
|
||||||
cli => 'retract-length=f',
|
cli => 'retract-length=f@',
|
||||||
type => 'f',
|
type => 'f',
|
||||||
default => 1,
|
serialize => $serialize_comma,
|
||||||
|
deserialize => $deserialize_comma,
|
||||||
|
default => [1],
|
||||||
},
|
},
|
||||||
'retract_speed' => {
|
'retract_speed' => {
|
||||||
label => 'Speed',
|
label => 'Speed',
|
||||||
tooltip => 'The speed for retractions (it only applies to the extruder motor).',
|
tooltip => 'The speed for retractions (it only applies to the extruder motor).',
|
||||||
sidetext => 'mm/s',
|
sidetext => 'mm/s',
|
||||||
cli => 'retract-speed=f',
|
cli => 'retract-speed=f@',
|
||||||
type => 'i',
|
type => 'i',
|
||||||
max => 1000,
|
max => 1000,
|
||||||
default => 30,
|
serialize => $serialize_comma,
|
||||||
|
deserialize => $deserialize_comma,
|
||||||
|
default => [30],
|
||||||
},
|
},
|
||||||
'retract_restart_extra' => {
|
'retract_restart_extra' => {
|
||||||
label => 'Extra length on restart',
|
label => 'Extra length on restart',
|
||||||
tooltip => 'When the retraction is compensated after the travel move, the extruder will push this additional amount of filament. This setting is rarely needed.',
|
tooltip => 'When the retraction is compensated after the travel move, the extruder will push this additional amount of filament. This setting is rarely needed.',
|
||||||
sidetext => 'mm',
|
sidetext => 'mm',
|
||||||
cli => 'retract-restart-extra=f',
|
cli => 'retract-restart-extra=f@',
|
||||||
type => 'f',
|
type => 'f',
|
||||||
default => 0,
|
serialize => $serialize_comma,
|
||||||
|
deserialize => $deserialize_comma,
|
||||||
|
default => [0],
|
||||||
},
|
},
|
||||||
'retract_before_travel' => {
|
'retract_before_travel' => {
|
||||||
label => 'Minimum travel after retraction',
|
label => 'Minimum travel after retraction',
|
||||||
tooltip => 'Retraction is not triggered when travel moves are shorter than this length.',
|
tooltip => 'Retraction is not triggered when travel moves are shorter than this length.',
|
||||||
sidetext => 'mm',
|
sidetext => 'mm',
|
||||||
cli => 'retract-before-travel=f',
|
cli => 'retract-before-travel=f@',
|
||||||
type => 'f',
|
type => 'f',
|
||||||
default => 2,
|
serialize => $serialize_comma,
|
||||||
|
deserialize => $deserialize_comma,
|
||||||
|
default => [2],
|
||||||
},
|
},
|
||||||
'retract_lift' => {
|
'retract_lift' => {
|
||||||
label => 'Lift Z',
|
label => 'Lift Z',
|
||||||
tooltip => 'If you set this to a positive value, Z is quickly raised every time a retraction is triggered.',
|
tooltip => 'If you set this to a positive value, Z is quickly raised every time a retraction is triggered.',
|
||||||
sidetext => 'mm',
|
sidetext => 'mm',
|
||||||
cli => 'retract-lift=f',
|
cli => 'retract-lift=f@',
|
||||||
type => 'f',
|
type => 'f',
|
||||||
default => 0,
|
serialize => $serialize_comma,
|
||||||
|
deserialize => $deserialize_comma,
|
||||||
|
default => [0],
|
||||||
},
|
},
|
||||||
|
|
||||||
# cooling options
|
# cooling options
|
||||||
@ -737,7 +750,7 @@ END
|
|||||||
sidetext => 'mm',
|
sidetext => 'mm',
|
||||||
cli => 'bed-size=s',
|
cli => 'bed-size=s',
|
||||||
type => 'point',
|
type => 'point',
|
||||||
serialize => sub { join ',', @{$_[0]} },
|
serialize => $serialize_comma,
|
||||||
deserialize => sub { [ split /[,x]/, $_[0] ] },
|
deserialize => sub { [ split /[,x]/, $_[0] ] },
|
||||||
default => [200,200],
|
default => [200,200],
|
||||||
},
|
},
|
||||||
@ -745,7 +758,7 @@ END
|
|||||||
label => 'Copies (grid)',
|
label => 'Copies (grid)',
|
||||||
cli => 'duplicate-grid=s',
|
cli => 'duplicate-grid=s',
|
||||||
type => 'point',
|
type => 'point',
|
||||||
serialize => sub { join ',', @{$_[0]} },
|
serialize => $serialize_comma,
|
||||||
deserialize => sub { [ split /[,x]/, $_[0] ] },
|
deserialize => sub { [ split /[,x]/, $_[0] ] },
|
||||||
default => [1,1],
|
default => [1,1],
|
||||||
},
|
},
|
||||||
|
@ -6,10 +6,12 @@ use Slic3r::Geometry qw(PI);
|
|||||||
use constant OPTIONS => [qw(
|
use constant OPTIONS => [qw(
|
||||||
extruder_offset
|
extruder_offset
|
||||||
nozzle_diameter filament_diameter extrusion_multiplier temperature first_layer_temperature
|
nozzle_diameter filament_diameter extrusion_multiplier temperature first_layer_temperature
|
||||||
|
retract_length retract_lift retract_speed retract_restart_extra retract_before_travel
|
||||||
)];
|
)];
|
||||||
has $_ => (is => 'ro', required => 1) for @{&OPTIONS};
|
has $_ => (is => 'ro', required => 1) for @{&OPTIONS};
|
||||||
|
|
||||||
has 'e_per_mm3' => (is => 'lazy');
|
has 'e_per_mm3' => (is => 'lazy');
|
||||||
|
has 'retract_speed_mm_min' => (is => 'lazy');
|
||||||
has '_mm3_per_mm_cache' => (is => 'ro', default => sub {{}});
|
has '_mm3_per_mm_cache' => (is => 'ro', default => sub {{}});
|
||||||
|
|
||||||
sub _build_e_per_mm3 {
|
sub _build_e_per_mm3 {
|
||||||
@ -17,6 +19,11 @@ sub _build_e_per_mm3 {
|
|||||||
return $self->extrusion_multiplier * (4 / (($self->filament_diameter ** 2) * PI));
|
return $self->extrusion_multiplier * (4 / (($self->filament_diameter ** 2) * PI));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub _build_retract_speed_mm_min {
|
||||||
|
my $self = shift;
|
||||||
|
return $self->retract_speed * 60;
|
||||||
|
}
|
||||||
|
|
||||||
sub make_flow {
|
sub make_flow {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return Slic3r::Flow->new(nozzle_diameter => $self->nozzle_diameter, @_);
|
return Slic3r::Flow->new(nozzle_diameter => $self->nozzle_diameter, @_);
|
||||||
|
@ -33,7 +33,6 @@ has 'speeds' => (
|
|||||||
solid_infill => 60 * $Slic3r::Config->get_value('solid_infill_speed'),
|
solid_infill => 60 * $Slic3r::Config->get_value('solid_infill_speed'),
|
||||||
top_solid_infill => 60 * $Slic3r::Config->get_value('top_solid_infill_speed'),
|
top_solid_infill => 60 * $Slic3r::Config->get_value('top_solid_infill_speed'),
|
||||||
bridge => 60 * $Slic3r::Config->get_value('bridge_speed'),
|
bridge => 60 * $Slic3r::Config->get_value('bridge_speed'),
|
||||||
retract => 60 * $Slic3r::Config->get_value('retract_speed'),
|
|
||||||
}},
|
}},
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -137,7 +136,7 @@ sub extrude_path {
|
|||||||
# 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 = $self->last_pos->distance_to($path->points->[0]) * &Slic3r::SCALING_FACTOR;
|
my $distance_from_last_pos = $self->last_pos->distance_to($path->points->[0]) * &Slic3r::SCALING_FACTOR;
|
||||||
my $distance_threshold = $Slic3r::Config->retract_before_travel;
|
my $distance_threshold = $self->extruder->retract_before_travel;
|
||||||
$distance_threshold = 2 * ($self->layer ? $self->layer->flow->width : $Slic3r::flow->width) / $Slic3r::Config->fill_density * sqrt(2)
|
$distance_threshold = 2 * ($self->layer ? $self->layer->flow->width : $Slic3r::flow->width) / $Slic3r::Config->fill_density * sqrt(2)
|
||||||
if 0 && $Slic3r::Config->fill_density > 0 && $description =~ /fill/;
|
if 0 && $Slic3r::Config->fill_density > 0 && $description =~ /fill/;
|
||||||
|
|
||||||
@ -198,15 +197,15 @@ sub retract {
|
|||||||
my $self = shift;
|
my $self = shift;
|
||||||
my %params = @_;
|
my %params = @_;
|
||||||
|
|
||||||
return "" unless $Slic3r::Config->retract_length > 0
|
return "" unless $self->extruder->retract_length > 0
|
||||||
&& !$self->retracted;
|
&& !$self->retracted;
|
||||||
|
|
||||||
# prepare moves
|
# prepare moves
|
||||||
$self->speed('retract');
|
$self->speed('retract');
|
||||||
my $retract = [undef, undef, -$Slic3r::Config->retract_length, "retract"];
|
my $retract = [undef, undef, -$self->extruder->retract_length, "retract"];
|
||||||
my $lift = ($Slic3r::Config->retract_lift == 0 || defined $params{move_z})
|
my $lift = ($self->extruder->retract_lift == 0 || defined $params{move_z})
|
||||||
? undef
|
? undef
|
||||||
: [undef, $self->z + $Slic3r::Config->retract_lift, 0, 'lift plate during retraction'];
|
: [undef, $self->z + $self->extruder->retract_lift, 0, 'lift plate during retraction'];
|
||||||
|
|
||||||
my $gcode = "";
|
my $gcode = "";
|
||||||
if (($Slic3r::Config->g0 || $Slic3r::Config->gcode_flavor eq 'mach3') && $params{travel_to}) {
|
if (($Slic3r::Config->g0 || $Slic3r::Config->gcode_flavor eq 'mach3') && $params{travel_to}) {
|
||||||
@ -225,16 +224,16 @@ sub retract {
|
|||||||
$gcode .= $self->G0(@$travel);
|
$gcode .= $self->G0(@$travel);
|
||||||
} else {
|
} else {
|
||||||
$gcode .= $self->G1(@$retract);
|
$gcode .= $self->G1(@$retract);
|
||||||
if (defined $params{move_z} && $Slic3r::Config->retract_lift > 0) {
|
if (defined $params{move_z} && $self->extruder->retract_lift > 0) {
|
||||||
my $travel = [undef, $params{move_z} + $Slic3r::Config->retract_lift, 0, 'move to next layer (' . $self->layer->id . ') and lift'];
|
my $travel = [undef, $params{move_z} + $self->extruder->retract_lift, 0, 'move to next layer (' . $self->layer->id . ') and lift'];
|
||||||
$gcode .= $self->G0(@$travel);
|
$gcode .= $self->G0(@$travel);
|
||||||
$self->lifted(1);
|
$self->lifted($self->extruder->retract_lift);
|
||||||
} elsif ($lift) {
|
} elsif ($lift) {
|
||||||
$gcode .= $self->G1(@$lift);
|
$gcode .= $self->G1(@$lift);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$self->retracted(1);
|
$self->retracted(1);
|
||||||
$self->lifted(1) if $lift;
|
$self->lifted($self->extruder->retract_lift) if $lift;
|
||||||
|
|
||||||
# reset extrusion distance during retracts
|
# reset extrusion distance during retracts
|
||||||
# this makes sure we leave sufficient precision in the firmware
|
# this makes sure we leave sufficient precision in the firmware
|
||||||
@ -249,12 +248,12 @@ sub unretract {
|
|||||||
my $gcode = "";
|
my $gcode = "";
|
||||||
|
|
||||||
if ($self->lifted) {
|
if ($self->lifted) {
|
||||||
$gcode .= $self->G0(undef, $self->z - $Slic3r::Config->retract_lift, 0, 'restore layer Z');
|
$gcode .= $self->G0(undef, $self->z - $self->lifted, 0, 'restore layer Z');
|
||||||
$self->lifted(0);
|
$self->lifted(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->speed('retract');
|
$self->speed('retract');
|
||||||
$gcode .= $self->G0(undef, undef, ($Slic3r::Config->retract_length + $Slic3r::Config->retract_restart_extra),
|
$gcode .= $self->G0(undef, undef, ($self->extruder->retract_length + $self->extruder->retract_restart_extra),
|
||||||
"compensate retraction");
|
"compensate retraction");
|
||||||
|
|
||||||
return $gcode;
|
return $gcode;
|
||||||
@ -346,7 +345,9 @@ sub _Gx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# apply the speed reduction for print moves on bottom layer
|
# apply the speed reduction for print moves on bottom layer
|
||||||
my $speed_f = $self->speeds->{$speed};
|
my $speed_f = $speed eq 'retract'
|
||||||
|
? ($self->extruder->retract_speed_mm_min)
|
||||||
|
: $self->speeds->{$speed};
|
||||||
if ($e && $self->layer->id == 0 && $comment !~ /retract/) {
|
if ($e && $self->layer->id == 0 && $comment !~ /retract/) {
|
||||||
$speed_f = $Slic3r::Config->first_layer_speed =~ /^(\d+(?:\.\d+)?)%$/
|
$speed_f = $Slic3r::Config->first_layer_speed =~ /^(\d+(?:\.\d+)?)%$/
|
||||||
? ($speed_f * $1/100)
|
? ($speed_f * $1/100)
|
||||||
|
@ -558,13 +558,6 @@ sub build {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$self->add_options_page('Retraction', 'arrow_up.png', optgroups => [
|
|
||||||
{
|
|
||||||
title => 'Retraction',
|
|
||||||
options => [qw(retract_length retract_lift retract_speed retract_restart_extra retract_before_travel)],
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
$self->add_options_page('Custom G-code', 'cog.png', optgroups => [
|
$self->add_options_page('Custom G-code', 'cog.png', optgroups => [
|
||||||
{
|
{
|
||||||
title => 'Start G-code',
|
title => 'Start G-code',
|
||||||
@ -616,6 +609,13 @@ sub _build_extruder_pages {
|
|||||||
title => 'Position (for multi-extruder printers)',
|
title => 'Position (for multi-extruder printers)',
|
||||||
options => ['extruder_offset#' . $extruder_idx],
|
options => ['extruder_offset#' . $extruder_idx],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title => 'Retraction',
|
||||||
|
options => [
|
||||||
|
map "${_}#${extruder_idx}",
|
||||||
|
qw(retract_length retract_lift retract_speed retract_restart_extra retract_before_travel)
|
||||||
|
],
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
$self->{extruder_pages}[$extruder_idx]{disabled} = 0;
|
$self->{extruder_pages}[$extruder_idx]{disabled} = 0;
|
||||||
}
|
}
|
||||||
|
10
slic3r.pl
10
slic3r.pl
@ -227,14 +227,14 @@ $j
|
|||||||
|
|
||||||
Retraction options:
|
Retraction options:
|
||||||
--retract-length Length of retraction in mm when pausing extrusion
|
--retract-length Length of retraction in mm when pausing extrusion
|
||||||
(default: $config->{retract_length})
|
(default: $config->{retract_length}[0])
|
||||||
--retract-speed Speed for retraction in mm/s (default: $config->{retract_speed})
|
--retract-speed Speed for retraction in mm/s (default: $config->{retract_speed}[0])
|
||||||
--retract-restart-extra
|
--retract-restart-extra
|
||||||
Additional amount of filament in mm to push after
|
Additional amount of filament in mm to push after
|
||||||
compensating retraction (default: $config->{retract_restart_extra})
|
compensating retraction (default: $config->{retract_restart_extra}[0])
|
||||||
--retract-before-travel
|
--retract-before-travel
|
||||||
Only retract before travel moves of this length in mm (default: $config->{retract_before_travel})
|
Only retract before travel moves of this length in mm (default: $config->{retract_before_travel}[0])
|
||||||
--retract-lift Lift Z by the given distance in mm when retracting (default: $config->{retract_lift})
|
--retract-lift Lift Z by the given distance in mm when retracting (default: $config->{retract_lift}[0])
|
||||||
|
|
||||||
Cooling options:
|
Cooling options:
|
||||||
--cooling Enable fan and cooling control
|
--cooling Enable fan and cooling control
|
||||||
|
Loading…
Reference in New Issue
Block a user