From 1a0fc94c3b6586d4487719e13391924e85ae0cdc Mon Sep 17 00:00:00 2001 From: Nick Neisen Date: Wed, 4 Sep 2019 12:10:14 -0600 Subject: [PATCH] Set the current_extruder value for the GUI --- lib/Slic3r/Print/GCode.pm | 6 +++--- xs/src/libslic3r/PrintGCode.cpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index bc0cd9df4..a54c19f8f 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -142,6 +142,9 @@ sub export { # disable fan print $fh $gcodegen->writer->set_fan(0, 1) if $self->config->cooling && $self->config->disable_fan_first_layers; + + # set initial extruder so it can be used in start G-code + print $fh $gcodegen->set_extruder($self->print->extruders->[0]); # set bed temperature if ($self->config->has_heatbed && (my $temp = $self->config->first_layer_bed_temperature) && $self->config->start_gcode !~ /M(?:190|140)/i) { @@ -223,9 +226,6 @@ sub export { } } - # set initial extruder only after custom start G-code - print $fh $gcodegen->set_extruder($self->print->extruders->[0]); - # do all objects for each layer if ($self->config->complete_objects) { # print objects from the smallest to the tallest to avoid collisions diff --git a/xs/src/libslic3r/PrintGCode.cpp b/xs/src/libslic3r/PrintGCode.cpp index 17dc1aa17..83200bd9c 100644 --- a/xs/src/libslic3r/PrintGCode.cpp +++ b/xs/src/libslic3r/PrintGCode.cpp @@ -102,6 +102,7 @@ PrintGCode::output() fh << _gcodegen.writer.set_fan(0,1) << "\n"; } + // set initial extruder so it can be used in start G-code const auto extruders = _print.extruders(); fh << _gcodegen.set_extruder( *(extruders.begin()) );