diff --git a/src/libslic3r/GCode/Wipe.cpp b/src/libslic3r/GCode/Wipe.cpp index fd7cacd0bf..e75c599297 100644 --- a/src/libslic3r/GCode/Wipe.cpp +++ b/src/libslic3r/GCode/Wipe.cpp @@ -21,9 +21,9 @@ void Wipe::init(const PrintConfig &config, const std::vector &extr if (config.wipe.get_at(id)) { // Wipe length to extrusion ratio. const double xy_to_e = this->calc_xy_to_e_ratio(config, id); - wipe_xy = std::max(wipe_xy, xy_to_e * config.retract_length.get_at(id)); + wipe_xy = std::max(wipe_xy, config.retract_length.get_at(id) / xy_to_e); if (multimaterial) - wipe_xy = std::max(wipe_xy, xy_to_e * config.retract_length_toolchange.get_at(id)); + wipe_xy = std::max(wipe_xy, config.retract_length_toolchange.get_at(id) / xy_to_e); } if (wipe_xy == 0) @@ -37,11 +37,11 @@ void Wipe::set_path(SmoothPath &&path, bool reversed) this->reset_path(); if (this->enabled() && ! path.empty()) { - if (reversed) { + if (coord_t wipe_len_max_scaled = scaled(m_wipe_len_max); reversed) { m_path = std::move(path.back().path); Geometry::ArcWelder::reverse(m_path); int64_t len = Geometry::ArcWelder::estimate_path_length(m_path); - for (auto it = std::next(path.rbegin()); len < m_wipe_len_max && it != path.rend(); ++ it) { + for (auto it = std::next(path.rbegin()); len < wipe_len_max_scaled && it != path.rend(); ++ it) { if (it->path_attributes.role.is_bridge()) break; // Do not perform a wipe on bridges. assert(it->path.size() >= 2); @@ -55,7 +55,7 @@ void Wipe::set_path(SmoothPath &&path, bool reversed) } else { m_path = std::move(path.front().path); int64_t len = Geometry::ArcWelder::estimate_path_length(m_path); - for (auto it = std::next(path.begin()); len < m_wipe_len_max && it != path.end(); ++ it) { + for (auto it = std::next(path.begin()); len < wipe_len_max_scaled && it != path.end(); ++ it) { if (it->path_attributes.role.is_bridge()) break; // Do not perform a wipe on bridges. assert(it->path.size() >= 2);