mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 02:07:54 -06:00
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:
parent
befccb0734
commit
54299d8eb0
2 changed files with 25 additions and 20 deletions
|
@ -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,19 +136,22 @@ 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
|
||||||
for (const Line &line : wipe_path.lines()) {
|
if (! wipe_path.empty()) {
|
||||||
double segment_length = line.length();
|
for (const Line &line : wipe_path.lines()) {
|
||||||
/* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one
|
double segment_length = line.length();
|
||||||
due to rounding (TODO: test and/or better math for this) */
|
/* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one
|
||||||
double dE = length * (segment_length / wipe_dist) * 0.95;
|
due to rounding (TODO: test and/or better math for this) */
|
||||||
//FIXME one shall not generate the unnecessary G1 Fxxx commands, here wipe_speed is a constant inside this cycle.
|
double dE = length * (segment_length / wipe_dist) * 0.95;
|
||||||
// Is it here for the cooling markers? Or should it be outside of the cycle?
|
//FIXME one shall not generate the unnecessary G1 Fxxx commands, here wipe_speed is a constant inside this cycle.
|
||||||
gcode += gcodegen.writer().set_speed(wipe_speed*60, "", gcodegen.enable_cooling_markers() ? ";_WIPE" : "");
|
// Is it here for the cooling markers? Or should it be outside of the cycle?
|
||||||
gcode += gcodegen.writer().extrude_to_xy(
|
gcode += gcodegen.writer().set_speed(wipe_speed*60, "", gcodegen.enable_cooling_markers() ? ";_WIPE" : "");
|
||||||
gcodegen.point_to_gcode(line.b),
|
gcode += gcodegen.writer().extrude_to_xy(
|
||||||
-dE,
|
gcodegen.point_to_gcode(line.b),
|
||||||
"wipe and retract"
|
-dE,
|
||||||
);
|
"wipe and retract"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
gcodegen.set_last_pos(wipe_path.points.back());
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent wiping again on same path
|
// prevent wiping again on same 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,11 +155,11 @@ public:
|
||||||
void do_export(Print *print, const char *path, GCodePreviewData *preview_data = nullptr);
|
void do_export(Print *print, const char *path, GCodePreviewData *preview_data = nullptr);
|
||||||
|
|
||||||
// Exported for the helper classes (OozePrevention, Wipe) and for the Perl binding for unit tests.
|
// Exported for the helper classes (OozePrevention, Wipe) and for the Perl binding for unit tests.
|
||||||
const Vec2d& origin() const { return m_origin; }
|
const Vec2d& origin() const { return m_origin; }
|
||||||
void set_origin(const Vec2d &pointf);
|
void set_origin(const Vec2d &pointf);
|
||||||
void set_origin(const coordf_t x, const coordf_t y) { this->set_origin(Vec2d(x, y)); }
|
void set_origin(const coordf_t x, const coordf_t y) { this->set_origin(Vec2d(x, y)); }
|
||||||
const Point& last_pos() const { return m_last_pos; }
|
const Point& last_pos() const { return m_last_pos; }
|
||||||
Vec2d point_to_gcode(const Point &point) const;
|
Vec2d point_to_gcode(const Point &point) const;
|
||||||
Point gcode_to_point(const Vec2d &point) const;
|
Point gcode_to_point(const Vec2d &point) const;
|
||||||
const FullPrintConfig &config() const { return m_config; }
|
const FullPrintConfig &config() const { return m_config; }
|
||||||
const Layer* layer() const { return m_layer; }
|
const Layer* layer() const { return m_layer; }
|
||||||
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue