FIX: fix the error wipe path

jira: none
Change-Id: I34af54711531b208049cbbc3883bca92328b9b5a
(cherry picked from commit da3819f52f5454075342e8565fe9020773aa25ef)
This commit is contained in:
zhimin.zeng 2025-03-20 15:16:33 +08:00 committed by Noisyfox
parent eb8eb5efd1
commit e011b54d3f

View file

@ -742,6 +742,8 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
end_filament_gcode_str = nozzle_change_gcode_trans + end_filament_gcode_str;
}
end_filament_gcode_str = toolchange_retract_str + end_filament_gcode_str;
if (! change_filament_gcode.empty()) {
DynamicConfig config;
int old_filament_id = gcodegen.writer().filament() ? (int)gcodegen.writer().filament()->id() : -1;
@ -906,8 +908,6 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
std::string toolchange_unretract_str = gcodegen.unretract();
check_add_eol(toolchange_unretract_str);
toolchange_gcode_str = toolchange_retract_str + toolchange_gcode_str + toolchange_unretract_str;
gcodegen.placeholder_parser().set("current_extruder", new_filament_id);
gcodegen.placeholder_parser().set("retraction_distance_when_cut", gcodegen.m_config.retraction_distances_when_cut.get_at(new_filament_id));
gcodegen.placeholder_parser().set("long_retraction_when_cut", gcodegen.m_config.long_retractions_when_cut.get_at(new_filament_id));
@ -923,6 +923,8 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
check_add_eol(start_filament_gcode_str);
}
start_filament_gcode_str = start_filament_gcode_str + toolchange_unretract_str;
// Insert the end filament, toolchange, and start filament gcode into the generated gcode.
DynamicConfig config;
config.set_key_value("filament_end_gcode", new ConfigOptionString(end_filament_gcode_str));