New option for support material interface extruder. #1072

new-support2
Alessandro Ranellucci 2013-07-26 00:32:21 +02:00
parent d27a859542
commit 0647958a5c
10 changed files with 30 additions and 11 deletions

View File

@ -322,6 +322,8 @@ The author of the Silk icon set is Mark James.
--infill-extruder Extruder to use for infill (1+, default: 1)
--support-material-extruder
Extruder to use for support material (1+, default: 1)
--support-material-interface-extruder
Extruder to use for support material interface (1+, default: 1)
If you want to change a preset file, just do

View File

@ -204,11 +204,18 @@ our $Options = {
},
'support_material_extruder' => {
label => 'Support material extruder',
tooltip => 'The extruder to use when printing support material. This affects brim too.',
tooltip => 'The extruder to use when printing support material. This affects brim and raft too.',
cli => 'support-material-extruder=i',
type => 'i',
default => 1,
},
'support_material_interface_extruder' => {
label => 'Support material interface extruder',
tooltip => 'The extruder to use when printing support material interface. This affects raft too.',
cli => 'support-material-interface-extruder=i',
type => 'i',
default => 1,
},
# filament options
'first_layer_bed_temperature' => {

View File

@ -89,13 +89,14 @@ sub process_layer {
# extrude support material before other things because it might use a lower Z
# and also because we avoid travelling on other things when printing it
if ($self->print->has_support_material && $layer->isa('Slic3r::Layer::Support')) {
$gcode .= $self->gcodegen->set_extruder($self->extruders->[$Slic3r::Config->support_material_extruder-1]);
$gcode .= $self->gcodegen->move_z($layer->print_z);
if ($layer->support_contact_fills) {
$gcode .= $self->gcodegen->extrude_path($_, 'support material contact area')
for $layer->support_contact_fills->chained_path($self->gcodegen->last_pos);
if ($layer->support_interface_fills) {
$gcode .= $self->gcodegen->set_extruder($self->extruders->[$Slic3r::Config->support_material_interface_extruder-1]);
$gcode .= $self->gcodegen->extrude_path($_, 'support material interface')
for $layer->support_interface_fills->chained_path($self->gcodegen->last_pos);
}
if ($layer->support_fills) {
$gcode .= $self->gcodegen->set_extruder($self->extruders->[$Slic3r::Config->support_material_extruder-1]);
$gcode .= $self->gcodegen->extrude_path($_, 'support material')
for $layer->support_fills->chained_path($self->gcodegen->last_pos);
}

View File

@ -526,7 +526,7 @@ sub build {
$self->add_options_page('Multiple Extruders', 'funnel.png', optgroups => [
{
title => 'Extruders',
options => [qw(perimeter_extruder infill_extruder support_material_extruder)],
options => [qw(perimeter_extruder infill_extruder support_material_extruder support_material_interface_extruder)],
},
]);

View File

@ -70,6 +70,6 @@ extends 'Slic3r::Layer';
# ordered collection of extrusion paths to fill surfaces for support material
has 'support_islands' => (is => 'rw');
has 'support_fills' => (is => 'rw');
has 'support_contact_fills' => (is => 'rw');
has 'support_interface_fills' => (is => 'rw');
1;

View File

@ -257,6 +257,7 @@ sub init_extruders {
}
# calculate support material flow
# Note: we should calculate a different flow for support material interface
if ($self->has_support_material) {
my $extruder = $self->extruders->[$self->config->support_material_extruder-1];
$self->support_material_flow($extruder->make_flow(

View File

@ -1002,7 +1002,7 @@ sub generate_support_material {
my $process_layer = sub {
my ($layer_id) = @_;
my $result = { interface => [], support => [] };
my $result = { contact => [], interface => [], support => [] };
$contact{$layer_id} ||= [];
$interface{$layer_id} ||= [];
@ -1153,8 +1153,13 @@ sub generate_support_material {
my $apply = sub {
my ($layer_id, $result) = @_;
my $layer = $self->support_layers->[$layer_id];
$layer->support_contact_fills(Slic3r::ExtrusionPath::Collection->new(paths => $result->{contact})) if $result->{contact};
$layer->support_fills(Slic3r::ExtrusionPath::Collection->new(paths => [ @{$result->{interface}}, @{$result->{support}} ]));
my $interface_collection = Slic3r::ExtrusionPath::Collection->new(paths => [ @{$result->{contact}}, @{$result->{interface}} ]);
$layer->support_interface_fills($interface_collection) if @{$interface_collection->paths} > 0;
my $support_collection = Slic3r::ExtrusionPath::Collection->new(paths => $result->{support});
$layer->support_fills($support_collection) if @{$support_collection->paths} > 0;
$layer->support_islands($result->{islands});
};
Slic3r::parallelize(

View File

@ -58,7 +58,7 @@ sub export_svg {
);
$group->(
filter => sub { $_[0]->isa('Slic3r::Layer::Support') ? ($_[0]->support_fills, $_[0]->support_contact_fills) : () },
filter => sub { $_[0]->isa('Slic3r::Layer::Support') ? ($_[0]->support_fills, $_[0]->support_interface_fills) : () },
style => {
'stroke-width' => 1,
'stroke' => '#444444',

View File

@ -407,6 +407,8 @@ $j
--infill-extruder Extruder to use for infill (1+, default: 1)
--support-material-extruder
Extruder to use for support material (1+, default: 1)
--support-material-interface-extruder
Extruder to use for support material interface (1+, default: 1)
EOF
exit ($exit_code || 0);

View File

@ -58,6 +58,7 @@ use Slic3r::Test;
$config->set('brim_width', 6);
$config->set('skirts', 0);
$config->set('support_material_extruder', 2);
$config->set('support_material_interface_extruder', 2);
$config->set('layer_height', 0.4);
$config->set('first_layer_height', '100%');
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);