ENH: add layer num in filament end GCode

jira: NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I6f81b86a7b7391048d70f2c4839733a69015e53b
(cherry picked from commit aafcfd72f40dd221286b757da9d494498d36374c)
This commit is contained in:
xun.zhang 2025-03-20 16:09:43 +08:00 committed by Noisyfox
parent cd16bd83a3
commit a0f38f3cfd

View file

@ -698,7 +698,9 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
unsigned int old_filament_id = gcodegen.writer().filament()->id();
const std::string& filament_end_gcode = gcodegen.config().filament_end_gcode.get_at(old_filament_id);
if (gcodegen.writer().filament() != nullptr && !filament_end_gcode.empty()) {
end_filament_gcode_str = gcodegen.placeholder_parser_process("filament_end_gcode", filament_end_gcode, old_filament_id);
DynamicConfig config;
config.set_key_value("layer_num", new ConfigOptionInt(gcodegen.m_layer_index));
end_filament_gcode_str = gcodegen.placeholder_parser_process("filament_end_gcode", filament_end_gcode, old_filament_id, &config);
check_add_eol(end_filament_gcode_str);
}
}