Always emit T0 at the beginning of a multi-extruder print

This commit is contained in:
Alessandro Ranellucci 2012-08-22 19:20:34 +02:00
parent 9e682924c7
commit 4bddb66513
2 changed files with 5 additions and 4 deletions

View file

@ -10,7 +10,7 @@ has 'shift_y' => (is => 'rw', default => sub {0} );
has 'z' => (is => 'rw', default => sub {0} );
has 'speed' => (is => 'rw');
has 'extruder_idx' => (is => 'rw', default => sub {0});
has 'extruder_idx' => (is => 'rw');
has 'extrusion_distance' => (is => 'rw', default => sub {0} );
has 'elapsed_time' => (is => 'rw', default => sub {0} ); # seconds
has 'total_extrusion_length' => (is => 'rw', default => sub {0} );
@ -378,9 +378,10 @@ sub set_tool {
my $self = shift;
my ($tool) = @_;
return "" if $self->extruder_idx == $tool;
return "" if (defined $self->extruder_idx) && ($self->extruder_idx == $tool);
$self->extruder_idx($tool);
return "" if @{$Slic3r::extruders} == 1;
return $self->retract(toolchange => 1)
. (sprintf "T%d%s\n", $tool, ($Slic3r::Config->gcode_comments ? ' ; change tool' : ''))
. $self->reset_e;

View file

@ -566,7 +566,7 @@ sub write_gcode {
my $gcodegen = Slic3r::GCode->new;
my $min_print_speed = 60 * $Slic3r::Config->min_print_speed;
my $dec = $gcodegen->dec;
print $fh $gcodegen->set_tool(0) if @$Slic3r::extruders > 1;
print $fh $gcodegen->set_tool(0);
print $fh $gcodegen->set_fan(0, 1) if $Slic3r::Config->cooling && $Slic3r::Config->disable_fan_first_layers;
# this spits out some platic at start from the first extruder