diff --git a/lib/Slic3r/GCode/Layer.pm b/lib/Slic3r/GCode/Layer.pm index 3aeb80de4..635f7934b 100644 --- a/lib/Slic3r/GCode/Layer.pm +++ b/lib/Slic3r/GCode/Layer.pm @@ -90,7 +90,8 @@ sub process_layer { # when printing layers > 0 ignore 'min_skirt_length' and # just use the 'skirts' setting; also just use the current extruder last if ($layer->id > 0) && ($i >= $self->print->config->skirts); - $gcode .= $self->gcodegen->set_extruder(($i/@extruder_ids) % @extruder_ids) + my $extruder_id = $extruder_ids[($i/@extruder_ids) % @extruder_ids]; + $gcode .= $self->gcodegen->set_extruder($extruder_id) if $layer->id == 0; $gcode .= $self->gcodegen->extrude_loop($skirt_loops[$i], 'skirt'); } diff --git a/t/multi.t b/t/multi.t index cf1885837..c835400cc 100644 --- a/t/multi.t +++ b/t/multi.t @@ -1,4 +1,4 @@ -use Test::More tests => 6; +use Test::More tests => 7; use strict; use warnings; @@ -66,6 +66,17 @@ use Slic3r::Test; ok Slic3r::Test::gcode($print), 'no errors when using non-consecutive extruders'; } +{ + my $config = Slic3r::Config->new_from_defaults; + $config->set('perimeter_extruder', 2); + $config->set('infill_extruder', 2); + $config->set('support_material_extruder', 2); + $config->set('support_material_interface_extruder', 2); + + my $print = Slic3r::Test::init_print('20mm_cube', config => $config); + ok Slic3r::Test::gcode($print), 'no errors when using multiple skirts with a single, non-zero, extruder'; +} + { my $model = Slic3r::Model->new; my $object = $model->add_object;