mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
Wipe tower - refactoring (removed the abstract WipeTower class)
- abstract class WipeTower and its descendant WipeTowerPrusaMM were merged into a single (non-abstract) WipeTower class - all uses of WipeTower::xy struct were replaced by Eigen Vec2f (it is no longer necessary to be independent on libraries that PrusaSlicer uses) - the WipeTowerPrusaMM.hpp/.cpp will be renamed in the next commit (hopefully it will retain its git history that way)
This commit is contained in:
parent
0eecfc6604
commit
05e6dbbe4b
8 changed files with 293 additions and 406 deletions
|
@ -13,7 +13,7 @@ TODO LIST
|
|||
|
||||
*/
|
||||
|
||||
#include "WipeTowerPrusaMM.hpp"
|
||||
#include "WipeTower.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
@ -35,12 +35,23 @@ TODO LIST
|
|||
namespace Slic3r
|
||||
{
|
||||
|
||||
namespace PrusaMultiMaterial {
|
||||
// Rotate the point around center of the wipe tower about given angle (in degrees)
|
||||
static Vec2f rotate(const Vec2f& pt, float width, float depth, float angle)
|
||||
{
|
||||
Vec2f out(0,0);
|
||||
float temp_x = pt(0) - width / 2.f;
|
||||
float temp_y = pt(1) - depth / 2.f;
|
||||
angle *= float(M_PI/180.);
|
||||
out.x() += temp_x * cos(angle) - temp_y * sin(angle) + width / 2.f;
|
||||
out.y() += temp_x * sin(angle) + temp_y * cos(angle) + depth / 2.f;
|
||||
return out;
|
||||
}
|
||||
|
||||
class Writer
|
||||
|
||||
class WipeTowerWriter
|
||||
{
|
||||
public:
|
||||
Writer(float layer_height, float line_width, GCodeFlavor flavor, const std::vector<WipeTowerPrusaMM::FilamentParameters>& filament_parameters) :
|
||||
WipeTowerWriter(float layer_height, float line_width, GCodeFlavor flavor, const std::vector<WipeTower::FilamentParameters>& filament_parameters) :
|
||||
m_current_pos(std::numeric_limits<float>::max(), std::numeric_limits<float>::max()),
|
||||
m_current_z(0.f),
|
||||
m_current_feedrate(0.f),
|
||||
|
@ -61,7 +72,7 @@ public:
|
|||
change_analyzer_line_width(line_width);
|
||||
}
|
||||
|
||||
Writer& change_analyzer_line_width(float line_width) {
|
||||
WipeTowerWriter& change_analyzer_line_width(float line_width) {
|
||||
// adds tag for analyzer:
|
||||
char buf[64];
|
||||
sprintf(buf, ";%s%f\n", GCodeAnalyzer::Width_Tag.c_str(), line_width);
|
||||
|
@ -69,7 +80,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
Writer& change_analyzer_mm3_per_mm(float len, float e) {
|
||||
WipeTowerWriter& change_analyzer_mm3_per_mm(float len, float e) {
|
||||
static const float area = M_PI * 1.75f * 1.75f / 4.f;
|
||||
float mm3_per_mm = (len == 0.f ? 0.f : area * e / len);
|
||||
// adds tag for analyzer:
|
||||
|
@ -79,25 +90,25 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
Writer& set_initial_position(const WipeTower::xy &pos, float width = 0.f, float depth = 0.f, float internal_angle = 0.f) {
|
||||
WipeTowerWriter& set_initial_position(const Vec2f &pos, float width = 0.f, float depth = 0.f, float internal_angle = 0.f) {
|
||||
m_wipe_tower_width = width;
|
||||
m_wipe_tower_depth = depth;
|
||||
m_internal_angle = internal_angle;
|
||||
m_start_pos = WipeTower::xy(pos,0.f,m_y_shift).rotate(m_wipe_tower_width, m_wipe_tower_depth, m_internal_angle);
|
||||
m_start_pos = rotate(pos + Vec2f(0.f,m_y_shift), m_wipe_tower_width, m_wipe_tower_depth, m_internal_angle);
|
||||
m_current_pos = pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Writer& set_initial_tool(const unsigned int tool) { m_current_tool = tool; return *this; }
|
||||
WipeTowerWriter& set_initial_tool(const unsigned int tool) { m_current_tool = tool; return *this; }
|
||||
|
||||
Writer& set_z(float z)
|
||||
WipeTowerWriter& set_z(float z)
|
||||
{ m_current_z = z; return *this; }
|
||||
|
||||
Writer& set_extrusion_flow(float flow)
|
||||
WipeTowerWriter& set_extrusion_flow(float flow)
|
||||
{ m_extrusion_flow = flow; return *this; }
|
||||
|
||||
Writer& set_y_shift(float shift) {
|
||||
m_current_pos.y -= shift-m_y_shift;
|
||||
WipeTowerWriter& set_y_shift(float shift) {
|
||||
m_current_pos.y() -= shift-m_y_shift;
|
||||
m_y_shift = shift;
|
||||
return (*this);
|
||||
}
|
||||
|
@ -105,10 +116,10 @@ public:
|
|||
// Suppress / resume G-code preview in Slic3r. Slic3r will have difficulty to differentiate the various
|
||||
// filament loading and cooling moves from normal extrusion moves. Therefore the writer
|
||||
// is asked to suppres output of some lines, which look like extrusions.
|
||||
Writer& suppress_preview() { change_analyzer_line_width(0.f); m_preview_suppressed = true; return *this; }
|
||||
Writer& resume_preview() { change_analyzer_line_width(m_default_analyzer_line_width); m_preview_suppressed = false; return *this; }
|
||||
WipeTowerWriter& suppress_preview() { change_analyzer_line_width(0.f); m_preview_suppressed = true; return *this; }
|
||||
WipeTowerWriter& resume_preview() { change_analyzer_line_width(m_default_analyzer_line_width); m_preview_suppressed = false; return *this; }
|
||||
|
||||
Writer& feedrate(float f)
|
||||
WipeTowerWriter& feedrate(float f)
|
||||
{
|
||||
if (f != m_current_feedrate)
|
||||
m_gcode += "G1" + set_format_F(f) + "\n";
|
||||
|
@ -117,30 +128,30 @@ public:
|
|||
|
||||
const std::string& gcode() const { return m_gcode; }
|
||||
const std::vector<WipeTower::Extrusion>& extrusions() const { return m_extrusions; }
|
||||
float x() const { return m_current_pos.x; }
|
||||
float y() const { return m_current_pos.y; }
|
||||
const WipeTower::xy& pos() const { return m_current_pos; }
|
||||
const WipeTower::xy start_pos_rotated() const { return m_start_pos; }
|
||||
const WipeTower::xy pos_rotated() const { return WipeTower::xy(m_current_pos, 0.f, m_y_shift).rotate(m_wipe_tower_width, m_wipe_tower_depth, m_internal_angle); }
|
||||
float x() const { return m_current_pos.x(); }
|
||||
float y() const { return m_current_pos.y(); }
|
||||
const Vec2f& pos() const { return m_current_pos; }
|
||||
const Vec2f start_pos_rotated() const { return m_start_pos; }
|
||||
const Vec2f pos_rotated() const { return rotate(m_current_pos + Vec2f(0.f, m_y_shift), m_wipe_tower_width, m_wipe_tower_depth, m_internal_angle); }
|
||||
float elapsed_time() const { return m_elapsed_time; }
|
||||
float get_and_reset_used_filament_length() { float temp = m_used_filament_length; m_used_filament_length = 0.f; return temp; }
|
||||
|
||||
// Extrude with an explicitely provided amount of extrusion.
|
||||
Writer& extrude_explicit(float x, float y, float e, float f = 0.f, bool record_length = false, bool limit_volumetric_flow = true)
|
||||
WipeTowerWriter& extrude_explicit(float x, float y, float e, float f = 0.f, bool record_length = false, bool limit_volumetric_flow = true)
|
||||
{
|
||||
if (x == m_current_pos.x && y == m_current_pos.y && e == 0.f && (f == 0.f || f == m_current_feedrate))
|
||||
if (x == m_current_pos.x() && y == m_current_pos.y() && e == 0.f && (f == 0.f || f == m_current_feedrate))
|
||||
// Neither extrusion nor a travel move.
|
||||
return *this;
|
||||
|
||||
float dx = x - m_current_pos.x;
|
||||
float dy = y - m_current_pos.y;
|
||||
float dx = x - m_current_pos.x();
|
||||
float dy = y - m_current_pos.y();
|
||||
double len = sqrt(dx*dx+dy*dy);
|
||||
if (record_length)
|
||||
m_used_filament_length += e;
|
||||
|
||||
// Now do the "internal rotation" with respect to the wipe tower center
|
||||
WipeTower::xy rotated_current_pos(WipeTower::xy(m_current_pos,0.f,m_y_shift).rotate(m_wipe_tower_width, m_wipe_tower_depth, m_internal_angle)); // this is where we are
|
||||
WipeTower::xy rot(WipeTower::xy(x,y+m_y_shift).rotate(m_wipe_tower_width, m_wipe_tower_depth, m_internal_angle)); // this is where we want to go
|
||||
Vec2f rotated_current_pos(rotate(m_current_pos + Vec2f(0.f,m_y_shift), m_wipe_tower_width, m_wipe_tower_depth, m_internal_angle)); // this is where we are
|
||||
Vec2f rot(rotate(Vec2f(x,y+m_y_shift), m_wipe_tower_width, m_wipe_tower_depth, m_internal_angle)); // this is where we want to go
|
||||
|
||||
if (! m_preview_suppressed && e > 0.f && len > 0.) {
|
||||
change_analyzer_mm3_per_mm(len, e);
|
||||
|
@ -151,15 +162,15 @@ public:
|
|||
width += m_layer_height * float(1. - M_PI / 4.);
|
||||
if (m_extrusions.empty() || m_extrusions.back().pos != rotated_current_pos)
|
||||
m_extrusions.emplace_back(WipeTower::Extrusion(rotated_current_pos, 0, m_current_tool));
|
||||
m_extrusions.emplace_back(WipeTower::Extrusion(WipeTower::xy(rot.x, rot.y), width, m_current_tool));
|
||||
m_extrusions.emplace_back(WipeTower::Extrusion(rot, width, m_current_tool));
|
||||
}
|
||||
|
||||
m_gcode += "G1";
|
||||
if (std::abs(rot.x - rotated_current_pos.x) > EPSILON)
|
||||
m_gcode += set_format_X(rot.x);
|
||||
if (std::abs(rot.x() - rotated_current_pos.x()) > EPSILON)
|
||||
m_gcode += set_format_X(rot.x());
|
||||
|
||||
if (std::abs(rot.y - rotated_current_pos.y) > EPSILON)
|
||||
m_gcode += set_format_Y(rot.y);
|
||||
if (std::abs(rot.y() - rotated_current_pos.y()) > EPSILON)
|
||||
m_gcode += set_format_Y(rot.y());
|
||||
|
||||
|
||||
if (e != 0.f)
|
||||
|
@ -173,8 +184,8 @@ public:
|
|||
m_gcode += set_format_F(f);
|
||||
}
|
||||
|
||||
m_current_pos.x = x;
|
||||
m_current_pos.y = y;
|
||||
m_current_pos.x() = x;
|
||||
m_current_pos.y() = y;
|
||||
|
||||
// Update the elapsed time with a rough estimate.
|
||||
m_elapsed_time += ((len == 0) ? std::abs(e) : len) / m_current_feedrate * 60.f;
|
||||
|
@ -182,42 +193,42 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
Writer& extrude_explicit(const WipeTower::xy &dest, float e, float f = 0.f, bool record_length = false, bool limit_volumetric_flow = true)
|
||||
{ return extrude_explicit(dest.x, dest.y, e, f, record_length); }
|
||||
WipeTowerWriter& extrude_explicit(const Vec2f &dest, float e, float f = 0.f, bool record_length = false, bool limit_volumetric_flow = true)
|
||||
{ return extrude_explicit(dest.x(), dest.y(), e, f, record_length); }
|
||||
|
||||
// Travel to a new XY position. f=0 means use the current value.
|
||||
Writer& travel(float x, float y, float f = 0.f)
|
||||
WipeTowerWriter& travel(float x, float y, float f = 0.f)
|
||||
{ return extrude_explicit(x, y, 0.f, f); }
|
||||
|
||||
Writer& travel(const WipeTower::xy &dest, float f = 0.f)
|
||||
{ return extrude_explicit(dest.x, dest.y, 0.f, f); }
|
||||
WipeTowerWriter& travel(const Vec2f &dest, float f = 0.f)
|
||||
{ return extrude_explicit(dest.x(), dest.y(), 0.f, f); }
|
||||
|
||||
// Extrude a line from current position to x, y with the extrusion amount given by m_extrusion_flow.
|
||||
Writer& extrude(float x, float y, float f = 0.f)
|
||||
WipeTowerWriter& extrude(float x, float y, float f = 0.f)
|
||||
{
|
||||
float dx = x - m_current_pos.x;
|
||||
float dy = y - m_current_pos.y;
|
||||
float dx = x - m_current_pos.x();
|
||||
float dy = y - m_current_pos.y();
|
||||
return extrude_explicit(x, y, sqrt(dx*dx+dy*dy) * m_extrusion_flow, f, true);
|
||||
}
|
||||
|
||||
Writer& extrude(const WipeTower::xy &dest, const float f = 0.f)
|
||||
{ return extrude(dest.x, dest.y, f); }
|
||||
WipeTowerWriter& extrude(const Vec2f &dest, const float f = 0.f)
|
||||
{ return extrude(dest.x(), dest.y(), f); }
|
||||
|
||||
Writer& rectangle(const WipeTower::xy& ld,float width,float height,const float f = 0.f)
|
||||
WipeTowerWriter& rectangle(const Vec2f& ld,float width,float height,const float f = 0.f)
|
||||
{
|
||||
WipeTower::xy corners[4];
|
||||
Vec2f corners[4];
|
||||
corners[0] = ld;
|
||||
corners[1] = WipeTower::xy(ld,width,0.f);
|
||||
corners[2] = WipeTower::xy(ld,width,height);
|
||||
corners[3] = WipeTower::xy(ld,0.f,height);
|
||||
corners[1] = ld + Vec2f(width,0.f);
|
||||
corners[2] = ld + Vec2f(width,height);
|
||||
corners[3] = ld + Vec2f(0.f,height);
|
||||
int index_of_closest = 0;
|
||||
if (x()-ld.x > ld.x+width-x()) // closer to the right
|
||||
if (x()-ld.x() > ld.x()+width-x()) // closer to the right
|
||||
index_of_closest = 1;
|
||||
if (y()-ld.y > ld.y+height-y()) // closer to the top
|
||||
if (y()-ld.y() > ld.y()+height-y()) // closer to the top
|
||||
index_of_closest = (index_of_closest==0 ? 3 : 2);
|
||||
|
||||
travel(corners[index_of_closest].x, y()); // travel to the closest corner
|
||||
travel(x(),corners[index_of_closest].y);
|
||||
travel(corners[index_of_closest].x(), y()); // travel to the closest corner
|
||||
travel(x(),corners[index_of_closest].y());
|
||||
|
||||
int i = index_of_closest;
|
||||
do {
|
||||
|
@ -228,7 +239,7 @@ public:
|
|||
return (*this);
|
||||
}
|
||||
|
||||
Writer& load(float e, float f = 0.f)
|
||||
WipeTowerWriter& load(float e, float f = 0.f)
|
||||
{
|
||||
if (e == 0.f && (f == 0.f || f == m_current_feedrate))
|
||||
return *this;
|
||||
|
@ -244,14 +255,14 @@ public:
|
|||
// Derectract while moving in the X direction.
|
||||
// If |x| > 0, the feed rate relates to the x distance,
|
||||
// otherwise the feed rate relates to the e distance.
|
||||
Writer& load_move_x(float x, float e, float f = 0.f)
|
||||
{ return extrude_explicit(x, m_current_pos.y, e, f); }
|
||||
WipeTowerWriter& load_move_x(float x, float e, float f = 0.f)
|
||||
{ return extrude_explicit(x, m_current_pos.y(), e, f); }
|
||||
|
||||
Writer& retract(float e, float f = 0.f)
|
||||
WipeTowerWriter& retract(float e, float f = 0.f)
|
||||
{ return load(-e, f); }
|
||||
|
||||
// Loads filament while also moving towards given points in x-axis (x feedrate is limited by cutting the distance short if necessary)
|
||||
Writer& load_move_x_advanced(float farthest_x, float loading_dist, float loading_speed, float max_x_speed = 50.f)
|
||||
WipeTowerWriter& load_move_x_advanced(float farthest_x, float loading_dist, float loading_speed, float max_x_speed = 50.f)
|
||||
{
|
||||
float time = std::abs(loading_dist / loading_speed);
|
||||
float x_speed = std::min(max_x_speed, std::abs(farthest_x - x()) / time);
|
||||
|
@ -262,7 +273,7 @@ public:
|
|||
}
|
||||
|
||||
// Elevate the extruder head above the current print_z position.
|
||||
Writer& z_hop(float hop, float f = 0.f)
|
||||
WipeTowerWriter& z_hop(float hop, float f = 0.f)
|
||||
{
|
||||
m_gcode += std::string("G1") + set_format_Z(m_current_z + hop);
|
||||
if (f != 0 && f != m_current_feedrate)
|
||||
|
@ -272,29 +283,29 @@ public:
|
|||
}
|
||||
|
||||
// Lower the extruder head back to the current print_z position.
|
||||
Writer& z_hop_reset(float f = 0.f)
|
||||
WipeTowerWriter& z_hop_reset(float f = 0.f)
|
||||
{ return z_hop(0, f); }
|
||||
|
||||
// Move to x1, +y_increment,
|
||||
// extrude quickly amount e to x2 with feed f.
|
||||
Writer& ram(float x1, float x2, float dy, float e0, float e, float f)
|
||||
WipeTowerWriter& ram(float x1, float x2, float dy, float e0, float e, float f)
|
||||
{
|
||||
extrude_explicit(x1, m_current_pos.y + dy, e0, f, true, false);
|
||||
extrude_explicit(x2, m_current_pos.y, e, 0.f, true, false);
|
||||
extrude_explicit(x1, m_current_pos.y() + dy, e0, f, true, false);
|
||||
extrude_explicit(x2, m_current_pos.y(), e, 0.f, true, false);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Let the end of the pulled out filament cool down in the cooling tube
|
||||
// by moving up and down and moving the print head left / right
|
||||
// at the current Y position to spread the leaking material.
|
||||
Writer& cool(float x1, float x2, float e1, float e2, float f)
|
||||
WipeTowerWriter& cool(float x1, float x2, float e1, float e2, float f)
|
||||
{
|
||||
extrude_explicit(x1, m_current_pos.y, e1, f);
|
||||
extrude_explicit(x2, m_current_pos.y, e2);
|
||||
extrude_explicit(x1, m_current_pos.y(), e1, f);
|
||||
extrude_explicit(x2, m_current_pos.y(), e2);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Writer& set_tool(int tool)
|
||||
WipeTowerWriter& set_tool(int tool)
|
||||
{
|
||||
char buf[64];
|
||||
sprintf(buf, "T%d\n", tool);
|
||||
|
@ -304,7 +315,7 @@ public:
|
|||
}
|
||||
|
||||
// Set extruder temperature, don't wait by default.
|
||||
Writer& set_extruder_temp(int temperature, bool wait = false)
|
||||
WipeTowerWriter& set_extruder_temp(int temperature, bool wait = false)
|
||||
{
|
||||
char buf[128];
|
||||
sprintf(buf, "M%d S%d\n", wait ? 109 : 104, temperature);
|
||||
|
@ -313,7 +324,7 @@ public:
|
|||
};
|
||||
|
||||
// Wait for a period of time (seconds).
|
||||
Writer& wait(float time)
|
||||
WipeTowerWriter& wait(float time)
|
||||
{
|
||||
if (time==0)
|
||||
return *this;
|
||||
|
@ -324,7 +335,7 @@ public:
|
|||
};
|
||||
|
||||
// Set speed factor override percentage.
|
||||
Writer& speed_override(int speed)
|
||||
WipeTowerWriter& speed_override(int speed)
|
||||
{
|
||||
char buf[128];
|
||||
sprintf(buf, "M220 S%d\n", speed);
|
||||
|
@ -333,21 +344,21 @@ public:
|
|||
};
|
||||
|
||||
// Let the firmware back up the active speed override value.
|
||||
Writer& speed_override_backup()
|
||||
WipeTowerWriter& speed_override_backup()
|
||||
{
|
||||
m_gcode += "M220 B\n";
|
||||
return *this;
|
||||
};
|
||||
|
||||
// Let the firmware restore the active speed override value.
|
||||
Writer& speed_override_restore()
|
||||
WipeTowerWriter& speed_override_restore()
|
||||
{
|
||||
m_gcode += "M220 R\n";
|
||||
return *this;
|
||||
};
|
||||
|
||||
// Set digital trimpot motor
|
||||
Writer& set_extruder_trimpot(int current)
|
||||
WipeTowerWriter& set_extruder_trimpot(int current)
|
||||
{
|
||||
char buf[128];
|
||||
if (m_gcode_flavor == gcfRepRap)
|
||||
|
@ -358,20 +369,20 @@ public:
|
|||
return *this;
|
||||
};
|
||||
|
||||
Writer& flush_planner_queue()
|
||||
WipeTowerWriter& flush_planner_queue()
|
||||
{
|
||||
m_gcode += "G4 S0\n";
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Reset internal extruder counter.
|
||||
Writer& reset_extruder()
|
||||
WipeTowerWriter& reset_extruder()
|
||||
{
|
||||
m_gcode += "G92 E0\n";
|
||||
return *this;
|
||||
}
|
||||
|
||||
Writer& comment_with_value(const char *comment, int value)
|
||||
WipeTowerWriter& comment_with_value(const char *comment, int value)
|
||||
{
|
||||
char strvalue[64];
|
||||
sprintf(strvalue, "%d", value);
|
||||
|
@ -380,7 +391,7 @@ public:
|
|||
};
|
||||
|
||||
|
||||
Writer& set_fan(unsigned int speed)
|
||||
WipeTowerWriter& set_fan(unsigned int speed)
|
||||
{
|
||||
if (speed == m_last_fan_speed)
|
||||
return *this;
|
||||
|
@ -398,11 +409,11 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
Writer& append(const char *text) { m_gcode += text; return *this; }
|
||||
WipeTowerWriter& append(const char *text) { m_gcode += text; return *this; }
|
||||
|
||||
private:
|
||||
WipeTower::xy m_start_pos;
|
||||
WipeTower::xy m_current_pos;
|
||||
Vec2f m_start_pos;
|
||||
Vec2f m_current_pos;
|
||||
float m_current_z;
|
||||
float m_current_feedrate;
|
||||
unsigned int m_current_tool;
|
||||
|
@ -421,20 +432,20 @@ private:
|
|||
const float m_default_analyzer_line_width;
|
||||
float m_used_filament_length = 0.f;
|
||||
GCodeFlavor m_gcode_flavor;
|
||||
const std::vector<WipeTowerPrusaMM::FilamentParameters>& m_filpar;
|
||||
const std::vector<WipeTower::FilamentParameters>& m_filpar;
|
||||
|
||||
std::string set_format_X(float x)
|
||||
{
|
||||
char buf[64];
|
||||
sprintf(buf, " X%.3f", x);
|
||||
m_current_pos.x = x;
|
||||
m_current_pos.x() = x;
|
||||
return buf;
|
||||
}
|
||||
|
||||
std::string set_format_Y(float y) {
|
||||
char buf[64];
|
||||
sprintf(buf, " Y%.3f", y);
|
||||
m_current_pos.y = y;
|
||||
m_current_pos.y() = y;
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -457,14 +468,13 @@ private:
|
|||
return buf;
|
||||
}
|
||||
|
||||
Writer& operator=(const Writer &rhs);
|
||||
}; // class Writer
|
||||
WipeTowerWriter& operator=(const WipeTowerWriter &rhs);
|
||||
}; // class WipeTowerWriter
|
||||
|
||||
}; // namespace PrusaMultiMaterial
|
||||
|
||||
|
||||
// Returns gcode to prime the nozzles at the front edge of the print bed.
|
||||
std::vector<WipeTower::ToolChangeResult> WipeTowerPrusaMM::prime(
|
||||
std::vector<WipeTower::ToolChangeResult> WipeTower::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.
|
||||
|
@ -482,7 +492,7 @@ std::vector<WipeTower::ToolChangeResult> WipeTowerPrusaMM::prime(
|
|||
// box_coordinates cleaning_box(xy(0.5f, - 1.5f), m_wipe_tower_width, wipe_area);
|
||||
|
||||
const float prime_section_width = std::min(240.f / tools.size(), 60.f);
|
||||
box_coordinates cleaning_box(xy(5.f, 0.01f + m_perimeter_width/2.f), prime_section_width, 100.f);
|
||||
box_coordinates cleaning_box(Vec2f(5.f, 0.01f + m_perimeter_width/2.f), prime_section_width, 100.f);
|
||||
|
||||
|
||||
std::vector<ToolChangeResult> results;
|
||||
|
@ -491,7 +501,7 @@ std::vector<WipeTower::ToolChangeResult> WipeTowerPrusaMM::prime(
|
|||
for (size_t idx_tool = 0; idx_tool < tools.size(); ++ idx_tool) {
|
||||
int old_tool = m_current_tool;
|
||||
|
||||
PrusaMultiMaterial::Writer writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar);
|
||||
WipeTowerWriter writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar);
|
||||
writer.set_extrusion_flow(m_extrusion_flow)
|
||||
.set_z(m_z_pos)
|
||||
.set_initial_tool(m_current_tool);
|
||||
|
@ -503,7 +513,7 @@ std::vector<WipeTower::ToolChangeResult> WipeTowerPrusaMM::prime(
|
|||
.append(";--------------------\n")
|
||||
.speed_override_backup()
|
||||
.speed_override(100)
|
||||
.set_initial_position(xy(0.f, 0.f)) // Always move to the starting position
|
||||
.set_initial_position(Vec2f::Zero()) // Always move to the starting position
|
||||
.travel(cleaning_box.ld, 7200);
|
||||
if (m_set_extruder_trimpot)
|
||||
writer.set_extruder_trimpot(750); // Increase the extruder driver current to allow fast ramming.
|
||||
|
@ -524,7 +534,7 @@ std::vector<WipeTower::ToolChangeResult> WipeTowerPrusaMM::prime(
|
|||
//writer.travel(writer.x(), writer.y() + m_perimeter_width, 7200);
|
||||
toolchange_Wipe(writer, cleaning_box , 20.f);
|
||||
box_coordinates box = cleaning_box;
|
||||
box.translate(0.f, writer.y() - cleaning_box.ld.y + m_perimeter_width);
|
||||
box.translate(0.f, writer.y() - cleaning_box.ld.y() + m_perimeter_width);
|
||||
toolchange_Unload(writer, box , m_filpar[m_current_tool].material, m_filpar[tools[idx_tool + 1]].first_layer_temperature);
|
||||
cleaning_box.translate(prime_section_width, 0.f);
|
||||
writer.travel(cleaning_box.ld, 7200);
|
||||
|
@ -574,7 +584,7 @@ std::vector<WipeTower::ToolChangeResult> WipeTowerPrusaMM::prime(
|
|||
return results;
|
||||
}
|
||||
|
||||
WipeTower::ToolChangeResult WipeTowerPrusaMM::tool_change(unsigned int tool, bool last_in_layer)
|
||||
WipeTower::ToolChangeResult WipeTower::tool_change(unsigned int tool, bool last_in_layer)
|
||||
{
|
||||
if ( m_print_brim )
|
||||
return toolchange_Brim();
|
||||
|
@ -602,12 +612,12 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::tool_change(unsigned int tool, boo
|
|||
}
|
||||
|
||||
box_coordinates cleaning_box(
|
||||
xy(m_perimeter_width / 2.f, m_perimeter_width / 2.f),
|
||||
Vec2f(m_perimeter_width / 2.f, m_perimeter_width / 2.f),
|
||||
m_wipe_tower_width - m_perimeter_width,
|
||||
(tool != (unsigned int)(-1) ? /*m_layer_info->depth*/wipe_area+m_depth_traversed-0.5*m_perimeter_width
|
||||
: m_wipe_tower_depth-m_perimeter_width));
|
||||
|
||||
PrusaMultiMaterial::Writer writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar);
|
||||
WipeTowerWriter writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar);
|
||||
writer.set_extrusion_flow(m_extrusion_flow)
|
||||
.set_z(m_z_pos)
|
||||
.set_initial_tool(m_current_tool)
|
||||
|
@ -623,7 +633,7 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::tool_change(unsigned int tool, boo
|
|||
writer.speed_override_backup();
|
||||
writer.speed_override(100);
|
||||
|
||||
xy initial_position = cleaning_box.ld + WipeTower::xy(0.f,m_depth_traversed);
|
||||
Vec2f initial_position = cleaning_box.ld + Vec2f(0.f, m_depth_traversed);
|
||||
writer.set_initial_position(initial_position, m_wipe_tower_width, m_wipe_tower_depth, m_internal_rotation);
|
||||
|
||||
// Increase the extruder driver current to allow fast ramming.
|
||||
|
@ -647,9 +657,9 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::tool_change(unsigned int tool, boo
|
|||
if (last_change_in_layer) {// draw perimeter line
|
||||
writer.set_y_shift(m_y_shift);
|
||||
if (m_peters_wipe_tower)
|
||||
writer.rectangle(WipeTower::xy(0.f, 0.f),m_layer_info->depth + 3*m_perimeter_width,m_wipe_tower_depth);
|
||||
writer.rectangle(Vec2f::Zero(), m_layer_info->depth + 3*m_perimeter_width, m_wipe_tower_depth);
|
||||
else {
|
||||
writer.rectangle(WipeTower::xy(0.f, 0.f),m_wipe_tower_width, m_layer_info->depth + m_perimeter_width);
|
||||
writer.rectangle(Vec2f::Zero(), m_wipe_tower_width, m_layer_info->depth + m_perimeter_width);
|
||||
if (layer_finished()) { // no finish_layer will be called, we must wipe the nozzle
|
||||
writer.travel(writer.x()> m_wipe_tower_width / 2.f ? 0.f : m_wipe_tower_width, writer.y());
|
||||
}
|
||||
|
@ -684,27 +694,27 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::tool_change(unsigned int tool, boo
|
|||
return result;
|
||||
}
|
||||
|
||||
WipeTower::ToolChangeResult WipeTowerPrusaMM::toolchange_Brim(bool sideOnly, float y_offset)
|
||||
WipeTower::ToolChangeResult WipeTower::toolchange_Brim(bool sideOnly, float y_offset)
|
||||
{
|
||||
int old_tool = m_current_tool;
|
||||
|
||||
const box_coordinates wipeTower_box(
|
||||
WipeTower::xy(0.f, 0.f),
|
||||
Vec2f::Zero(),
|
||||
m_wipe_tower_width,
|
||||
m_wipe_tower_depth);
|
||||
|
||||
PrusaMultiMaterial::Writer writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar);
|
||||
WipeTowerWriter writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar);
|
||||
writer.set_extrusion_flow(m_extrusion_flow * 1.1f)
|
||||
.set_z(m_z_pos) // Let the writer know the current Z position as a base for Z-hop.
|
||||
.set_initial_tool(m_current_tool)
|
||||
.append(";-------------------------------------\n"
|
||||
"; CP WIPE TOWER FIRST LAYER BRIM START\n");
|
||||
|
||||
xy initial_position = wipeTower_box.lu - xy(m_perimeter_width * 6.f, 0);
|
||||
Vec2f initial_position = wipeTower_box.lu - Vec2f(m_perimeter_width * 6.f, 0);
|
||||
writer.set_initial_position(initial_position, m_wipe_tower_width, m_wipe_tower_depth, m_internal_rotation);
|
||||
|
||||
writer.extrude_explicit(wipeTower_box.ld - xy(m_perimeter_width * 6.f, 0), // Prime the extruder left of the wipe tower.
|
||||
1.5f * m_extrusion_flow * (wipeTower_box.lu.y - wipeTower_box.ld.y), 2400);
|
||||
writer.extrude_explicit(wipeTower_box.ld - Vec2f(m_perimeter_width * 6.f, 0), // Prime the extruder left of the wipe tower.
|
||||
1.5f * m_extrusion_flow * (wipeTower_box.lu.y() - wipeTower_box.ld.y()), 2400);
|
||||
|
||||
// The tool is supposed to be active and primed at the time when the wipe tower brim is extruded.
|
||||
// Extrude 4 rounds of a brim around the future wipe tower.
|
||||
|
@ -745,14 +755,14 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::toolchange_Brim(bool sideOnly, flo
|
|||
|
||||
|
||||
// Ram the hot material out of the melt zone, retract the filament into the cooling tubes and let it cool.
|
||||
void WipeTowerPrusaMM::toolchange_Unload(
|
||||
PrusaMultiMaterial::Writer &writer,
|
||||
void WipeTower::toolchange_Unload(
|
||||
WipeTowerWriter &writer,
|
||||
const box_coordinates &cleaning_box,
|
||||
const std::string& current_material,
|
||||
const int new_temperature)
|
||||
{
|
||||
float xl = cleaning_box.ld.x + 1.f * m_perimeter_width;
|
||||
float xr = cleaning_box.rd.x - 1.f * m_perimeter_width;
|
||||
float xl = cleaning_box.ld.x() + 1.f * m_perimeter_width;
|
||||
float xr = cleaning_box.rd.x() - 1.f * m_perimeter_width;
|
||||
|
||||
const float line_width = m_perimeter_width * m_filpar[m_current_tool].ramming_line_width_multiplicator; // desired ramming line thickness
|
||||
const float y_step = line_width * m_filpar[m_current_tool].ramming_step_multiplicator * m_extra_spacing; // spacing between lines in mm
|
||||
|
@ -765,7 +775,7 @@ void WipeTowerPrusaMM::toolchange_Unload(
|
|||
float remaining = xr - xl ; // keeps track of distance to the next turnaround
|
||||
float e_done = 0; // measures E move done from each segment
|
||||
|
||||
writer.travel(xl, cleaning_box.ld.y + m_depth_traversed + y_step/2.f ); // move to starting position
|
||||
writer.travel(xl, cleaning_box.ld.y() + m_depth_traversed + y_step/2.f ); // move to starting position
|
||||
|
||||
// if the ending point of the ram would end up in mid air, align it with the end of the wipe tower:
|
||||
if (m_layer_info > m_plan.begin() && m_layer_info < m_plan.end() && (m_layer_info-1!=m_plan.begin() || !m_adhesion )) {
|
||||
|
@ -832,7 +842,7 @@ void WipeTowerPrusaMM::toolchange_Unload(
|
|||
e_done = 0;
|
||||
}
|
||||
}
|
||||
WipeTower::xy end_of_ramming(writer.x(),writer.y());
|
||||
Vec2f end_of_ramming(writer.x(),writer.y());
|
||||
writer.change_analyzer_line_width(m_perimeter_width); // so the next lines are not affected by ramming_line_width_multiplier
|
||||
|
||||
// Retraction:
|
||||
|
@ -887,15 +897,15 @@ void WipeTowerPrusaMM::toolchange_Unload(
|
|||
|
||||
// this is to align ramming and future wiping extrusions, so the future y-steps can be uniform from the start:
|
||||
// the perimeter_width will later be subtracted, it is there to not load while moving over just extruded material
|
||||
writer.travel(end_of_ramming.x, end_of_ramming.y + (y_step/m_extra_spacing-m_perimeter_width) / 2.f + m_perimeter_width, 2400.f);
|
||||
writer.travel(end_of_ramming.x(), end_of_ramming.y() + (y_step/m_extra_spacing-m_perimeter_width) / 2.f + m_perimeter_width, 2400.f);
|
||||
|
||||
writer.resume_preview()
|
||||
.flush_planner_queue();
|
||||
}
|
||||
|
||||
// Change the tool, set a speed override for soluble and flex materials.
|
||||
void WipeTowerPrusaMM::toolchange_Change(
|
||||
PrusaMultiMaterial::Writer &writer,
|
||||
void WipeTower::toolchange_Change(
|
||||
WipeTowerWriter &writer,
|
||||
const unsigned int new_tool,
|
||||
const std::string& new_material)
|
||||
{
|
||||
|
@ -917,13 +927,13 @@ void WipeTowerPrusaMM::toolchange_Change(
|
|||
m_current_tool = new_tool;
|
||||
}
|
||||
|
||||
void WipeTowerPrusaMM::toolchange_Load(
|
||||
PrusaMultiMaterial::Writer &writer,
|
||||
void WipeTower::toolchange_Load(
|
||||
WipeTowerWriter &writer,
|
||||
const box_coordinates &cleaning_box)
|
||||
{
|
||||
if (m_semm && (m_parking_pos_retraction != 0 || m_extra_loading_move != 0)) {
|
||||
float xl = cleaning_box.ld.x + m_perimeter_width * 0.75f;
|
||||
float xr = cleaning_box.rd.x - m_perimeter_width * 0.75f;
|
||||
float xl = cleaning_box.ld.x() + m_perimeter_width * 0.75f;
|
||||
float xr = cleaning_box.rd.x() - m_perimeter_width * 0.75f;
|
||||
float oldx = writer.x(); // the nozzle is in place to do the first wiping moves, we will remember the position
|
||||
|
||||
// Load the filament while moving left / right, so the excess material will not create a blob at a single position.
|
||||
|
@ -951,8 +961,8 @@ void WipeTowerPrusaMM::toolchange_Load(
|
|||
}
|
||||
|
||||
// Wipe the newly loaded filament until the end of the assigned wipe area.
|
||||
void WipeTowerPrusaMM::toolchange_Wipe(
|
||||
PrusaMultiMaterial::Writer &writer,
|
||||
void WipeTower::toolchange_Wipe(
|
||||
WipeTowerWriter &writer,
|
||||
const box_coordinates &cleaning_box,
|
||||
float wipe_volume)
|
||||
{
|
||||
|
@ -960,8 +970,8 @@ void WipeTowerPrusaMM::toolchange_Wipe(
|
|||
writer.set_extrusion_flow(m_extrusion_flow * (m_is_first_layer ? 1.18f : 1.f))
|
||||
.append("; CP TOOLCHANGE WIPE\n");
|
||||
float wipe_coeff = m_is_first_layer ? 0.5f : 1.f;
|
||||
const float& xl = cleaning_box.ld.x;
|
||||
const float& xr = cleaning_box.rd.x;
|
||||
const float& xl = cleaning_box.ld.x();
|
||||
const float& xr = cleaning_box.rd.x();
|
||||
|
||||
// Variables x_to_wipe and traversed_x are here to be able to make sure it always wipes at least
|
||||
// the ordered volume, even if it means violating the box. This can later be removed and simply
|
||||
|
@ -992,7 +1002,7 @@ void WipeTowerPrusaMM::toolchange_Wipe(
|
|||
else
|
||||
writer.extrude(xl + (i % 4 == 1 ? 0 : 1.5*m_perimeter_width), writer.y(), wipe_speed * wipe_coeff);
|
||||
|
||||
if (writer.y()+EPSILON > cleaning_box.lu.y-0.5f*m_perimeter_width)
|
||||
if (writer.y()+EPSILON > cleaning_box.lu.y()-0.5f*m_perimeter_width)
|
||||
break; // in case next line would not fit
|
||||
|
||||
traversed_x -= writer.x();
|
||||
|
@ -1019,7 +1029,7 @@ void WipeTowerPrusaMM::toolchange_Wipe(
|
|||
|
||||
|
||||
|
||||
WipeTower::ToolChangeResult WipeTowerPrusaMM::finish_layer()
|
||||
WipeTower::ToolChangeResult WipeTower::finish_layer()
|
||||
{
|
||||
// This should only be called if the layer is not finished yet.
|
||||
// Otherwise the caller would likely travel to the wipe tower in vain.
|
||||
|
@ -1027,7 +1037,7 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::finish_layer()
|
|||
|
||||
int old_tool = m_current_tool;
|
||||
|
||||
PrusaMultiMaterial::Writer writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar);
|
||||
WipeTowerWriter writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar);
|
||||
writer.set_extrusion_flow(m_extrusion_flow)
|
||||
.set_z(m_z_pos)
|
||||
.set_initial_tool(m_current_tool)
|
||||
|
@ -1039,7 +1049,7 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::finish_layer()
|
|||
// Slow down on the 1st layer.
|
||||
float speed_factor = m_is_first_layer ? 0.5f : 1.f;
|
||||
float current_depth = m_layer_info->depth - m_layer_info->toolchanges_depth();
|
||||
box_coordinates fill_box(xy(m_perimeter_width, m_depth_traversed + m_perimeter_width),
|
||||
box_coordinates fill_box(Vec2f(m_perimeter_width, m_depth_traversed + m_perimeter_width),
|
||||
m_wipe_tower_width - 2 * m_perimeter_width, current_depth-m_perimeter_width);
|
||||
|
||||
|
||||
|
@ -1053,44 +1063,44 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::finish_layer()
|
|||
else box.expand(-m_perimeter_width);
|
||||
}
|
||||
else i=2; // only draw the inner perimeter, outer has been already drawn by tool_change(...)
|
||||
writer.rectangle(box.ld,box.rd.x-box.ld.x,box.ru.y-box.rd.y,2900*speed_factor);
|
||||
writer.rectangle(box.ld, box.rd.x()-box.ld.x(), box.ru.y()-box.rd.y(), 2900*speed_factor);
|
||||
}
|
||||
|
||||
// we are in one of the corners, travel to ld along the perimeter:
|
||||
if (writer.x() > fill_box.ld.x+EPSILON) writer.travel(fill_box.ld.x,writer.y());
|
||||
if (writer.y() > fill_box.ld.y+EPSILON) writer.travel(writer.x(),fill_box.ld.y);
|
||||
if (writer.x() > fill_box.ld.x()+EPSILON) writer.travel(fill_box.ld.x(),writer.y());
|
||||
if (writer.y() > fill_box.ld.y()+EPSILON) writer.travel(writer.x(),fill_box.ld.y());
|
||||
|
||||
if (m_is_first_layer && m_adhesion) {
|
||||
// Extrude a dense infill at the 1st layer to improve 1st layer adhesion of the wipe tower.
|
||||
box.expand(-m_perimeter_width/2.f);
|
||||
int nsteps = int(floor((box.lu.y - box.ld.y) / (2*m_perimeter_width)));
|
||||
float step = (box.lu.y - box.ld.y) / nsteps;
|
||||
writer.travel(box.ld-xy(m_perimeter_width/2.f,m_perimeter_width/2.f));
|
||||
int nsteps = int(floor((box.lu.y() - box.ld.y()) / (2*m_perimeter_width)));
|
||||
float step = (box.lu.y() - box.ld.y()) / nsteps;
|
||||
writer.travel(box.ld - Vec2f(m_perimeter_width/2.f, m_perimeter_width/2.f));
|
||||
if (nsteps >= 0)
|
||||
for (int i = 0; i < nsteps; ++i) {
|
||||
writer.extrude(box.ld.x+m_perimeter_width/2.f, writer.y() + 0.5f * step);
|
||||
writer.extrude(box.rd.x - m_perimeter_width / 2.f, writer.y());
|
||||
writer.extrude(box.rd.x - m_perimeter_width / 2.f, writer.y() + 0.5f * step);
|
||||
writer.extrude(box.ld.x + m_perimeter_width / 2.f, writer.y());
|
||||
writer.extrude(box.ld.x()+m_perimeter_width/2.f, writer.y() + 0.5f * step);
|
||||
writer.extrude(box.rd.x() - m_perimeter_width / 2.f, writer.y());
|
||||
writer.extrude(box.rd.x() - m_perimeter_width / 2.f, writer.y() + 0.5f * step);
|
||||
writer.extrude(box.ld.x() + m_perimeter_width / 2.f, writer.y());
|
||||
}
|
||||
writer.travel(box.rd.x-m_perimeter_width/2.f,writer.y()); // wipe the nozzle
|
||||
writer.travel(box.rd.x()-m_perimeter_width/2.f,writer.y()); // wipe the nozzle
|
||||
}
|
||||
else { // Extrude a sparse infill to support the material to be printed above.
|
||||
const float dy = (fill_box.lu.y - fill_box.ld.y - m_perimeter_width);
|
||||
const float left = fill_box.lu.x+2*m_perimeter_width;
|
||||
const float right = fill_box.ru.x - 2 * m_perimeter_width;
|
||||
const float dy = (fill_box.lu.y() - fill_box.ld.y() - m_perimeter_width);
|
||||
const float left = fill_box.lu.x() + 2*m_perimeter_width;
|
||||
const float right = fill_box.ru.x() - 2 * m_perimeter_width;
|
||||
if (dy > m_perimeter_width)
|
||||
{
|
||||
// Extrude an inverse U at the left of the region.
|
||||
writer.travel(fill_box.ld + xy(m_perimeter_width * 2, 0.f))
|
||||
.extrude(fill_box.lu + xy(m_perimeter_width * 2, 0.f), 2900 * speed_factor);
|
||||
writer.travel(fill_box.ld + Vec2f(m_perimeter_width * 2, 0.f))
|
||||
.extrude(fill_box.lu + Vec2f(m_perimeter_width * 2, 0.f), 2900 * speed_factor);
|
||||
|
||||
const int n = 1+(right-left)/(m_bridging);
|
||||
const float dx = (right-left)/n;
|
||||
for (int i=1;i<=n;++i) {
|
||||
float x=left+dx*i;
|
||||
writer.travel(x,writer.y());
|
||||
writer.extrude(x,i%2 ? fill_box.rd.y : fill_box.ru.y);
|
||||
writer.extrude(x,i%2 ? fill_box.rd.y() : fill_box.ru.y());
|
||||
}
|
||||
writer.travel(left,writer.y(),7200); // wipes the nozzle before moving away from the wipe tower
|
||||
}
|
||||
|
@ -1121,7 +1131,7 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::finish_layer()
|
|||
}
|
||||
|
||||
// Appends a toolchange into m_plan and calculates neccessary depth of the corresponding box
|
||||
void WipeTowerPrusaMM::plan_toolchange(float z_par, float layer_height_par, unsigned int old_tool, unsigned int new_tool, bool brim, float wipe_volume)
|
||||
void WipeTower::plan_toolchange(float z_par, float layer_height_par, unsigned int old_tool, unsigned int new_tool, bool brim, float wipe_volume)
|
||||
{
|
||||
assert(m_plan.empty() || m_plan.back().z <= z_par + WT_EPSILON); // refuses to add a layer below the last one
|
||||
|
||||
|
@ -1157,7 +1167,7 @@ void WipeTowerPrusaMM::plan_toolchange(float z_par, float layer_height_par, unsi
|
|||
|
||||
|
||||
|
||||
void WipeTowerPrusaMM::plan_tower()
|
||||
void WipeTower::plan_tower()
|
||||
{
|
||||
// Calculate m_wipe_tower_depth (maximum depth for all the layers) and propagate depths downwards
|
||||
m_wipe_tower_depth = 0.f;
|
||||
|
@ -1180,7 +1190,7 @@ void WipeTowerPrusaMM::plan_tower()
|
|||
}
|
||||
}
|
||||
|
||||
void WipeTowerPrusaMM::save_on_last_wipe()
|
||||
void WipeTower::save_on_last_wipe()
|
||||
{
|
||||
for (m_layer_info=m_plan.begin();m_layer_info<m_plan.end();++m_layer_info) {
|
||||
set_layer(m_layer_info->z, m_layer_info->height, 0, m_layer_info->z == m_plan.front().z, m_layer_info->z == m_plan.back().z);
|
||||
|
@ -1205,7 +1215,7 @@ void WipeTowerPrusaMM::save_on_last_wipe()
|
|||
|
||||
// Processes vector m_plan and calls respective functions to generate G-code for the wipe tower
|
||||
// Resulting ToolChangeResults are appended into vector "result"
|
||||
void WipeTowerPrusaMM::generate(std::vector<std::vector<WipeTower::ToolChangeResult>> &result)
|
||||
void WipeTower::generate(std::vector<std::vector<WipeTower::ToolChangeResult>> &result)
|
||||
{
|
||||
if (m_plan.empty())
|
||||
|
||||
|
@ -1251,7 +1261,7 @@ void WipeTowerPrusaMM::generate(std::vector<std::vector<WipeTower::ToolChangeRes
|
|||
auto& last_toolchange = layer_result.back();
|
||||
if (last_toolchange.end_pos != finish_layer_toolchange.start_pos) {
|
||||
char buf[2048]; // Add a travel move from tc1.end_pos to tc2.start_pos.
|
||||
sprintf(buf, "G1 X%.3f Y%.3f F7200\n", finish_layer_toolchange.start_pos.x, finish_layer_toolchange.start_pos.y);
|
||||
sprintf(buf, "G1 X%.3f Y%.3f F7200\n", finish_layer_toolchange.start_pos.x(), finish_layer_toolchange.start_pos.y());
|
||||
last_toolchange.gcode += buf;
|
||||
}
|
||||
last_toolchange.gcode += finish_layer_toolchange.gcode;
|
||||
|
@ -1267,7 +1277,7 @@ void WipeTowerPrusaMM::generate(std::vector<std::vector<WipeTower::ToolChangeRes
|
|||
}
|
||||
}
|
||||
|
||||
void WipeTowerPrusaMM::make_wipe_tower_square()
|
||||
void WipeTower::make_wipe_tower_square()
|
||||
{
|
||||
const float width = m_wipe_tower_width - 3 * m_perimeter_width;
|
||||
const float depth = m_wipe_tower_depth - m_perimeter_width;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue