Finish the retraction after a wipe on Hilbert curve surfaces

A wipe retracts only part of the length and leaves the rest, including
retract_after_wipe, to the regular retraction that follows. On the first
layer with Hilbert curve bottom surfaces, and on Hilbert curve top
surfaces, that retraction is skipped, so the rest was silently dropped.
Always finish the retraction once a wipe has started it.

Ported from Snapmaker/OrcaSlicer@b070bcfaff

Co-authored-by: lhx <luohaoxuan@snapmaker.com>
This commit is contained in:
Ian Bassiandlhx committed 2026-11-30 14:27:08 -03:00
1 parent 2be8e9e955
commit f564ce39c4
2 files changed
+53 -3

No files matched your search

+6 -3
View File
@@ -10967,7 +10967,8 @@ std::string GCode::retract(bool toolchange, bool is_last_retraction, LiftType li
return gcode;
// wipe (if it's enabled for this extruder and we have a stored wipe path and no-zero wipe distance)
if (FILAMENT_CONFIG(wipe) && m_wipe.has_path() && scale_(FILAMENT_CONFIG(wipe_distance)) > SCALED_EPSILON) {
const bool wiped = FILAMENT_CONFIG(wipe) && m_wipe.has_path() && scale_(FILAMENT_CONFIG(wipe_distance)) > SCALED_EPSILON;
if (wiped) {
Wipe::RetractionValues wipeRetractions = m_wipe.calculateWipeRetractionLengths(*this, toolchange);
gcode += toolchange ? m_writer.retract_for_toolchange(true, wipeRetractions.retraction_length_before_wipe) :
m_writer.retract(true, wipeRetractions.retraction_length_before_wipe);
@@ -10981,8 +10982,10 @@ std::string GCode::retract(bool toolchange, bool is_last_retraction, LiftType li
(the extruder might be already retracted fully or partially). We call these
methods even if we performed wipe, since this will ensure the entire retraction
length is honored in case wipe path was too short. */
if ((!this->on_first_layer() || this->config().bottom_surface_pattern != InfillPattern::ipHilbertCurve) &&
(role != erTopSolidInfill || this->config().top_surface_pattern != InfillPattern::ipHilbertCurve))
// Hilbert curve surfaces skip the retraction, but not the rest of one a wipe has started.
if (wiped ||
((!this->on_first_layer() || this->config().bottom_surface_pattern != InfillPattern::ipHilbertCurve) &&
(role != erTopSolidInfill || this->config().top_surface_pattern != InfillPattern::ipHilbertCurve)))
gcode += toolchange ? m_writer.retract_for_toolchange() : m_writer.retract();
gcode += m_writer.reset_e();