diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 219f6dbe3..b1ef5abf5 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -583,9 +583,9 @@ static std::vector 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); - auto transform_wt_pt = [&alpha, this](const Vec2f& pt) -> Vec2f { + auto transform_wt_pt = [&alpha, this](const Vec2f& pt,bool rib_offset=true) -> Vec2f { Vec2f out = Eigen::Rotation2Df(alpha) * pt; - out += m_wipe_tower_pos + m_rib_offset; + out += m_wipe_tower_pos + (rib_offset? m_rib_offset:Vec2f(0.f,0.f)); return out; }; @@ -824,7 +824,7 @@ static std::vector get_path_of_change_filament(const Print& print) avoid_bbx = scaled(m_wipe_tower_bbx); Polygon avoid_points = avoid_bbx.polygon(); for (auto& p : avoid_points.points) { - Vec2f pp = transform_wt_pt(unscale(p).cast()); + Vec2f pp = transform_wt_pt(unscale(p).cast(),false); p = wipe_tower_point_to_object_point(gcodegen, pp + plate_origin_2d); } avoid_bbx = BoundingBox(avoid_points.points); diff --git a/src/libslic3r/GCode/WipeTower.hpp b/src/libslic3r/GCode/WipeTower.hpp index ca4c73a6c..aa32b231b 100644 --- a/src/libslic3r/GCode/WipeTower.hpp +++ b/src/libslic3r/GCode/WipeTower.hpp @@ -190,6 +190,7 @@ public: BoundingBoxf get_bbx() const { BoundingBox box = get_extents(m_outer_wall.front()); BoundingBoxf res = BoundingBoxf(unscale(box.min), unscale(box.max)); + res.translate(m_rib_offset.cast()); return res; } Polylines get_outer_wall() const { diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 2fc8d64e9..d4e2658f2 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -2287,9 +2287,9 @@ std::vector Print::first_layer_wipe_tower_corners(bool check_wipe_tower_e if (check_wipe_tower_existance && (!has_wipe_tower() || m_wipe_tower_data.tool_changes.empty())) return corners; { - double width = m_config.prime_tower_width + 2*m_wipe_tower_data.brim_width; - double depth = m_wipe_tower_data.depth + 2*m_wipe_tower_data.brim_width; - Vec2d pt0(-m_wipe_tower_data.brim_width, -m_wipe_tower_data.brim_width); + double width = m_wipe_tower_data.bbx.max.x() - m_wipe_tower_data.bbx.min.x(); + double depth = m_wipe_tower_data.bbx.max.y() -m_wipe_tower_data.bbx.min.y(); + Vec2d pt0 = m_wipe_tower_data.bbx.min; for (Vec2d pt : { pt0, Vec2d(pt0.x()+width, pt0.y() ),