Complete the rib wipe tower port in WipeTower2

The rib tower is now always square (prime_tower_width is ignored, as the
GUI already implies), carries the rib origin offset like the BBL tower so
the rib tips sit inside the configured position, clamps the rib length to
the tower diagonal, and extends the ribs for short towers.
This commit is contained in:
SoftFever
2026-07-27 03:07:07 +08:00
parent 5792fef805
commit 466c36eaa3
5 changed files with 66 additions and 20 deletions

View File

@@ -1422,8 +1422,10 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
// We want to rotate and shift all extrusions (gcode postprocessing) and starting and ending position
float alpha = m_wipe_tower_rotation / 180.f * float(M_PI);
// The rib-wall offset is tower-local, so it rotates with the tower (unlike the BBL
// tower in append_tcr, which never rotates). Priming lines are absolute bed moves.
auto transform_wt_pt = [&alpha, this](const Vec2f &pt) -> Vec2f {
Vec2f out = Eigen::Rotation2Df(alpha) * pt;
Vec2f out = Eigen::Rotation2Df(alpha) * (pt + m_rib_offset);
out += m_wipe_tower_pos;
return out;
};
@@ -1435,7 +1437,7 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
end_pos = transform_wt_pt(end_pos);
}
Vec2f wipe_tower_offset = tcr.priming ? Vec2f::Zero() : m_wipe_tower_pos;
Vec2f wipe_tower_offset = tcr.priming ? Vec2f::Zero() : Vec2f(m_wipe_tower_pos + Eigen::Rotation2Df(alpha) * m_rib_offset);
float wipe_tower_rotation = tcr.priming ? 0.f : alpha;
Vec2f plate_origin_2d(m_plate_origin(0), m_plate_origin(1));