Dual extruder for support material

This commit is contained in:
Alessandro Ranellucci 2012-02-19 17:02:49 +01:00
parent 375829204f
commit 94a2585b97
5 changed files with 23 additions and 1 deletions

View File

@ -97,6 +97,7 @@ our $solid_fill_pattern = 'rectilinear';
our $fill_density = 0.4; # 1 = 100%
our $fill_angle = 45;
our $support_material = 0;
our $support_material_tool = 0;
our $start_gcode = "G28 ; home all axes";
our $end_gcode = <<"END";
M104 S0 ; turn off temperature

View File

@ -220,6 +220,13 @@ our $Options = {
cli => 'support-material',
type => 'bool',
},
'support_material_tool' => {
label => 'Tool used to extrude support material',
cli => 'support-material-tool=i',
type => 'select',
values => [0,1],
labels => [qw(Primary Secondary)],
},
'start_gcode' => {
label => 'Start GCODE',
cli => 'start-gcode=s',

View File

@ -326,4 +326,11 @@ sub _Gx {
return "$gcode\n";
}
sub set_tool {
my $self = shift;
my ($tool) = @_;
return sprintf "T%d%s\n", $tool, ($Slic3r::gcode_comments ? ' ; change tool' : '');
}
1;

View File

@ -41,7 +41,7 @@ sub new {
},
print => {
title => 'Print settings',
options => [qw(perimeters solid_layers fill_density fill_angle fill_pattern solid_fill_pattern support_material)],
options => [qw(perimeters solid_layers fill_density fill_angle fill_pattern solid_fill_pattern support_material support_material_tool)],
},
retract => {
title => 'Retraction',

View File

@ -566,6 +566,9 @@ sub export_gcode {
# set up our extruder object
my $extruder = Slic3r::Extruder->new;
if ($Slic3r::support_material && $Slic3r::support_material_tool > 0) {
print $fh $extruder->set_tool(0);
}
# write gcode commands layer by layer
foreach my $layer (@{ $self->layers }) {
@ -594,8 +597,12 @@ sub export_gcode {
# extrude support material
if ($layer->support_fills) {
print $fh $extruder->set_tool($Slic3r::support_material_tool)
if $Slic3r::support_material_tool > 0;
print $fh $extruder->extrude_path($_, 'support material')
for $layer->support_fills->shortest_path($extruder->last_pos);
print $fh $extruder->set_tool(0)
if $Slic3r::support_material_tool > 0;
}
}
}