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

@ -240,6 +240,13 @@ The author is Alessandro Ranellucci.
--support-material-extrusion-width
Set a different extrusion width for support material
--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)

View File

@ -81,6 +81,11 @@ our $extrusion_multiplier = [1];
our $temperature = [200];
our $first_layer_temperature= [];
# extruder mapping (1-based indexes)
our $perimeters_extruder = 1;
our $infill_extruder = 1;
our $support_material_extruder = 1;
# speed options
our $travel_speed = 130; # 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_spacing = 2.5;
our $support_material_angle = 0;
our $support_material_extruder = 0;
our $start_gcode = "G28 ; home all axes";
our $end_gcode = <<"END";
M104 S0 ; turn off temperature

View File

@ -121,6 +121,23 @@ our $Options = {
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
'first_layer_bed_temperature' => {
label => 'First layer bed temperature (°C)',
@ -329,11 +346,6 @@ our $Options = {
cli => 'support-material-angle=i',
type => 'i',
},
'support_material_extruder' => {
label => 'Extruder',
cli => 'support-material-extruder=i',
type => 'i',
},
'start_gcode' => {
label => 'Start G-code',
cli => 'start-gcode=s',
@ -688,7 +700,7 @@ sub validate {
# initialize extruder(s)
$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(
map { $_ => Slic3r::Config->get($_)->[$t] // Slic3r::Config->get($_)->[0] } #/
qw(nozzle_diameter filament_diameter extrusion_multiplier temperature first_layer_temperature)
@ -703,9 +715,11 @@ sub validate {
width => $Slic3r::first_layer_extrusion_width,
);
}
$Slic3r::perimeters_flow = $Slic3r::extruders->[0]->make_flow(width => $Slic3r::perimeters_extrusion_width || $Slic3r::extrusion_width);
$Slic3r::infill_flow = $Slic3r::extruders->[0]->make_flow(width => $Slic3r::infill_extrusion_width || $Slic3r::extrusion_width);
$Slic3r::support_material_flow = $Slic3r::extruders->[ $Slic3r::support_material_extruder ]
$Slic3r::perimeters_flow = $Slic3r::extruders->[ $Slic3r::perimeters_extruder-1 ]
->make_flow(width => $Slic3r::perimeters_extrusion_width || $Slic3r::extrusion_width);
$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);
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]);
# extrude perimeters
$gcode .= $gcodegen->set_tool($Slic3r::perimeters_extruder-1);
$gcode .= $gcodegen->extrude($_, 'perimeter') for @{ $layer->perimeters };
# extrude fills
$gcode .= $gcodegen->set_tool($Slic3r::infill_extruder-1);
$gcode .= $gcodegen->set_acceleration($Slic3r::infill_acceleration);
for my $fill (@{ $layer->fills }) {
$gcode .= $gcodegen->extrude_path($_, 'fill')
@ -610,7 +612,6 @@ sub write_gcode {
$gcode .= $gcodegen->set_tool($Slic3r::support_material_extruder-1);
$gcode .= $gcodegen->extrude_path($_, 'support material')
for $layer->support_fills->shortest_path($gcodegen->last_pos);
$gcode .= $gcodegen->set_tool(0);
}
}
return if !$gcode;

View File

@ -285,6 +285,13 @@ $j
--support-material-extrusion-width
Set a different extrusion width for support material
--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
exit ($exit_code || 0);