mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
Fix wrong z when zhop is diabled.
This commit is contained in:
parent
6f3c701a32
commit
608e6375e6
3 changed files with 11 additions and 14 deletions
|
@ -729,7 +729,6 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
|
|||
gcode += gcodegen.writer().unlift(); // Make sure there is no z-hop (in most cases, there isn't).
|
||||
|
||||
double current_z = gcodegen.writer().get_position().z();
|
||||
gcode += gcodegen.writer().travel_to_z(current_z);
|
||||
|
||||
|
||||
if (z == -1.) // in case no specific z was provided, print at current_z pos
|
||||
|
@ -6006,14 +6005,15 @@ std::string GCode::travel_to(const Point& point, ExtrusionRole role, std::string
|
|||
if (m_spiral_vase) {
|
||||
// No lazy z lift for spiral vase mode
|
||||
for (size_t i = 1; i < travel.size(); ++i) {
|
||||
gcode += m_writer.travel_to_xy(this->point_to_gcode(travel.points[i]), comment + " travel_to_xy");
|
||||
gcode += m_writer.travel_to_xy(this->point_to_gcode(travel.points[i]), comment);
|
||||
}
|
||||
} else {
|
||||
if (travel.size() == 2) {
|
||||
// No extra movements emitted by avoid_crossing_perimeters, simply move to the end point with z change
|
||||
const auto& dest2d = this->point_to_gcode(travel.points.back());
|
||||
Vec3d dest3d(dest2d(0), dest2d(1), z == DBL_MAX ? m_writer.get_position().z() : z);
|
||||
gcode += m_writer.travel_to_xyz(dest3d, comment + " travel_to_xyz");
|
||||
gcode += m_writer.travel_to_xyz(dest3d, comment, m_need_change_layer_lift_z);
|
||||
m_need_change_layer_lift_z = false;
|
||||
} else {
|
||||
// Extra movements emitted by avoid_crossing_perimeters, lift the z to normal height at the beginning, then apply the z
|
||||
// ratio at the last point
|
||||
|
@ -6022,25 +6022,22 @@ std::string GCode::travel_to(const Point& point, ExtrusionRole role, std::string
|
|||
// Lift to normal z at beginning
|
||||
Vec2d dest2d = this->point_to_gcode(travel.points[i]);
|
||||
Vec3d dest3d(dest2d(0), dest2d(1), m_writer.get_position().z());
|
||||
gcode += m_writer.travel_to_xyz(dest3d, comment + " travel_to_xyz");
|
||||
gcode += m_writer.travel_to_xyz(dest3d, comment, m_need_change_layer_lift_z);
|
||||
m_need_change_layer_lift_z = false;
|
||||
} else if (z != DBL_MAX && i == travel.size() - 1) {
|
||||
// Apply z_ratio for the very last point
|
||||
Vec2d dest2d = this->point_to_gcode(travel.points[i]);
|
||||
Vec3d dest3d(dest2d(0), dest2d(1), z);
|
||||
gcode += m_writer.travel_to_xyz(dest3d, comment + " travel_to_xyz");
|
||||
gcode += m_writer.travel_to_xyz(dest3d, comment);
|
||||
} else {
|
||||
// For all points in between, no z change
|
||||
gcode += m_writer.travel_to_xy(this->point_to_gcode(travel.points[i]), comment + " travel_to_xy");
|
||||
gcode += m_writer.travel_to_xy(this->point_to_gcode(travel.points[i]), comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this->set_last_pos(travel.points.back());
|
||||
}
|
||||
if (m_need_change_layer_lift_z) {
|
||||
gcode += m_writer._travel_to_z(m_writer.get_position().z(), comment + " travel_to_z");
|
||||
m_need_change_layer_lift_z = false;
|
||||
}
|
||||
|
||||
return gcode;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue