ENH: fix for collision when print by object of multi color

Signed-off-by: salt.wei <salt.wei@bambulab.com>
Change-Id: I3d8b285dedb13ecbb5df38d46293680d9a0c1a61
This commit is contained in:
salt.wei 2023-02-10 11:05:27 +08:00 committed by Lane.Wei
parent aac9bfd593
commit 209c50f50d
3 changed files with 20 additions and 8 deletions

View file

@ -338,14 +338,26 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co
slop_move = w0.string();
}
}
std::string xy_z_move;
{
GCodeG1Formatter w0;
if (this->is_current_position_clear()) {
w0.emit_xyz(target);
w0.emit_f(this->config.travel_speed.value * 60.0);
w0.emit_comment(GCodeWriter::full_gcode_comment, comment);
xy_z_move = w0.string();
}
else {
w0.emit_xy(Vec2d(target.x(), target.y()));
w0.emit_f(this->config.travel_speed.value * 60.0);
w0.emit_comment(GCodeWriter::full_gcode_comment, comment);
xy_z_move = w0.string() + _travel_to_z(target.z(), comment);
}
}
m_pos = dest_point;
this->set_current_position_clear(true);
GCodeG1Formatter w1;
w1.emit_xyz(target);
w1.emit_f(this->config.travel_speed.value * 60.0);
//BBS
w1.emit_comment(GCodeWriter::full_gcode_comment, comment);
return slop_move + w1.string();
return slop_move + xy_z_move;
}
else if (!this->will_move_z(point(2))) {
double nominal_z = m_pos(2) - m_lifted;