From ed98a859af7c591a7d13aee9d0a0391c258738e2 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 2 Jun 2020 16:29:42 +0200 Subject: [PATCH] Fix of #3919 (extremely wide wipe tower with 0.35mm FAST profile) This is an excerpt from ec86d94, which was recently reverted because the other changes from that commit broke some functionality. --- src/libslic3r/GCode/ToolOrdering.cpp | 15 +++++++++++---- src/libslic3r/GCode/ToolOrdering.hpp | 2 +- src/slic3r/GUI/GUI_ObjectList.hpp | 2 ++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index aa3eddbb8..43f498b60 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -94,7 +94,7 @@ ToolOrdering::ToolOrdering(const PrintObject &object, unsigned int first_extrude // Reorder the extruders to minimize tool switches. this->reorder_extruders(first_extruder); - this->fill_wipe_tower_partitions(object.print()->config(), object.layers().front()->print_z - object.layers().front()->height); + this->fill_wipe_tower_partitions(object.print()->config(), object.layers().front()->print_z - object.layers().front()->height, object.config().layer_height); this->collect_extruder_statistics(prime_multi_material); } @@ -107,6 +107,7 @@ ToolOrdering::ToolOrdering(const Print &print, unsigned int first_extruder, bool // Initialize the print layers for all objects and all layers. coordf_t object_bottom_z = 0.; + coordf_t max_layer_height = 0.; { std::vector zs; for (auto object : print.objects()) { @@ -122,6 +123,8 @@ ToolOrdering::ToolOrdering(const Print &print, unsigned int first_extruder, bool object_bottom_z = layer->print_z - layer->height; break; } + + max_layer_height = std::max(max_layer_height, object->config().layer_height.value); } this->initialize_layers(zs); } @@ -144,7 +147,7 @@ ToolOrdering::ToolOrdering(const Print &print, unsigned int first_extruder, bool // Reorder the extruders to minimize tool switches. this->reorder_extruders(first_extruder); - this->fill_wipe_tower_partitions(print.config(), object_bottom_z); + this->fill_wipe_tower_partitions(print.config(), object_bottom_z, max_layer_height); this->collect_extruder_statistics(prime_multi_material); } @@ -318,7 +321,7 @@ void ToolOrdering::reorder_extruders(unsigned int last_extruder_id) } } -void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_t object_bottom_z) +void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_t object_bottom_z, coordf_t max_object_layer_height) { if (m_layer_tools.empty()) return; @@ -351,6 +354,10 @@ void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_ mlh = 0.75 * config.nozzle_diameter.values[i]; max_layer_height = std::min(max_layer_height, mlh); } + // The Prusa3D Fast (0.35mm layer height) print profile sets a higher layer height than what is normally allowed + // by the nozzle. This is a hack and it works by increasing extrusion width. See GH #3919. + max_layer_height = std::max(max_layer_height, max_object_layer_height); + for (size_t i = 0; i + 1 < m_layer_tools.size(); ++ i) { const LayerTools < = m_layer_tools[i]; const LayerTools <_next = m_layer_tools[i + 1]; @@ -404,7 +411,7 @@ void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_ unsigned int j = i+1; double last_wipe_tower_print_z = lt_next.print_z; while (++j < m_layer_tools.size()-1 && !m_layer_tools[j].has_wipe_tower) - if (m_layer_tools[j+1].print_z - last_wipe_tower_print_z > max_layer_height) { + if (m_layer_tools[j+1].print_z - last_wipe_tower_print_z > max_layer_height + EPSILON) { m_layer_tools[j].has_wipe_tower = true; last_wipe_tower_print_z = m_layer_tools[j].print_z; } diff --git a/src/libslic3r/GCode/ToolOrdering.hpp b/src/libslic3r/GCode/ToolOrdering.hpp index 04ef25a41..e2e07533f 100644 --- a/src/libslic3r/GCode/ToolOrdering.hpp +++ b/src/libslic3r/GCode/ToolOrdering.hpp @@ -168,7 +168,7 @@ private: void initialize_layers(std::vector &zs); void collect_extruders(const PrintObject &object, const std::vector> &per_layer_extruder_switches); void reorder_extruders(unsigned int last_extruder_id); - void fill_wipe_tower_partitions(const PrintConfig &config, coordf_t object_bottom_z); + void fill_wipe_tower_partitions(const PrintConfig &config, coordf_t object_bottom_z, coordf_t max_layer_height); void collect_extruder_statistics(bool prime_multi_material); std::vector m_layer_tools; diff --git a/src/slic3r/GUI/GUI_ObjectList.hpp b/src/slic3r/GUI/GUI_ObjectList.hpp index ad222a4a8..aa5264b07 100644 --- a/src/slic3r/GUI/GUI_ObjectList.hpp +++ b/src/slic3r/GUI/GUI_ObjectList.hpp @@ -13,6 +13,8 @@ #include "wxExtensions.hpp" #include "ObjectDataViewModel.hpp" +#include "libslic3r/PrintConfig.hpp" + class wxBoxSizer; class wxBitmapComboBox; class wxMenuItem;