Full re-write of spiral vase (#3091)

* Practically full re-write of spiral vase
- Adds transition out to prevent sharp edge at the top of spiral vase.
- Adds XY interpolation
- Adds option to turn XY interpolation on/off

* - Increasing E to 5 decimal digits (I observed uneven flow with less than that)
- Excluding all travel moves (I saw a bug where somehow we ended up with travel moves within the print so excluding all travel moves)

* - max_xy_smoothing is now configurable, default is 200% of nozzle_diameter
- fixed no-op travel moves in the middle of spiral that now show up as defects when Smooth Spiral is enabled!

* - Avoiding namespace pollution
- Fixing dist_XY == 0 bug

---------

Co-authored-by: Andrew Boktor <aboktor@microsoft.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
andrewboktor 2023-12-16 21:48:21 -08:00 committed by GitHub
parent 995ed049cb
commit 9acd550a9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 181 additions and 28 deletions

View file

@ -6,12 +6,23 @@
namespace Slic3r {
class SpiralVase {
class SpiralVase
{
public:
class SpiralPoint
{
public:
SpiralPoint(float paramx, float paramy) : x(paramx), y(paramy) {}
public:
float x, y;
};
SpiralVase(const PrintConfig &config) : m_config(config)
{
m_reader.z() = (float)m_config.z_offset;
m_reader.apply_config(m_config);
m_previous_layer = NULL;
m_smooth_spiral = config.spiral_mode_smooth;
};
void enable(bool en) {
@ -19,17 +30,22 @@ public:
m_enabled = en;
}
std::string process_layer(const std::string &gcode);
std::string process_layer(const std::string &gcode, bool last_layer);
void set_max_xy_smoothing(float max) {
m_max_xy_smoothing = max;
}
private:
const PrintConfig &m_config;
GCodeReader m_reader;
float m_max_xy_smoothing;
bool m_enabled = false;
// First spiral vase layer. Layer height has to be ramped up from zero to the target layer height.
bool m_transition_layer = false;
// Whether to interpolate XY coordinates with the previous layer. Results in no seam at layer changes
bool m_smooth_spiral = false;
std::vector<SpiralPoint> * m_previous_layer;
};
}
#endif // slic3r_SpiralVase_hpp_