This is a fix of a long standing bug, where an extrusion is incorrectly
drawn from the end of the last wipe move. Interestingly enough,
this bug is in Slic3r at least since 1.2.9, but lucky enough
it only occured for single perimeter, no infill prints with wipe after
retract enabled, and only if the two successive slices were discretized
exactly the same, which is quite unlikely.
This commit is contained in:
bubnikv 2019-01-14 19:57:41 +01:00
parent befccb0734
commit 54299d8eb0
2 changed files with 25 additions and 20 deletions

View file

@ -103,8 +103,7 @@ OozePrevention::_get_temp(GCode &gcodegen)
: gcodegen.config().temperature.get_at(gcodegen.writer().extruder()->id()); : gcodegen.config().temperature.get_at(gcodegen.writer().extruder()->id());
} }
std::string std::string Wipe::wipe(GCode &gcodegen, bool toolchange)
Wipe::wipe(GCode &gcodegen, bool toolchange)
{ {
std::string gcode; std::string gcode;
@ -137,6 +136,7 @@ Wipe::wipe(GCode &gcodegen, bool toolchange)
wipe_path.clip_end(wipe_path.length() - wipe_dist); wipe_path.clip_end(wipe_path.length() - wipe_dist);
// subdivide the retraction in segments // subdivide the retraction in segments
if (! wipe_path.empty()) {
for (const Line &line : wipe_path.lines()) { for (const Line &line : wipe_path.lines()) {
double segment_length = line.length(); double segment_length = line.length();
/* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one /* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one
@ -151,6 +151,8 @@ Wipe::wipe(GCode &gcodegen, bool toolchange)
"wipe and retract" "wipe and retract"
); );
} }
gcodegen.set_last_pos(wipe_path.points.back());
}
// prevent wiping again on same path // prevent wiping again on same path
this->reset_path(); this->reset_path();
@ -2577,9 +2579,11 @@ std::string GCode::travel_to(const Point &point, ExtrusionRole role, std::string
// use G1 because we rely on paths being straight (G0 may make round paths) // use G1 because we rely on paths being straight (G0 may make round paths)
Lines lines = travel.lines(); Lines lines = travel.lines();
for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) if (! lines.empty()) {
gcode += m_writer.travel_to_xy(this->point_to_gcode(line->b), comment); for (const Line &line : lines)
gcode += m_writer.travel_to_xy(this->point_to_gcode(line.b), comment);
this->set_last_pos(lines.back().b);
}
return gcode; return gcode;
} }

View file

@ -360,6 +360,7 @@ protected:
size_t num_objects, size_t num_objects,
size_t num_islands); size_t num_islands);
friend class Wipe;
friend class WipeTowerIntegration; friend class WipeTowerIntegration;
}; };