Skip to content

Commit

Permalink
prusa3d#13420 Separate XYZ compound moves into separate XY, Z moves f…
Browse files Browse the repository at this point in the history
…or Snapmaker 2.0
  • Loading branch information
jalapenopuzzle committed Oct 9, 2024
1 parent 8eeeb09 commit 85332f6
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/libslic3r/GCode/GCodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 85332f6

Please sign in to comment.