From dfc4717308a7e6c5b389e3a48b4904294e58664c Mon Sep 17 00:00:00 2001 From: bubnikv Date: Sat, 20 May 2017 18:59:05 +0200 Subject: Fixes for Multi Material ramming, increased separation of wipe lines. --- xs/src/libslic3r/GCode.cpp | 2 ++ xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp | 39 ++++++++++++++--------------- xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp | 9 ++++--- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp index 5d045deed..38f83cbf5 100644 --- a/xs/src/libslic3r/GCode.cpp +++ b/xs/src/libslic3r/GCode.cpp @@ -173,6 +173,7 @@ std::string WipeTowerIntegration::tool_change(GCode &gcodegen, int extruder_id, // Move over the wipe tower. gcode += this->travel_to(gcodegen, m_impl->tool_change(extruder_id, WipeTower::PURPOSE_MOVE_TO_TOWER).second); // Let the tool change be executed by the wipe tower class. + //FIXME calculate time at the wipe tower and add it to m_elapsed_time std::pair code_and_pos = m_impl->tool_change(extruder_id, WipeTower::PURPOSE_EXTRUDE); // Inform the G-code writer about the changes done behind its back. gcode += code_and_pos.first; @@ -192,6 +193,7 @@ std::string WipeTowerIntegration::tool_change(GCode &gcodegen, int extruder_id, if (! over_wipe_tower) gcode += this->travel_to(gcodegen, m_impl->finish_layer(WipeTower::PURPOSE_MOVE_TO_TOWER).second); // Let the tool change be executed by the wipe tower class. + //FIXME calculate time at the wipe tower and add it to m_elapsed_time std::pair code_and_pos = m_impl->finish_layer(WipeTower::PURPOSE_EXTRUDE); // Inform the G-code writer about the changes done behind its back. gcode += code_and_pos.first; diff --git a/xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp b/xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp index b82092c08..7394b6acb 100644 --- a/xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp +++ b/xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp @@ -124,9 +124,9 @@ public: // Move to x1, +y_increment, // extrude quickly amount e to x2 with feed f. - Writer& ram(float x1, float x2, float dy, float e, float f) + Writer& ram(float x1, float x2, float dy, float e0, float e, float f) { - return travel(x1, m_current_pos.y + dy, f) + return extrude_explicit(x1, m_current_pos.y + dy, e0, f) .extrude_explicit(x2, m_current_pos.y, e); } @@ -469,33 +469,32 @@ void WipeTowerPrusaMM::toolchange_Unload( // Ram the hot material out of the extruder melt zone. // Current extruder position is on the left, one perimeter inside the cleaning box in both X and Y. + float e0 = m_perimeter_width * m_extrusion_flow; + float e = (xr - xl) * m_extrusion_flow; switch (current_material) { case ABS: // ramming start end y increment amount feedrate - writer.ram(xl + m_perimeter_width * 2, xr - m_perimeter_width, y_step * 0.2f, 1.2f, 4000) - .ram(xr - m_perimeter_width, xl + m_perimeter_width, y_step * 1.2f, 1.6f, 4600) - .ram(xl + m_perimeter_width * 2, xr - m_perimeter_width * 2, y_step * 1.2f, 1.8f, 5000) - .ram(xr - m_perimeter_width * 2, xl + m_perimeter_width * 2, y_step * 1.2f, 1.8f, 5000); + writer.ram(xl + m_perimeter_width * 2, xr - m_perimeter_width, y_step * 0.2f, 0, 1.2f * e, 4000) + .ram(xr - m_perimeter_width, xl + m_perimeter_width, y_step * 1.2f, e0, 1.6f * e, 4600) + .ram(xl + m_perimeter_width * 2, xr - m_perimeter_width * 2, y_step * 1.2f, e0, 1.8f * e, 5000) + .ram(xr - m_perimeter_width * 2, xl + m_perimeter_width * 2, y_step * 1.2f, e0, 1.8f * e, 5000); break; case PVA: - writer.ram(xl + m_perimeter_width * 2, xr - m_perimeter_width, y_step * 0.2f, 3, 4000) - .ram(xr - m_perimeter_width, xl + m_perimeter_width, y_step * 1.5f, 3, 4500) - .ram(xl + m_perimeter_width * 2, xr - m_perimeter_width * 2, y_step * 1.5f, 3, 4800) - .ram(xr - m_perimeter_width, xl + m_perimeter_width, y_step * 1.5f, 3, 5000); + writer.ram(xl + m_perimeter_width * 2, xr - m_perimeter_width, y_step * 0.2f, 0, 3, 4000) + .ram(xr - m_perimeter_width, xl + m_perimeter_width, y_step * 1.5f, 0, 3, 4500) + .ram(xl + m_perimeter_width * 2, xr - m_perimeter_width * 2, y_step * 1.5f, 0, 3, 4800) + .ram(xr - m_perimeter_width, xl + m_perimeter_width, y_step * 1.5f, 0, 3, 5000); break; case SCAFF: - writer.ram(xl + m_perimeter_width * 2, xr - m_perimeter_width, y_step * 2.f, 3, 4000) - .ram(xr - m_perimeter_width, xl + m_perimeter_width, y_step * 3.f, 4, 4600) - .ram(xl + m_perimeter_width * 2, xr - m_perimeter_width * 2, y_step * 3.f, 4.5, 5200); + writer.ram(xl + m_perimeter_width * 2, xr - m_perimeter_width, y_step * 2.f, 0, 3, 4000) + .ram(xr - m_perimeter_width, xl + m_perimeter_width, y_step * 3.f, 0, 4, 4600) + .ram(xl + m_perimeter_width * 2, xr - m_perimeter_width * 2, y_step * 3.f, 0, 4.5, 5200); break; default: - { - float e = (xr - xl) * m_extrusion_flow; - writer.ram(xl + m_perimeter_width * 2, xr - m_perimeter_width, y_step * 0.2f, 1.6f * e, 4000) - .ram(xr - m_perimeter_width, xl + m_perimeter_width, y_step * 1.2f, 1.65f * e, 4600) - .ram(xl + m_perimeter_width * 2, xr - m_perimeter_width * 2, y_step * 1.2f, 1.74f * e, 5200); - } + writer.ram(xl + m_perimeter_width * 2, xr - m_perimeter_width, y_step * 0.2f, 0, 1.6f * e, 4000) + .ram(xr - m_perimeter_width, xl + m_perimeter_width, y_step * 1.2f, e0, 1.65f * e, 4600) + .ram(xl + m_perimeter_width * 2, xr - m_perimeter_width * 2, y_step * 1.2f, e0, 1.74f * e, 5200); } // Pull the filament end into a cooling tube. @@ -610,7 +609,7 @@ void WipeTowerPrusaMM::toolchange_Wipe( float wipe_speed_inc = 50.f; float wipe_speed_max = 4800.f; // Y increment per wipe line. - float dy = ((m_current_shape == SHAPE_NORMAL) ? 1.f : -1.f) * m_perimeter_width * 0.7f; + float dy = ((m_current_shape == SHAPE_NORMAL) ? 1.f : -1.f) * m_perimeter_width * 0.8f; for (bool p = true; ; p = ! p) { wipe_speed = std::min(wipe_speed_max, wipe_speed + wipe_speed_inc); if (p) { diff --git a/xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp b/xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp index ffafb2934..58af91311 100644 --- a/xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp +++ b/xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp @@ -90,14 +90,15 @@ public: m_current_shape = (! is_first_layer && m_current_shape == SHAPE_NORMAL) ? SHAPE_REVERSED : SHAPE_NORMAL; ++ m_num_layer_changes; - int layer_idx = int(std::floor(layer_height * 100) + 0.5f); + int layer_idx = int(std::floor(layer_height * 1000) + 0.5f); switch (layer_idx) { - case 15: - m_extrusion_flow = (float)0.024; + case 150: + m_extrusion_flow = (float)0.0218; break; - case 20: + case 200: default: + // Extrusion rate for an extrusion aka perimeter width 0.35mm. m_extrusion_flow = (float)0.029; break; } -- cgit v1.2.3