From 97ec03692c3b5d7f060897f54b5d2fe21de08779 Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Sun, 13 Apr 2025 17:38:29 +0800 Subject: [PATCH] Fix wipe tower initial movement when switching extruder offsets (#9222) Fix wipe tower initial movement when switching extruder offsets (SoftFever/OrcaSlicer#9214) --- src/libslic3r/GCode.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 6a99d3f15f..e6c39a772d 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -835,7 +835,8 @@ static std::vector get_path_of_change_filament(const Print& print) std::string gcode_out; std::string line; Vec2f pos = tcr.start_pos; - Vec2f transformed_pos = pos; + auto trans_pos = [wt_rot = Eigen::Rotation2Df(angle), &translation](const Vec2f& p) -> Vec2f { return wt_rot * p + translation; }; + Vec2f transformed_pos = trans_pos(pos); Vec2f old_pos(-1000.1f, -1000.1f); while (gcode_str) { @@ -863,7 +864,7 @@ static std::vector get_path_of_change_filament(const Print& print) line_out << ch; } - transformed_pos = Eigen::Rotation2Df(angle) * pos + translation; + transformed_pos = trans_pos(pos); if (transformed_pos != old_pos || never_skip) { line = line_out.str();