Command line options to assign perimeters and infill to different extruders

This commit is contained in:
Alessandro Ranellucci 2012-06-28 16:48:56 +02:00
parent 80501d5b3c
commit fb96cdec76
5 changed files with 44 additions and 11 deletions

View File

@ -241,6 +241,13 @@ The author is Alessandro Ranellucci.
Set a different extrusion width for support material Set a different extrusion width for support material
--bridge-flow-ratio Multiplier for extrusion when bridging (> 0, default: 1) --bridge-flow-ratio Multiplier for extrusion when bridging (> 0, default: 1)
Multiple extruder options:
--perimeters-extruder
Extruder to use for perimeters (1+, default: 1)
--infill-extruder Extruder to use for infill (1+, default: 1)
--support-material-extruder
Extruder to use for support material (1+, default: 1)
If you want to change a preset file, just do If you want to change a preset file, just do

View File

@ -81,6 +81,11 @@ our $extrusion_multiplier = [1];
our $temperature = [200]; our $temperature = [200];
our $first_layer_temperature= []; our $first_layer_temperature= [];
# extruder mapping (1-based indexes)
our $perimeters_extruder = 1;
our $infill_extruder = 1;
our $support_material_extruder = 1;
# speed options # speed options
our $travel_speed = 130; # mm/s our $travel_speed = 130; # mm/s
our $perimeter_speed = 30; # mm/s our $perimeter_speed = 30; # mm/s
@ -134,7 +139,6 @@ our $support_material_threshold = 45;
our $support_material_pattern = 'rectilinear'; our $support_material_pattern = 'rectilinear';
our $support_material_spacing = 2.5; our $support_material_spacing = 2.5;
our $support_material_angle = 0; our $support_material_angle = 0;
our $support_material_extruder = 0;
our $start_gcode = "G28 ; home all axes"; our $start_gcode = "G28 ; home all axes";
our $end_gcode = <<"END"; our $end_gcode = <<"END";
M104 S0 ; turn off temperature M104 S0 ; turn off temperature

View File

@ -121,6 +121,23 @@ our $Options = {
deserialize => sub { [ split /,/, $_[0] ] }, deserialize => sub { [ split /,/, $_[0] ] },
}, },
# extruder mapping
'perimeters_extruder' => {
label => 'Perimeters extruder',
cli => 'perimeters-extruder=i',
type => 'i',
},
'infill_extruder' => {
label => 'Infill extruder',
cli => 'infill-extruder=i',
type => 'i',
},
'support_material_extruder' => {
label => 'Extruder',
cli => 'support-material-extruder=i',
type => 'i',
},
# filament options # filament options
'first_layer_bed_temperature' => { 'first_layer_bed_temperature' => {
label => 'First layer bed temperature (°C)', label => 'First layer bed temperature (°C)',
@ -329,11 +346,6 @@ our $Options = {
cli => 'support-material-angle=i', cli => 'support-material-angle=i',
type => 'i', type => 'i',
}, },
'support_material_extruder' => {
label => 'Extruder',
cli => 'support-material-extruder=i',
type => 'i',
},
'start_gcode' => { 'start_gcode' => {
label => 'Start G-code', label => 'Start G-code',
cli => 'start-gcode=s', cli => 'start-gcode=s',
@ -688,7 +700,7 @@ sub validate {
# initialize extruder(s) # initialize extruder(s)
$Slic3r::extruders = []; $Slic3r::extruders = [];
for my $t (0, $Slic3r::support_material_extruder-1) { for my $t (0, map $_-1, $Slic3r::perimeters_extruder, $Slic3r::infill_extruder, $Slic3r::support_material_extruder) {
$Slic3r::extruders->[$t] ||= Slic3r::Extruder->new( $Slic3r::extruders->[$t] ||= Slic3r::Extruder->new(
map { $_ => Slic3r::Config->get($_)->[$t] // Slic3r::Config->get($_)->[0] } #/ map { $_ => Slic3r::Config->get($_)->[$t] // Slic3r::Config->get($_)->[0] } #/
qw(nozzle_diameter filament_diameter extrusion_multiplier temperature first_layer_temperature) qw(nozzle_diameter filament_diameter extrusion_multiplier temperature first_layer_temperature)
@ -703,9 +715,11 @@ sub validate {
width => $Slic3r::first_layer_extrusion_width, width => $Slic3r::first_layer_extrusion_width,
); );
} }
$Slic3r::perimeters_flow = $Slic3r::extruders->[0]->make_flow(width => $Slic3r::perimeters_extrusion_width || $Slic3r::extrusion_width); $Slic3r::perimeters_flow = $Slic3r::extruders->[ $Slic3r::perimeters_extruder-1 ]
$Slic3r::infill_flow = $Slic3r::extruders->[0]->make_flow(width => $Slic3r::infill_extrusion_width || $Slic3r::extrusion_width); ->make_flow(width => $Slic3r::perimeters_extrusion_width || $Slic3r::extrusion_width);
$Slic3r::support_material_flow = $Slic3r::extruders->[ $Slic3r::support_material_extruder ] $Slic3r::infill_flow = $Slic3r::extruders->[ $Slic3r::infill_extruder-1 ]
->make_flow(width => $Slic3r::infill_extrusion_width || $Slic3r::extrusion_width);
$Slic3r::support_material_flow = $Slic3r::extruders->[ $Slic3r::support_material_extruder-1 ]
->make_flow(width => $Slic3r::support_material_extrusion_width || $Slic3r::extrusion_width); ->make_flow(width => $Slic3r::support_material_extrusion_width || $Slic3r::extrusion_width);
Slic3r::debugf "Default flow width = %s, spacing = %s, min_spacing = %s\n", Slic3r::debugf "Default flow width = %s, spacing = %s, min_spacing = %s\n",

View File

@ -596,9 +596,11 @@ sub write_gcode {
$gcodegen->shift_y($shift[Y] + unscale $copy->[Y]); $gcodegen->shift_y($shift[Y] + unscale $copy->[Y]);
# extrude perimeters # extrude perimeters
$gcode .= $gcodegen->set_tool($Slic3r::perimeters_extruder-1);
$gcode .= $gcodegen->extrude($_, 'perimeter') for @{ $layer->perimeters }; $gcode .= $gcodegen->extrude($_, 'perimeter') for @{ $layer->perimeters };
# extrude fills # extrude fills
$gcode .= $gcodegen->set_tool($Slic3r::infill_extruder-1);
$gcode .= $gcodegen->set_acceleration($Slic3r::infill_acceleration); $gcode .= $gcodegen->set_acceleration($Slic3r::infill_acceleration);
for my $fill (@{ $layer->fills }) { for my $fill (@{ $layer->fills }) {
$gcode .= $gcodegen->extrude_path($_, 'fill') $gcode .= $gcodegen->extrude_path($_, 'fill')
@ -610,7 +612,6 @@ sub write_gcode {
$gcode .= $gcodegen->set_tool($Slic3r::support_material_extruder-1); $gcode .= $gcodegen->set_tool($Slic3r::support_material_extruder-1);
$gcode .= $gcodegen->extrude_path($_, 'support material') $gcode .= $gcodegen->extrude_path($_, 'support material')
for $layer->support_fills->shortest_path($gcodegen->last_pos); for $layer->support_fills->shortest_path($gcodegen->last_pos);
$gcode .= $gcodegen->set_tool(0);
} }
} }
return if !$gcode; return if !$gcode;

View File

@ -286,6 +286,13 @@ $j
Set a different extrusion width for support material Set a different extrusion width for support material
--bridge-flow-ratio Multiplier for extrusion when bridging (> 0, default: $Slic3r::bridge_flow_ratio) --bridge-flow-ratio Multiplier for extrusion when bridging (> 0, default: $Slic3r::bridge_flow_ratio)
Multiple extruder options:
--perimeters-extruder
Extruder to use for perimeters (1+, default: 1)
--infill-extruder Extruder to use for infill (1+, default: 1)
--support-material-extruder
Extruder to use for support material (1+, default: 1)
EOF EOF
exit ($exit_code || 0); exit ($exit_code || 0);
} }