From 85332f6a0106293323ba1589dacca1c60e8b1507 Mon Sep 17 00:00:00 2001 From: jalapenopuzzle <8386278+jalapenopuzzle@users.noreply.github.com> Date: Wed, 9 Oct 2024 22:58:44 +1100 Subject: [PATCH] #13420 Separate XYZ compound moves into separate XY, Z moves for Snapmaker 2.0 --- src/libslic3r/GCode/GCodeWriter.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/GCode/GCodeWriter.cpp b/src/libslic3r/GCode/GCodeWriter.cpp index 8a6e5440bc5..94b0e9257d0 100644 --- a/src/libslic3r/GCode/GCodeWriter.cpp +++ b/src/libslic3r/GCode/GCodeWriter.cpp @@ -335,7 +335,24 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d& from, const Vec3d &to, const return this->travel_to_xy(to.head<2>(), comment); } else { m_pos = to; - return this->get_travel_to_xyz_gcode(from, to, comment); + // This is needed by Snapmaker 2.0 + // This is a PROOF OF CONCEPT fix only. + bool separate_z = true; + if (separate_z) { + std::string result; + if (to.z() > from.z()) { + // Move up first + result += this->travel_to_z(to.z(), comment); + result += this->travel_to_xy(to.head<2>(), comment); + } else { + // Move down last + result += this->travel_to_xy(to.head<2>(), comment); + result += this->travel_to_z(to.z(), comment); + } + return result; + } else { + return this->get_travel_to_xyz_gcode(from, to, comment); + } } }