From 97c4c0200180c461a0d2504b2fe1ef6f3f6f9163 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 22 Mar 2021 13:23:24 +0100 Subject: [PATCH] Wipe tower: don't do sparse infill when there is a soluble filament above it --- src/libslic3r/GCode/WipeTower.cpp | 51 ++++++++++++++++++++++++------- src/libslic3r/GCode/WipeTower.hpp | 1 + 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index f3ecd2cf3..8385375bb 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -556,6 +556,7 @@ void WipeTower::set_extruder(size_t idx, const PrintConfig& config) m_filpar.push_back(FilamentParameters()); m_filpar[idx].material = config.filament_type.get_at(idx); + m_filpar[idx].is_soluble = config.filament_soluble.get_at(idx); m_filpar[idx].temperature = config.temperature.get_at(idx); m_filpar[idx].first_layer_temperature = config.first_layer_temperature.get_at(idx); @@ -1192,19 +1193,47 @@ WipeTower::ToolChangeResult WipeTower::finish_layer() const float right = fill_box.ru.x() - 2 * m_perimeter_width; if (dy > m_perimeter_width) { - // Extrude an inverse U at the left of the region. - writer.travel(fill_box.ld + Vec2f(m_perimeter_width * 2, 0.f)) - .extrude(fill_box.lu + Vec2f(m_perimeter_width * 2, 0.f), 2900 * speed_factor); + writer.travel(fill_box.ld + Vec2f(m_perimeter_width * 2, 0.f)); - const int n = 1+int((right-left)/m_bridging); - const float dx = (right-left)/n; - for (int i=1;i<=n;++i) { - float x=left+dx*i; - writer.travel(x,writer.y()); - writer.extrude(x,i%2 ? fill_box.rd.y() : fill_box.ru.y()); + // Is there a soluble filament wiped/rammed at the next layer? + // If so, the infill should not be sparse. + bool solid_infill = m_layer_info+1 == m_plan.end() + ? false + : std::any_of((m_layer_info+1)->tool_changes.begin(), + (m_layer_info+1)->tool_changes.end(), + [this](const WipeTowerInfo::ToolChange& tch) { + return m_filpar[tch.new_tool].is_soluble + || m_filpar[tch.old_tool].is_soluble; + }); + + if (solid_infill) { + const float sparse_factor = 1.5f; // 1=solid, 2=every other line, etc. + float y = fill_box.ld.y() + m_perimeter_width; + int n = dy / (m_perimeter_width * sparse_factor); + float spacing = (dy-m_perimeter_width)/(n-1); + int i = 0; + for (i=0; i