From cf3b9922693caaf3337a241d3fcc45ac7fb984a7 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 6 May 2019 14:48:59 +0200 Subject: [PATCH] GCode.cpp: Update the 'current_extruder' placeholder even if filament start gcode is empty --- src/libslic3r/GCode.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index bf1d24e8a..8e48a56d6 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -201,12 +201,13 @@ std::string WipeTowerIntegration::append_tcr(GCode &gcodegen, const WipeTower::T // Let the m_writer know the current extruder_id, but ignore the generated G-code. if (new_extruder_id >= 0 && gcodegen.writer().need_toolchange(new_extruder_id)) gcodegen.writer().toolchange(new_extruder_id); + gcodegen.placeholder_parser().set("current_extruder", new_extruder_id); + // Always append the filament start G-code even if the extruder did not switch, // because the wipe tower resets the linear advance and we want it to be re-enabled. const std::string &start_filament_gcode = gcodegen.config().start_filament_gcode.get_at(new_extruder_id); if (! start_filament_gcode.empty()) { // Process the start_filament_gcode for the active filament only. - gcodegen.placeholder_parser().set("current_extruder", new_extruder_id); DynamicConfig config; config.set_key_value("filament_extruder_id", new ConfigOptionInt(new_extruder_id)); gcode += gcodegen.placeholder_parser_process("start_filament_gcode", start_filament_gcode, new_extruder_id, &config);