From cf6d9c77ff5013276962a4eae47b1ce1431d067a Mon Sep 17 00:00:00 2001 From: Fritz Webering Date: Sun, 27 Oct 2024 15:24:49 +0100 Subject: [PATCH] Avoid collisions when moving Z down (#7208) Avoid collisions with previous extrusions in the same layer when moving Z down in an XYZ move. This happens for example when starting a scarf joint after another perimeter was already printed. Fixes SoftFever#7191 Co-authored-by: SoftFever --- src/libslic3r/GCodeWriter.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libslic3r/GCodeWriter.cpp b/src/libslic3r/GCodeWriter.cpp index d17527d11..aaef83b7a 100644 --- a/src/libslic3r/GCodeWriter.cpp +++ b/src/libslic3r/GCodeWriter.cpp @@ -447,6 +447,12 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co // this function, fix it first. //std::terminate(); + // Orca: If moving down during below the current layer nominal Z, force XY->Z moves to avoid collisions with previous extrusions + double nominal_z = m_pos(2) - m_lifted; + if (point(2) < nominal_z - EPSILON) { // EPSILON to avoid false matches due to rounding errors + this->set_current_position_clear(false); // This forces XYZ moves to be split into XY->Z + } + /* If target Z is lower than current Z but higher than nominal Z we don't perform the Z move but we only move in the XY plane and adjust the nominal Z by reducing the lift amount that will be