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:
qing.zhang 2024-04-09 14:58:52 +08:00 committed by Lane.Wei
parent 1804290caa
commit b40cf28a83
2 changed files with 12 additions and 5 deletions

View File

@ -173,13 +173,19 @@ std::string SpiralVase::process_layer(const std::string &gcode, bool last_layer)
if (found && dist < max_xy_dist_for_smoothing) {
// 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));
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!
float modified_dist_XY = SpiralVaseHelpers::distance(last_point, target);
// Scale the extrusion amount according to change in length
line.set(reader, E, line.e() * modified_dist_XY / dist_XY, 5 /*decimal_digits*/);
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
line.set(reader, E, line.e() * modified_dist_XY / dist_XY, 5 /*decimal_digits*/);
last_point = target;
}
} else {
last_point = p;
}

View File

@ -26,6 +26,7 @@ public:
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); }
void clear() { m_raw.clear(); }
bool has(Axis axis) const { return (m_mask & (1 << int(axis))) != 0; }
float value(Axis axis) const { return m_axis[axis]; }
bool has(char axis) const;