From 91e847cb7671b683d8de1747b3ef0a3c4715fba1 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Wed, 13 Dec 2017 10:32:25 +0100 Subject: [PATCH] Yet another fix for https://github.com/prusa3d/Slic3r/issues/607. Use EPSILON to match two layers by their floating point Z height. --- xs/src/libslic3r/GCode/ToolOrdering.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xs/src/libslic3r/GCode/ToolOrdering.cpp b/xs/src/libslic3r/GCode/ToolOrdering.cpp index a8954eca51..271b75ef32 100644 --- a/xs/src/libslic3r/GCode/ToolOrdering.cpp +++ b/xs/src/libslic3r/GCode/ToolOrdering.cpp @@ -265,8 +265,8 @@ void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_ // Insert one additional wipe tower layer between lh.print_z and lt_object.print_z. LayerTools lt_new(0.5f * (lt.print_z + lt_object.print_z)); // Find the 1st layer above lt_new. - for (j = i + 1; j < m_layer_tools.size() && m_layer_tools[j].print_z < lt_new.print_z; ++ j); - if (m_layer_tools[j].print_z == lt_new.print_z) { + for (j = i + 1; j < m_layer_tools.size() && m_layer_tools[j].print_z < lt_new.print_z - EPSILON; ++ j); + if (std::abs(m_layer_tools[j].print_z - lt_new.print_z) < EPSILON) { m_layer_tools[j].has_wipe_tower = true; } else { LayerTools <_extra = *m_layer_tools.insert(m_layer_tools.begin() + j, lt_new);