Fix wipe tower initial movement when switching extruder offsets (#9222)

Fix wipe tower initial movement when switching extruder offsets (SoftFever/OrcaSlicer#9214)
This commit is contained in:
Noisyfox 2025-04-13 17:38:29 +08:00 committed by GitHub
parent 443034553b
commit 97ec03692c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -835,7 +835,8 @@ static std::vector<Vec2d> 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<Vec2d> 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();