FIX: wipe tower does not extruder fill in smooth mode timelapse

Change-Id: Ia6957cfe41ed3624baa4c12b6df90462fc436475
(cherry picked from commit 39ecccc94bea2a43a74ac852f121c5dbc739dc67)
This commit is contained in:
zhimin.zeng 2022-09-15 11:18:29 +08:00 committed by Lane.Wei
parent 530c2287c8
commit 9f74ea5763
5 changed files with 18 additions and 19 deletions

View File

@ -562,18 +562,10 @@ void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_
for (int i = int(m_layer_tools.size()) - 2; i >= 0; -- i)
m_layer_tools[i].wipe_tower_partitions = std::max(m_layer_tools[i + 1].wipe_tower_partitions, m_layer_tools[i].wipe_tower_partitions);
// if enable_timelapse_print(), update all layer_tools parameters: wipe_tower_partitions
if (config.timelapse_type == TimelapseType::tlSmooth) {
for (LayerTools& layer_tools : m_layer_tools) {
if (layer_tools.wipe_tower_partitions == 0) {
layer_tools.wipe_tower_partitions = 1;
}
}
}
//FIXME this is a hack to get the ball rolling.
for (LayerTools &lt : m_layer_tools)
lt.has_wipe_tower = (lt.has_object && lt.wipe_tower_partitions > 0) || lt.print_z < object_bottom_z + EPSILON;
lt.has_wipe_tower = (lt.has_object && (config.timelapse_type == TimelapseType::tlSmooth || lt.wipe_tower_partitions > 0))
|| lt.print_z < object_bottom_z + EPSILON;
// Test for a raft, insert additional wipe tower layer to fill in the raft separation gap.
for (size_t i = 0; i + 1 < m_layer_tools.size(); ++ i) {

View File

@ -183,7 +183,7 @@ public:
std::vector<LayerTools>::const_iterator end() const { return m_layer_tools.end(); }
bool empty() const { return m_layer_tools.empty(); }
std::vector<LayerTools>& layer_tools() { return m_layer_tools; }
bool has_wipe_tower() const { return ! m_layer_tools.empty() && m_first_printing_extruder != (unsigned int)-1 && m_layer_tools.front().wipe_tower_partitions > 0; }
bool has_wipe_tower() const { return ! m_layer_tools.empty() && m_first_printing_extruder != (unsigned int)-1 && m_layer_tools.front().has_wipe_tower; }
private:
void initialize_layers(std::vector<coordf_t> &zs);

View File

@ -1066,7 +1066,7 @@ WipeTower::box_coordinates WipeTower::align_perimeter(const WipeTower::box_coord
return aligned_box;
}
WipeTower::ToolChangeResult WipeTower::finish_layer(bool extrude_perimeter)
WipeTower::ToolChangeResult WipeTower::finish_layer(bool extrude_perimeter, bool extruder_fill)
{
assert(! this->layer_finished());
m_current_layer_finished = true;
@ -1105,7 +1105,7 @@ WipeTower::ToolChangeResult WipeTower::finish_layer(bool extrude_perimeter)
const float dy = (fill_box.lu.y() - fill_box.ld.y() - m_perimeter_width);
float left = fill_box.lu.x() + 2*m_perimeter_width;
float right = fill_box.ru.x() - 2 * m_perimeter_width;
if (dy > m_perimeter_width)
if (extruder_fill && dy > m_perimeter_width)
{
writer.travel(fill_box.ld + Vec2f(m_perimeter_width * 2, 0.f))
.append(";--------------------\n"
@ -1500,7 +1500,7 @@ void WipeTower::generate(std::vector<std::vector<WipeTower::ToolChangeResult>> &
if (m_enable_timelapse_print) {
timelapse_wall = only_generate_out_wall();
}
finish_layer_tcr = finish_layer(m_enable_timelapse_print ? false : true);
finish_layer_tcr = finish_layer(m_enable_timelapse_print ? false : true, layer.extruder_fill);
}
for (int i=0; i<int(layer.tool_changes.size()); ++i) {
@ -1511,7 +1511,7 @@ void WipeTower::generate(std::vector<std::vector<WipeTower::ToolChangeResult>> &
if (i == idx) {
layer_result.emplace_back(tool_change(layer.tool_changes[i].new_tool, m_enable_timelapse_print ? false : true));
// finish_layer will be called after this toolchange
finish_layer_tcr = finish_layer(false);
finish_layer_tcr = finish_layer(false, layer.extruder_fill);
}
else {
layer_result.emplace_back(tool_change(layer.tool_changes[i].new_tool));

View File

@ -157,8 +157,11 @@ public:
float get_depth() const { return m_wipe_tower_depth; }
float get_brim_width() const { return m_wipe_tower_brim_width_real; }
void set_last_layer_extruder_fill(bool extruder_fill) {
if (!m_plan.empty()) {
m_plan.back().extruder_fill = extruder_fill;
}
}
// Switch to a next layer.
@ -218,7 +221,7 @@ public:
// Fill the unfilled space with a sparse infill.
// Call this method only if layer_finished() is false.
ToolChangeResult finish_layer(bool extruder_perimeter = true);
ToolChangeResult finish_layer(bool extruder_perimeter = true, bool extruder_fill = true);
// Is the current layer finished?
bool layer_finished() const {
@ -378,6 +381,7 @@ private:
float height; // layer height
float depth; // depth of the layer based on all layers above
float extra_spacing;
bool extruder_fill{true};
float toolchanges_depth() const { float sum = 0.f; for (const auto &a : tool_changes) sum += a.required_depth; return sum; }
std::vector<ToolChange> tool_changes;

View File

@ -1871,8 +1871,11 @@ void Print::_make_wipe_tower()
layer_tools.wiping_extrusions().ensure_perimeters_infills_order(*this);
// if enable timelapse, slice all layer
if (enable_timelapse_print())
if (enable_timelapse_print()) {
if (layer_tools.wipe_tower_partitions == 0)
wipe_tower.set_last_layer_extruder_fill(false);
continue;
}
if (&layer_tools == &m_wipe_tower_data.tool_ordering.back() || (&layer_tools + 1)->wipe_tower_partitions == 0)
break;