From 95ce474c8d846d6c80cf6f98078a5b91b6c8db9b Mon Sep 17 00:00:00 2001 From: Kiss Lorand <50251547+kisslorand@users.noreply.github.com> Date: Thu, 23 Apr 2026 18:50:28 +0300 Subject: [PATCH] Fix extrusion of some support layers at wrong Z height (#13327) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In some rare support edge cases, Orca could start extruding a new layer before moving to the correct Z height. This happened when two support layers were generated back-to-back and the next layer started exactly where the previous one ended. In that situation, there was no movement that naturally updated the Z position first. The code was clearing the “pending layer change” flag too early, so it lost track of the fact that a Z move was still required. This change ensures that if a layer change is still pending, Orca will always move to the correct Z height before the first extrusion of that layer. This guarantees that every layer starts at the correct height and fixes the missing / incorrect support layers seen in those edge cases. --- src/libslic3r/GCode.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 333b9b842a..392f58fc48 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -6199,11 +6199,13 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, "move to first " + description + " point", sloped == nullptr ? DBL_MAX : get_sloped_z(sloped->slope_begin.z_ratio) ); - m_need_change_layer_lift_z = false; // Orca: ensure Z matches planned layer height - if (_last_pos_undefined && !slope_need_z_travel) { - gcode += this->writer().travel_to_z(m_nominal_z, "ensure Z matches planned layer height", true); + if (!slope_need_z_travel && (_last_pos_undefined || m_need_change_layer_lift_z)) { + const std::string z_sync_comment = _last_pos_undefined ? + "ensure Z matches planned layer height" : ""; // no comment for normal layer-Z lift + gcode += this->writer().travel_to_z(m_nominal_z, z_sync_comment, true); } + m_need_change_layer_lift_z = false; }