New raft_layers option. #123

This commit is contained in:
Alessandro Ranellucci 2013-01-28 14:12:01 +01:00
parent a016a06fa6
commit 177f1a9bf0
6 changed files with 28 additions and 7 deletions

View File

@ -209,6 +209,7 @@ The author of the Silk icon set is Mark James.
Spacing between pattern lines (mm, default: 2.5) Spacing between pattern lines (mm, default: 2.5)
--support-material-angle --support-material-angle
Support material angle in degrees (range: 0-90, default: 0) Support material angle in degrees (range: 0-90, default: 0)
--raft-layers Number of layers to raise the printed objects by (range: 0+, default: 0)
Retraction options: Retraction options:
--retract-length Length of retraction in mm when pausing extrusion (default: 1) --retract-length Length of retraction in mm when pausing extrusion (default: 1)

View File

@ -578,6 +578,14 @@ our $Options = {
type => 'i', type => 'i',
default => 0, default => 0,
}, },
'raft_layers' => {
label => 'Raft layers',
tooltip => 'Number of total raft layers to insert below the object(s).',
sidetext => 'layers',
cli => 'raft-layers=i',
type => 'i',
default => 0,
},
'start_gcode' => { 'start_gcode' => {
label => 'Start G-code', label => 'Start G-code',
tooltip => 'This start procedure is inserted at the beginning of the output file, right after the temperature control commands for extruder and bed. If Slic3r detects M104 or M190 in your custom codes, such commands will not be prepended automatically. Note that you can use placeholder variables for all Slic3r settings, so you can put a "M104 S[first_layer_temperature]" command wherever you want.', tooltip => 'This start procedure is inserted at the beginning of the output file, right after the temperature control commands for extruder and bed. If Slic3r detects M104 or M190 in your custom codes, such commands will not be prepended automatically. Note that you can use placeholder variables for all Slic3r settings, so you can put a "M104 S[first_layer_temperature]" command wherever you want.',

View File

@ -456,6 +456,10 @@ sub build {
title => 'Support material', title => 'Support material',
options => [qw(support_material support_material_threshold support_material_pattern support_material_spacing support_material_angle)], options => [qw(support_material support_material_threshold support_material_pattern support_material_spacing support_material_angle)],
}, },
{
title => 'Raft',
options => [qw(raft_layers)],
},
]); ]);
$self->add_options_page('Notes', 'note.png', optgroups => [ $self->add_options_page('Notes', 'note.png', optgroups => [

View File

@ -2,6 +2,7 @@ package Slic3r::Layer;
use Moo; use Moo;
use List::Util qw(first); use List::Util qw(first);
use Slic3r::Geometry qw(scale);
use Slic3r::Geometry::Clipper qw(union_ex); use Slic3r::Geometry::Clipper qw(union_ex);
has 'id' => (is => 'rw', required => 1, trigger => 1); # sequential number of layer, 0-based has 'id' => (is => 'rw', required => 1, trigger => 1); # sequential number of layer, 0-based
@ -32,11 +33,16 @@ sub _trigger_id {
sub _build_slice_z { sub _build_slice_z {
my $self = shift; my $self = shift;
if ($Slic3r::Config->raft_layers == 0) {
if ($self->id == 0) { if ($self->id == 0) {
return $Slic3r::Config->get_value('first_layer_height') / 2 / &Slic3r::SCALING_FACTOR; return scale $Slic3r::Config->get_value('first_layer_height') / 2;
}
return scale($Slic3r::Config->get_value('first_layer_height') + ($self->id-1 + 0.5) * $Slic3r::Config->layer_height);
} else {
return -1 if $self->id < $Slic3r::Config->raft_layers;
my $object_layer_id = $self->id - $Slic3r::Config->raft_layers;
return scale ($object_layer_id + 0.5) * $Slic3r::Config->layer_height;
} }
return ($Slic3r::Config->get_value('first_layer_height') + (($self->id-1) * $Slic3r::Config->layer_height) + ($Slic3r::Config->layer_height/2))
/ &Slic3r::SCALING_FACTOR; #/
} }
# Z used for printing in scaled coordinates # Z used for printing in scaled coordinates

View File

@ -173,9 +173,10 @@ sub slice {
} }
# remove empty layers from bottom # remove empty layers from bottom
while (@{$self->layers} && !@{$self->layers->[0]->slices} && !map @{$_->thin_walls}, @{$self->layers->[0]->regions}) { my $first_object_layer_id = $Slic3r::Config->raft_layers;
shift @{$self->layers}; while (@{$self->layers} && !@{$self->layers->[$first_object_layer_id]->slices} && !map @{$_->thin_walls}, @{$self->layers->[$first_object_layer_id]->regions}) {
for (my $i = 0; $i <= $#{$self->layers}; $i++) { splice @{$self->layers}, $first_object_layer_id, 1;
for (my $i = $first_object_layer_id; $i <= $#{$self->layers}; $i++) {
$self->layers->[$i]->id($i); $self->layers->[$i]->id($i);
} }
} }

View File

@ -257,6 +257,7 @@ $j
Spacing between pattern lines (mm, default: $config->{support_material_spacing}) Spacing between pattern lines (mm, default: $config->{support_material_spacing})
--support-material-angle --support-material-angle
Support material angle in degrees (range: 0-90, default: $config->{support_material_angle}) Support material angle in degrees (range: 0-90, default: $config->{support_material_angle})
--raft-layers Number of layers to raise the printed objects by (range: 0+, default: $config->{raft_layers})
Retraction options: Retraction options:
--retract-length Length of retraction in mm when pausing extrusion (default: $config->{retract_length}[0]) --retract-length Length of retraction in mm when pausing extrusion (default: $config->{retract_length}[0])