Skip to content

Commit

Permalink
force restore Z
Browse files Browse the repository at this point in the history
  • Loading branch information
SoftFever committed Jul 21, 2024
1 parent 447cc01 commit 13ddb38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,13 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
if (is_ramming)
gcodegen.m_wipe.reset_path(); // We don't want wiping on the ramming lines.
toolchange_gcode_str = gcodegen.set_extruder(new_extruder_id, tcr.print_z); // TODO: toolchange_z vs print_z
if (gcodegen.config().enable_prime_tower)
deretraction_str = gcodegen.unretract();
if (gcodegen.config().enable_prime_tower) {
deretraction_str += gcodegen.writer().travel_to_z(z, "restore layer Z");
Vec3d position{gcodegen.writer().get_position()};
position.z() = z;
gcodegen.writer().set_position(position);
deretraction_str += gcodegen.unretract();
}
}

// Insert the toolchange and deretraction gcode into the generated gcode.
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/GCodeWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class GCodeWriter {
std::string lift(LiftType lift_type = LiftType::NormalLift, bool spiral_vase = false);
std::string unlift();
Vec3d get_position() const { return m_pos; }
void set_position(const Vec3d& in) { m_pos = in; }
void set_position(const Vec3d& in) { m_pos = in; }
double get_zhop() const { return m_lifted; }

//BBS: set offset for gcode writer
Expand Down

0 comments on commit 13ddb38

Please sign in to comment.