From 7fb1bc2c16e880a7e357031185c4cdd9ed225bd9 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 6 Jan 2023 01:49:04 +0100 Subject: [PATCH] Placeholders 'layer_num', 'layer_z' and 'max_layer_z' were not accessible in fil. start gcode when the wipe tower was off --- src/libslic3r/GCode.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 47bd6df40..13b21174a 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -3192,6 +3192,9 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z) if (! start_filament_gcode.empty()) { // Process the start_filament_gcode for the filament. DynamicConfig config; + config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); + config.set_key_value("layer_z", new ConfigOptionFloat(this->writer().get_position()(2) - m_config.z_offset.value)); + config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); config.set_key_value("filament_extruder_id", new ConfigOptionInt(int(extruder_id))); gcode += this->placeholder_parser_process("start_filament_gcode", start_filament_gcode, extruder_id, &config); check_add_eol(gcode); @@ -3263,6 +3266,9 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z) if (! start_filament_gcode.empty()) { // Process the start_filament_gcode for the new filament. DynamicConfig config; + config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); + config.set_key_value("layer_z", new ConfigOptionFloat(this->writer().get_position()(2) - m_config.z_offset.value)); + config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); config.set_key_value("filament_extruder_id", new ConfigOptionInt(int(extruder_id))); gcode += this->placeholder_parser_process("start_filament_gcode", start_filament_gcode, extruder_id, &config); check_add_eol(gcode);