Implemented linear tapering of extrusion rate for the 1st spiral vase layer
above the solid infill. Should fix first layer of vase (after bottom layers) is bulging (0.6nozzle, 0.4 layerhight) #3712 Adjust flow of the "second" layer in spiral vase mode #2795
This commit is contained in:
parent
364300055e
commit
298b730589
3 changed files with 24 additions and 9 deletions
|
@ -1764,6 +1764,7 @@ void GCode::process_layer(
|
|||
|
||||
// Check whether it is possible to apply the spiral vase logic for this layer.
|
||||
// Just a reminder: A spiral vase mode is allowed for a single object, single material print only.
|
||||
m_enable_loop_clipping = true;
|
||||
if (m_spiral_vase && layers.size() == 1 && support_layer == nullptr) {
|
||||
bool enable = (layer.id() > 0 || print.config().brim_width.value == 0.) && (layer.id() >= (size_t)print.config().skirt_height.value && ! print.has_infinite_skirt());
|
||||
if (enable) {
|
||||
|
@ -1775,10 +1776,10 @@ void GCode::process_layer(
|
|||
break;
|
||||
}
|
||||
}
|
||||
m_spiral_vase->enable = enable;
|
||||
m_spiral_vase->enable(enable);
|
||||
// If we're going to apply spiralvase to this layer, disable loop clipping.
|
||||
m_enable_loop_clipping = !enable;
|
||||
}
|
||||
// If we're going to apply spiralvase to this layer, disable loop clipping
|
||||
m_enable_loop_clipping = ! m_spiral_vase || ! m_spiral_vase->enable;
|
||||
|
||||
std::string gcode;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ std::string SpiralVase::process_layer(const std::string &gcode)
|
|||
|
||||
// If we're not going to modify G-code, just feed it to the reader
|
||||
// in order to update positions.
|
||||
if (! this->enable) {
|
||||
if (! m_enabled) {
|
||||
m_reader.parse_buffer(gcode);
|
||||
return gcode;
|
||||
}
|
||||
|
@ -50,7 +50,10 @@ std::string SpiralVase::process_layer(const std::string &gcode)
|
|||
z -= layer_height;
|
||||
|
||||
std::string new_gcode;
|
||||
m_reader.parse_buffer(gcode, [&new_gcode, &z, &layer_height, &total_layer_length]
|
||||
bool transition = m_transition_layer;
|
||||
float layer_height_factor = layer_height / total_layer_length;
|
||||
float len = 0.f;
|
||||
m_reader.parse_buffer(gcode, [&new_gcode, &z, total_layer_length, layer_height_factor, transition, &len]
|
||||
(GCodeReader &reader, GCodeReader::GCodeLine line) {
|
||||
if (line.cmd_is("G1")) {
|
||||
if (line.has_z()) {
|
||||
|
@ -64,8 +67,11 @@ std::string SpiralVase::process_layer(const std::string &gcode)
|
|||
if (dist_XY > 0) {
|
||||
// horizontal move
|
||||
if (line.extruding(reader)) {
|
||||
z += dist_XY * layer_height / total_layer_length;
|
||||
line.set(reader, Z, z);
|
||||
len += dist_XY;
|
||||
line.set(reader, Z, z + len * layer_height_factor);
|
||||
if (transition && line.has(E))
|
||||
// Transition layer, modulate the amount of extrusion from zero to the final value.
|
||||
line.set(reader, E, line.value(E) * len / total_layer_length);
|
||||
new_gcode += line.raw() + '\n';
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -8,18 +8,26 @@ namespace Slic3r {
|
|||
|
||||
class SpiralVase {
|
||||
public:
|
||||
bool enable = false;
|
||||
|
||||
SpiralVase(const PrintConfig &config) : m_config(&config)
|
||||
{
|
||||
m_reader.z() = (float)m_config->z_offset;
|
||||
m_reader.apply_config(*m_config);
|
||||
};
|
||||
|
||||
void enable(bool en) {
|
||||
m_transition_layer = en && ! m_enabled;
|
||||
m_enabled = en;
|
||||
}
|
||||
|
||||
std::string process_layer(const std::string &gcode);
|
||||
|
||||
private:
|
||||
const PrintConfig *m_config;
|
||||
GCodeReader m_reader;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue