"Multimaterial printer switches filament at the wrong time during a print"
https://github.com/prusa3d/Slic3r/issues/607

There was a single layer between the raft top and the object first layer
missing on the wipe tower, and after this missing layer all the tool
changes were shifted by one layer, meaning two color print had the colors
switched.
This commit is contained in:
bubnikv 2017-12-11 17:19:55 +01:00
parent 1938828520
commit 61e6f23ed2
7 changed files with 67 additions and 43 deletions

View file

@ -1,7 +1,16 @@
#include "Print.hpp"
#include "ToolOrdering.hpp"
#include <assert.h>
// #define SLIC3R_DEBUG
// Make assert active if SLIC3R_DEBUG
#ifdef SLIC3R_DEBUG
#define DEBUG
#define _DEBUG
#undef NDEBUG
#endif
#include <cassert>
#include <limits>
namespace Slic3r {
@ -257,11 +266,18 @@ void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_
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);
LayerTools &lt_extra = (m_layer_tools[j].print_z == lt_new.print_z) ?
m_layer_tools[j] :
*m_layer_tools.insert(m_layer_tools.begin() + j, lt_new);
lt_extra.has_wipe_tower = true;
lt_extra.wipe_tower_partitions = lt_object.wipe_tower_partitions;
if (m_layer_tools[j].print_z == lt_new.print_z) {
m_layer_tools[j].has_wipe_tower = true;
} else {
LayerTools &lt_extra = *m_layer_tools.insert(m_layer_tools.begin() + j, lt_new);
LayerTools &lt_prev = m_layer_tools[j - 1];
LayerTools &lt_next = m_layer_tools[j + 1];
assert(! lt_prev.extruders.empty() && ! lt_next.extruders.empty());
assert(lt_prev.extruders.back() == lt_next.extruders.front());
lt_extra.has_wipe_tower = true;
lt_extra.extruders.push_back(lt_next.extruders.front());
lt_extra.wipe_tower_partitions = lt_next.wipe_tower_partitions;
}
}
}
break;