FIX: seam and unretarct pos error on smooth vase
Jira: none casused by invalid path of smooth vase mode Signed-off-by: qing.zhang <qing.zhang@bambulab.com> Change-Id: Ib597e8c05760886aae2c42e42e8d46e82b844578
This commit is contained in:
parent
1804290caa
commit
b40cf28a83
|
@ -173,13 +173,19 @@ std::string SpiralVase::process_layer(const std::string &gcode, bool last_layer)
|
||||||
if (found && dist < max_xy_dist_for_smoothing) {
|
if (found && dist < max_xy_dist_for_smoothing) {
|
||||||
// Interpolate between the point on this layer and the point on the previous layer
|
// Interpolate between the point on this layer and the point on the previous layer
|
||||||
SpiralVase::SpiralPoint target = SpiralVaseHelpers::add(SpiralVaseHelpers::scale(nearestp, 1 - factor), SpiralVaseHelpers::scale(p, factor));
|
SpiralVase::SpiralPoint target = SpiralVaseHelpers::add(SpiralVaseHelpers::scale(nearestp, 1 - factor), SpiralVaseHelpers::scale(p, factor));
|
||||||
line.set(reader, X, target.x);
|
|
||||||
line.set(reader, Y, target.y);
|
// BBS: remove too short movement
|
||||||
// We need to figure out the distance of this new line!
|
// We need to figure out the distance of this new line!
|
||||||
float modified_dist_XY = SpiralVaseHelpers::distance(last_point, target);
|
float modified_dist_XY = SpiralVaseHelpers::distance(last_point, target);
|
||||||
|
if (modified_dist_XY < 0.001)
|
||||||
|
line.clear();
|
||||||
|
else {
|
||||||
|
line.set(reader, X, target.x);
|
||||||
|
line.set(reader, Y, target.y);
|
||||||
// Scale the extrusion amount according to change in length
|
// Scale the extrusion amount according to change in length
|
||||||
line.set(reader, E, line.e() * modified_dist_XY / dist_XY, 5 /*decimal_digits*/);
|
line.set(reader, E, line.e() * modified_dist_XY / dist_XY, 5 /*decimal_digits*/);
|
||||||
last_point = target;
|
last_point = target;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
last_point = p;
|
last_point = p;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ public:
|
||||||
const std::string_view comment() const
|
const std::string_view comment() const
|
||||||
{ size_t pos = m_raw.find(';'); return (pos == std::string::npos) ? std::string_view() : std::string_view(m_raw).substr(pos + 1); }
|
{ size_t pos = m_raw.find(';'); return (pos == std::string::npos) ? std::string_view() : std::string_view(m_raw).substr(pos + 1); }
|
||||||
|
|
||||||
|
void clear() { m_raw.clear(); }
|
||||||
bool has(Axis axis) const { return (m_mask & (1 << int(axis))) != 0; }
|
bool has(Axis axis) const { return (m_mask & (1 << int(axis))) != 0; }
|
||||||
float value(Axis axis) const { return m_axis[axis]; }
|
float value(Axis axis) const { return m_axis[axis]; }
|
||||||
bool has(char axis) const;
|
bool has(char axis) const;
|
||||||
|
|
Loading…
Reference in New Issue