Merge branch 'master' into wipe_tower_improvements

This commit is contained in:
Lukas Matena 2017-12-21 13:47:33 +01:00
commit 4583d62edd
126 changed files with 5240 additions and 607 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 {
@ -256,12 +265,19 @@ 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);
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;
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 &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;

View file

@ -53,14 +53,14 @@ public:
void clear() { m_layer_tools.clear(); }
// Get the first extruder printing the layer_tools, returns -1 if there is no layer printed.
// Get the first extruder printing, including the extruder priming areas, returns -1 if there is no layer printed.
unsigned int first_extruder() const { return m_first_printing_extruder; }
// Get the first extruder printing the layer_tools, returns -1 if there is no layer printed.
unsigned int last_extruder() const { return m_last_printing_extruder; }
// For a multi-material print, the printing extruders are ordered in the order they shall be primed.
std::vector<unsigned int> all_extruders() const { return m_all_printing_extruders; }
const std::vector<unsigned int>& all_extruders() const { return m_all_printing_extruders; }
// Find LayerTools with the closest print_z.
LayerTools& tools_for_layer(coordf_t print_z);
@ -69,6 +69,8 @@ public:
const LayerTools& front() const { return m_layer_tools.front(); }
const LayerTools& back() const { return m_layer_tools.back(); }
std::vector<LayerTools>::const_iterator begin() const { return m_layer_tools.begin(); }
std::vector<LayerTools>::const_iterator end() const { return m_layer_tools.end(); }
bool empty() const { return m_layer_tools.empty(); }
const std::vector<LayerTools>& layer_tools() const { 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; }

View file

@ -122,7 +122,7 @@ public:
// print_z of the first layer.
float first_layer_height,
// Extruder indices, in the order to be primed. The last extruder will later print the wipe tower brim, print brim and the object.
std::vector<unsigned int> tools,
const std::vector<unsigned int> &tools,
// If true, the last priming are will be the same as the other priming areas, and the rest of the wipe will be performed inside the wipe tower.
// If false, the last priming are will be large enough to wipe the last extruder sufficiently.
bool last_wipe_inside_wipe_tower,

View file

@ -389,7 +389,7 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::prime(
// print_z of the first layer.
float first_layer_height,
// Extruder indices, in the order to be primed. The last extruder will later print the wipe tower brim, print brim and the object.
std::vector<unsigned int> tools,
const std::vector<unsigned int> &tools,
// If true, the last priming are will be the same as the other priming areas, and the rest of the wipe will be performed inside the wipe tower.
// If false, the last priming are will be large enough to wipe the last extruder sufficiently.
bool last_wipe_inside_wipe_tower,
@ -615,7 +615,8 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::tool_change(unsigned int tool, boo
.extrude(box.ld, 3200).extrude(box.rd)
.extrude(box.ru).extrude(box.lu);
// Wipe the nozzle.
if (purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE)
//if (purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE)
// Always wipe the nozzle with a long wipe to reduce stringing when moving away from the wipe tower.
writer.travel(box.ru, 7200)
.travel(box.lu);
} else
@ -723,8 +724,9 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::toolchange_Brim(Purpose purpose, b
// Move to the front left corner.
writer.travel(wipeTower_box.ld, 7000);
if (purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE)
//if (purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE)
// Wipe along the front edge.
// Always wipe the nozzle with a long wipe to reduce stringing when moving away from the wipe tower.
writer.travel(wipeTower_box.rd)
.travel(wipeTower_box.ld);
@ -1083,8 +1085,10 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::finish_layer(Purpose purpose)
.extrude(fill_box.ru + xy(-m_perimeter_width, -m_perimeter_width));
}
if (purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE)
// if (purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE)
if (true)
// Wipe along the front side of the current wiping box.
// Always wipe the nozzle with a long wipe to reduce stringing when moving away from the wipe tower.
writer.travel(fill_box.ld + xy( m_perimeter_width, m_perimeter_width / 2), 7200)
.travel(fill_box.rd + xy(- m_perimeter_width, m_perimeter_width / 2));
else

View file

@ -151,7 +151,7 @@ public:
// print_z of the first layer.
float first_layer_height,
// Extruder indices, in the order to be primed. The last extruder will later print the wipe tower brim, print brim and the object.
std::vector<unsigned int> tools,
const std::vector<unsigned int> &tools,
// If true, the last priming are will be the same as the other priming areas, and the rest of the wipe will be performed inside the wipe tower.
// If false, the last priming are will be large enough to wipe the last extruder sufficiently.
bool last_wipe_inside_wipe_tower,