New toolchange_gcode option. #547
This commit is contained in:
parent
db754dca4d
commit
e59ed7efb7
@ -176,6 +176,7 @@ The author of the Silk icon set is Mark James.
|
||||
the default commands (turn off temperature [M104 S0],
|
||||
home X axis [G28 X], disable motors [M84]).
|
||||
--layer-gcode Load layer-change G-code from the supplied file (default: nothing).
|
||||
--toolchange-gcode Load tool-change G-code from the supplied file (default: nothing).
|
||||
--extra-perimeters Add more perimeters when needed (default: yes)
|
||||
--randomize-start Randomize starting point across layers (default: yes)
|
||||
--only-retract-when-crossing-perimeters
|
||||
|
@ -607,6 +607,18 @@ END
|
||||
deserialize => sub { join "\n", split /\\n/, $_[0] },
|
||||
default => '',
|
||||
},
|
||||
'toolchange_gcode' => {
|
||||
label => 'Tool change G-code',
|
||||
tooltip => 'This custom code is inserted at every extruder change. Note that you can use placeholder variables for all Slic3r settings as well as [previous_extruder] and [next_extruder].',
|
||||
cli => 'toolchange-gcode=s',
|
||||
type => 's',
|
||||
multiline => 1,
|
||||
full_width => 1,
|
||||
height => 50,
|
||||
serialize => sub { join '\n', split /\R+/, $_[0] },
|
||||
deserialize => sub { join "\n", split /\\n/, $_[0] },
|
||||
default => '',
|
||||
},
|
||||
'post_process' => {
|
||||
label => 'Post-processing scripts',
|
||||
tooltip => 'If you want to process the output G-code through custom scripts, just list their absolute paths here. Separate multiple scripts with a semicolon. Scripts will be passed the absolute path to the G-code file as the first argument, and they can access the Slic3r config settings by reading environment variables.',
|
||||
@ -925,7 +937,7 @@ sub new_from_cli {
|
||||
|
||||
delete $args{$_} for grep !defined $args{$_}, keys %args;
|
||||
|
||||
for (qw(start end layer)) {
|
||||
for (qw(start end layer toolchange)) {
|
||||
my $opt_key = "${_}_gcode";
|
||||
if ($args{$opt_key}) {
|
||||
die "Invalid value for --${_}-gcode: file does not exist\n"
|
||||
|
@ -442,6 +442,14 @@ sub set_extruder {
|
||||
my $gcode = "";
|
||||
$gcode .= $self->retract(toolchange => 1) if defined $self->extruder;
|
||||
|
||||
# append custom toolchange G-code
|
||||
if (defined $self->extruder && $Slic3r::Config->toolchange_gcode) {
|
||||
$gcode .= sprintf "%s\n", $Slic3r::Config->replace_options($Slic3r::Config->toolchange_gcode, {
|
||||
previous_extruder => $self->extruder->id,
|
||||
next_extruder => $extruder->id,
|
||||
});
|
||||
}
|
||||
|
||||
# set the new extruder
|
||||
$self->extruder($extruder);
|
||||
$gcode .= sprintf "T%d%s\n", $extruder->id, ($Slic3r::Config->gcode_comments ? ' ; change extruder' : '');
|
||||
|
@ -656,6 +656,11 @@ sub build {
|
||||
no_labels => 1,
|
||||
options => [qw(layer_gcode)],
|
||||
},
|
||||
{
|
||||
title => 'Tool change G-code',
|
||||
no_labels => 1,
|
||||
options => [qw(toolchange_gcode)],
|
||||
},
|
||||
]);
|
||||
|
||||
$self->{extruder_pages} = [];
|
||||
|
@ -224,6 +224,7 @@ $j
|
||||
the default commands (turn off temperature [M104 S0],
|
||||
home X axis [G28 X], disable motors [M84]).
|
||||
--layer-gcode Load layer-change G-code from the supplied file (default: nothing).
|
||||
--toolchange-gcode Load tool-change G-code from the supplied file (default: nothing).
|
||||
--extra-perimeters Add more perimeters when needed (default: yes)
|
||||
--randomize-start Randomize starting point across layers (default: yes)
|
||||
--only-retract-when-crossing-perimeters
|
||||
|
Loading…
Reference in New Issue
Block a user