New option to specify G-code to be used at layer change. #279

This commit is contained in:
Alessandro Ranellucci 2012-03-26 12:14:15 +02:00
parent bf964b5273
commit 1a06e35687
6 changed files with 24 additions and 10 deletions

View File

@ -143,8 +143,7 @@ The author is Alessandro Ranellucci (me).
Infill every N layers (default: 1) Infill every N layers (default: 1)
Print options: Print options:
--perimeters Number of perimeters/horizontal skins (range: 0+, --perimeters Number of perimeters/horizontal skins (range: 0+, default: 3)
default: 3)
--solid-layers Number of solid layers to do for top/bottom surfaces --solid-layers Number of solid layers to do for top/bottom surfaces
(range: 1+, default: 3) (range: 1+, default: 3)
--fill-density Infill density (range: 0-1, default: 0.4) --fill-density Infill density (range: 0-1, default: 0.4)
@ -156,6 +155,7 @@ The author is Alessandro Ranellucci (me).
--end-gcode Load final gcode from the supplied file. This will overwrite --end-gcode Load final gcode from the supplied file. This will overwrite
the default commands (turn off temperature [M104 S0], the default commands (turn off temperature [M104 S0],
home X axis [G28 X], disable motors [M84]). home X axis [G28 X], disable motors [M84]).
--layer-gcode Load layer-change G-code from the supplied file (default: nothing).
--support-material Generate support material for overhangs --support-material Generate support material for overhangs
Retraction options: Retraction options:

View File

@ -109,6 +109,7 @@ M104 S0 ; turn off temperature
G28 X0 ; home X axis G28 X0 ; home X axis
M84 ; disable motors M84 ; disable motors
END END
our $layer_gcode = '';
# retraction options # retraction options
our $retract_length = 1; # mm our $retract_length = 1; # mm

View File

@ -255,7 +255,7 @@ our $Options = {
type => 's', type => 's',
multiline => 1, multiline => 1,
width => 350, width => 350,
height => 150, height => 120,
serialize => sub { join '\n', split /\R+/, $_[0] }, serialize => sub { join '\n', split /\R+/, $_[0] },
deserialize => sub { join "\n", split /\\n/, $_[0] }, deserialize => sub { join "\n", split /\\n/, $_[0] },
}, },
@ -265,7 +265,17 @@ our $Options = {
type => 's', type => 's',
multiline => 1, multiline => 1,
width => 350, width => 350,
height => 150, height => 120,
serialize => sub { join '\n', split /\R+/, $_[0] },
deserialize => sub { join "\n", split /\\n/, $_[0] },
},
'layer_gcode' => {
label => 'Layer Change GCODE',
cli => 'layer-gcode=s',
type => 's',
multiline => 1,
width => 350,
height => 50,
serialize => sub { join '\n', split /\R+/, $_[0] }, serialize => sub { join '\n', split /\R+/, $_[0] },
deserialize => sub { join "\n", split /\\n/, $_[0] }, deserialize => sub { join "\n", split /\\n/, $_[0] },
}, },
@ -475,7 +485,7 @@ sub validate_cli {
my $class = shift; my $class = shift;
my ($opt) = @_; my ($opt) = @_;
for (qw(start end)) { for (qw(start end layer)) {
if (defined $opt->{$_."_gcode"}) { if (defined $opt->{$_."_gcode"}) {
if ($opt->{$_."_gcode"} eq "") { if ($opt->{$_."_gcode"} eq "") {
set($_."_gcode", ""); set($_."_gcode", "");

View File

@ -49,6 +49,9 @@ sub change_layer {
$gcode .= $self->G0(undef, $z, 0, 'move to next layer') $gcode .= $self->G0(undef, $z, 0, 'move to next layer')
if $self->z != $z; if $self->z != $z;
$gcode .= Slic3r::Config->replace_options($Slic3r::layer_gcode) . "\n"
if $Slic3r::layer_gcode;
return $gcode; return $gcode;
} }

View File

@ -64,7 +64,7 @@ sub new {
}, },
gcode => { gcode => {
title => 'Custom GCODE', title => 'Custom GCODE',
options => [qw(start_gcode end_gcode gcode_comments post_process)], options => [qw(start_gcode end_gcode layer_gcode gcode_comments post_process)],
}, },
extrusion => { extrusion => {
title => 'Extrusion', title => 'Extrusion',

View File

@ -161,19 +161,19 @@ Usage: slic3r.pl [ OPTIONS ] file.stl
Infill every N layers (default: $Slic3r::infill_every_layers) Infill every N layers (default: $Slic3r::infill_every_layers)
Print options: Print options:
--perimeters Number of perimeters/horizontal skins (range: 0+, --perimeters Number of perimeters/horizontal skins (range: 0+, default: $Slic3r::perimeters)
default: $Slic3r::perimeters)
--solid-layers Number of solid layers to do for top/bottom surfaces --solid-layers Number of solid layers to do for top/bottom surfaces
(range: 1+, default: $Slic3r::solid_layers) (range: 1+, default: $Slic3r::solid_layers)
--fill-density Infill density (range: 0-1, default: $Slic3r::fill_density) --fill-density Infill density (range: 0-1, default: $Slic3r::fill_density)
--fill-angle Infill angle in degrees (range: 0-90, default: $Slic3r::fill_angle) --fill-angle Infill angle in degrees (range: 0-90, default: $Slic3r::fill_angle)
--fill-pattern Pattern to use to fill non-solid layers (default: $Slic3r::fill_pattern) --fill-pattern Pattern to use to fill non-solid layers (default: $Slic3r::fill_pattern)
--solid-fill-pattern Pattern to use to fill solid layers (default: $Slic3r::solid_fill_pattern) --solid-fill-pattern Pattern to use to fill solid layers (default: $Slic3r::solid_fill_pattern)
--start-gcode Load initial gcode from the supplied file. This will overwrite --start-gcode Load initial G-code from the supplied file. This will overwrite
the default command (home all axes [G28]). the default command (home all axes [G28]).
--end-gcode Load final gcode from the supplied file. This will overwrite --end-gcode Load final G-code from the supplied file. This will overwrite
the default commands (turn off temperature [M104 S0], the default commands (turn off temperature [M104 S0],
home X axis [G28 X], disable motors [M84]). home X axis [G28 X], disable motors [M84]).
--layer-gcode Load layer-change G-code from the supplied file (default: nothing).
--support-material Generate support material for overhangs --support-material Generate support material for overhangs
Retraction options: Retraction options: