From 576a86d4498a181ffec9b30088c09600f61be7f0 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 10 Dec 2017 15:10:03 -0600 Subject: [PATCH] Consider filament start gcode when deciding whether or not to prepend heating gcode. Fixes #4223. --- lib/Slic3r/Print/GCode.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index 76275cc59..925f4b125 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -149,14 +149,18 @@ sub export { } # set extruder(s) temperature before and after start G-code + my $include_start_extruder_temp = $self->config->start_gcode !~ /M(?:109|104)/i; + foreach my $start_gcode (@{ $self->config->start_filament_gcode }) { # process filament gcode in order + $include_start_extruder_temp = $include_start_extruder_temp && ($start_gcode !~ /M(?:109|104)/i); + } $self->_print_first_layer_temperature(0) - if $self->config->start_gcode !~ /M(?:109|104)/i; + if $include_start_extruder_temp; printf $fh "%s\n", Slic3r::ConditionalGCode::apply_math($gcodegen->placeholder_parser->process($self->config->start_gcode)); foreach my $start_gcode (@{ $self->config->start_filament_gcode }) { # process filament gcode in order printf $fh "%s\n", $gcodegen->placeholder_parser->process($start_gcode); } $self->_print_first_layer_temperature(1) - if $self->config->start_gcode !~ /M(?:109|104)/i; + if $include_start_extruder_temp; # set other general things print $fh $gcodegen->preamble;