2019-06-17 08:16:07 +00:00
|
|
|
#ifndef WipeTower_
|
|
|
|
#define WipeTower_
|
2017-05-16 11:45:28 +00:00
|
|
|
|
2017-05-16 14:02:52 +00:00
|
|
|
#include <cmath>
|
2017-05-16 11:45:28 +00:00
|
|
|
#include <string>
|
2018-02-28 15:04:56 +00:00
|
|
|
#include <sstream>
|
2017-05-16 11:45:28 +00:00
|
|
|
#include <utility>
|
2018-05-31 14:21:10 +00:00
|
|
|
#include <algorithm>
|
2017-05-16 11:45:28 +00:00
|
|
|
|
2019-06-17 08:16:07 +00:00
|
|
|
#include "libslic3r/PrintConfig.hpp"
|
2017-05-16 11:45:28 +00:00
|
|
|
|
2018-02-28 15:04:56 +00:00
|
|
|
|
2017-05-16 11:45:28 +00:00
|
|
|
namespace Slic3r
|
|
|
|
{
|
|
|
|
|
2019-06-17 08:16:07 +00:00
|
|
|
class WipeTowerWriter;
|
2017-05-16 11:45:28 +00:00
|
|
|
|
2018-02-28 15:04:56 +00:00
|
|
|
|
|
|
|
|
2019-06-17 08:16:07 +00:00
|
|
|
class WipeTower
|
2017-05-16 11:45:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-06-17 08:16:07 +00:00
|
|
|
struct Extrusion
|
|
|
|
{
|
|
|
|
Extrusion(const Vec2f &pos, float width, unsigned int tool) : pos(pos), width(width), tool(tool) {}
|
|
|
|
// End position of this extrusion.
|
|
|
|
Vec2f pos;
|
|
|
|
// Width of a squished extrusion, corrected for the roundings of the squished extrusions.
|
|
|
|
// This is left zero if it is a travel move.
|
|
|
|
float width;
|
|
|
|
// Current extruder index.
|
|
|
|
unsigned int tool;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ToolChangeResult
|
|
|
|
{
|
|
|
|
// Print heigh of this tool change.
|
|
|
|
float print_z;
|
|
|
|
float layer_height;
|
|
|
|
// G-code section to be directly included into the output G-code.
|
|
|
|
std::string gcode;
|
|
|
|
// For path preview.
|
|
|
|
std::vector<Extrusion> extrusions;
|
|
|
|
// Initial position, at which the wipe tower starts its action.
|
|
|
|
// At this position the extruder is loaded and there is no Z-hop applied.
|
|
|
|
Vec2f start_pos;
|
|
|
|
// Last point, at which the normal G-code generator of Slic3r shall continue.
|
|
|
|
// At this position the extruder is loaded and there is no Z-hop applied.
|
|
|
|
Vec2f end_pos;
|
|
|
|
// Time elapsed over this tool change.
|
|
|
|
// This is useful not only for the print time estimation, but also for the control of layer cooling.
|
|
|
|
float elapsed_time;
|
|
|
|
|
|
|
|
// Is this a priming extrusion? (If so, the wipe tower rotation & translation will not be applied later)
|
|
|
|
bool priming;
|
|
|
|
|
|
|
|
// Initial tool
|
|
|
|
int initial_tool;
|
|
|
|
|
|
|
|
// New tool
|
|
|
|
int new_tool;
|
|
|
|
|
|
|
|
// Sum the total length of the extrusion.
|
|
|
|
float total_extrusion_length_in_plane() {
|
|
|
|
float e_length = 0.f;
|
|
|
|
for (size_t i = 1; i < this->extrusions.size(); ++ i) {
|
|
|
|
const Extrusion &e = this->extrusions[i];
|
|
|
|
if (e.width > 0) {
|
|
|
|
Vec2f v = e.pos - (&e - 1)->pos;
|
|
|
|
e_length += v.norm();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return e_length;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-05-16 11:45:28 +00:00
|
|
|
// x -- x coordinates of wipe tower in mm ( left bottom corner )
|
|
|
|
// y -- y coordinates of wipe tower in mm ( left bottom corner )
|
|
|
|
// width -- width of wipe tower in mm ( default 60 mm - leave as it is )
|
|
|
|
// wipe_area -- space available for one toolchange in mm
|
2019-08-14 23:20:38 +00:00
|
|
|
WipeTower(const PrintConfig& config, const std::vector<std::vector<float>>& wiping_matrix, size_t initial_tool);
|
2019-06-17 08:16:07 +00:00
|
|
|
virtual ~WipeTower() {}
|
2017-05-16 11:45:28 +00:00
|
|
|
|
2017-12-21 12:28:26 +00:00
|
|
|
|
2017-05-16 11:45:28 +00:00
|
|
|
// Set the extruder properties.
|
2019-08-14 23:20:38 +00:00
|
|
|
void set_extruder(size_t idx, const PrintConfig& config);
|
2017-12-21 12:28:26 +00:00
|
|
|
|
2018-03-21 14:57:17 +00:00
|
|
|
// Appends into internal structure m_plan containing info about the future wipe tower
|
2017-12-21 12:28:26 +00:00
|
|
|
// to be used before building begins. The entries must be added ordered in z.
|
2018-05-30 09:56:30 +00:00
|
|
|
void plan_toolchange(float z_par, float layer_height_par, unsigned int old_tool, unsigned int new_tool, bool brim, float wipe_volume = 0.f);
|
2017-12-21 12:28:26 +00:00
|
|
|
|
2018-02-22 10:03:29 +00:00
|
|
|
// Iterates through prepared m_plan, generates ToolChangeResults and appends them to "result"
|
2019-06-17 08:16:07 +00:00
|
|
|
void generate(std::vector<std::vector<ToolChangeResult>> &result);
|
2017-12-21 12:28:26 +00:00
|
|
|
|
2018-07-27 13:56:27 +00:00
|
|
|
float get_depth() const { return m_wipe_tower_depth; }
|
|
|
|
|
2018-02-21 12:07:32 +00:00
|
|
|
|
2018-03-06 18:14:12 +00:00
|
|
|
|
2017-05-16 11:45:28 +00:00
|
|
|
// Switch to a next layer.
|
2019-06-17 08:16:07 +00:00
|
|
|
void set_layer(
|
2017-05-16 11:45:28 +00:00
|
|
|
// Print height of this layer.
|
2017-12-21 12:28:26 +00:00
|
|
|
float print_z,
|
|
|
|
// Layer height, used to calculate extrusion the rate.
|
|
|
|
float layer_height,
|
2017-05-16 11:45:28 +00:00
|
|
|
// Maximum number of tool changes on this layer or the layers below.
|
2017-12-21 12:28:26 +00:00
|
|
|
size_t max_tool_changes,
|
2017-05-16 11:45:28 +00:00
|
|
|
// Is this the first layer of the print? In that case print the brim first.
|
2017-12-21 12:28:26 +00:00
|
|
|
bool is_first_layer,
|
2017-05-16 11:45:28 +00:00
|
|
|
// Is this the last layer of the waste tower?
|
2017-12-21 12:28:26 +00:00
|
|
|
bool is_last_layer)
|
2017-05-16 11:45:28 +00:00
|
|
|
{
|
|
|
|
m_z_pos = print_z;
|
2017-05-25 20:27:53 +00:00
|
|
|
m_layer_height = layer_height;
|
2017-05-16 11:45:28 +00:00
|
|
|
m_is_first_layer = is_first_layer;
|
2017-12-21 12:28:26 +00:00
|
|
|
m_print_brim = is_first_layer;
|
2018-03-21 14:57:17 +00:00
|
|
|
m_depth_traversed = 0.f;
|
2017-05-17 14:45:37 +00:00
|
|
|
m_current_shape = (! is_first_layer && m_current_shape == SHAPE_NORMAL) ? SHAPE_REVERSED : SHAPE_NORMAL;
|
2018-04-06 10:02:52 +00:00
|
|
|
if (is_first_layer) {
|
|
|
|
this->m_num_layer_changes = 0;
|
|
|
|
this->m_num_tool_changes = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
++ m_num_layer_changes;
|
2017-12-07 10:59:14 +00:00
|
|
|
|
2018-03-21 14:57:17 +00:00
|
|
|
// Calculate extrusion flow from desired line width, nozzle diameter, filament diameter and layer_height:
|
2017-12-21 12:28:26 +00:00
|
|
|
m_extrusion_flow = extrusion_flow(layer_height);
|
|
|
|
|
2018-03-21 14:57:17 +00:00
|
|
|
// Advance m_layer_info iterator, making sure we got it right
|
|
|
|
while (!m_plan.empty() && m_layer_info->z < print_z - WT_EPSILON && m_layer_info+1 != m_plan.end())
|
2018-02-22 10:03:29 +00:00
|
|
|
++m_layer_info;
|
2017-05-16 11:45:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Return the wipe tower position.
|
2019-06-17 08:16:07 +00:00
|
|
|
const Vec2f& position() const { return m_wipe_tower_pos; }
|
2017-05-19 17:24:21 +00:00
|
|
|
// Return the wipe tower width.
|
2019-06-17 08:16:07 +00:00
|
|
|
float width() const { return m_wipe_tower_width; }
|
2017-05-16 11:45:28 +00:00
|
|
|
// The wipe tower is finished, there should be no more tool changes or wipe tower prints.
|
2019-06-17 08:16:07 +00:00
|
|
|
bool finished() const { return m_max_color_changes == 0; }
|
2017-05-16 11:45:28 +00:00
|
|
|
|
2017-09-01 15:30:18 +00:00
|
|
|
// Returns gcode to prime the nozzles at the front edge of the print bed.
|
2019-06-17 08:16:07 +00:00
|
|
|
std::vector<ToolChangeResult> prime(
|
2017-09-12 13:55:38 +00:00
|
|
|
// 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.
|
2017-12-03 08:43:00 +00:00
|
|
|
const std::vector<unsigned int> &tools,
|
2017-09-12 13:55:38 +00:00
|
|
|
// 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.
|
2018-03-08 15:44:52 +00:00
|
|
|
bool last_wipe_inside_wipe_tower);
|
2017-09-01 15:30:18 +00:00
|
|
|
|
2017-05-17 08:42:39 +00:00
|
|
|
// Returns gcode for a toolchange and a final print head position.
|
|
|
|
// On the first layer, extrude a brim around the future wipe tower first.
|
2019-06-17 08:16:07 +00:00
|
|
|
ToolChangeResult tool_change(unsigned int new_tool, bool last_in_layer);
|
2017-05-16 11:45:28 +00:00
|
|
|
|
2018-03-21 14:57:17 +00:00
|
|
|
// Fill the unfilled space with a sparse infill.
|
2017-05-17 14:45:37 +00:00
|
|
|
// Call this method only if layer_finished() is false.
|
2019-06-17 08:16:07 +00:00
|
|
|
ToolChangeResult finish_layer();
|
2017-05-17 14:45:37 +00:00
|
|
|
|
2018-02-22 10:03:29 +00:00
|
|
|
// Is the current layer finished?
|
2019-06-17 08:16:07 +00:00
|
|
|
bool layer_finished() const {
|
2018-02-21 12:07:32 +00:00
|
|
|
return ( (m_is_first_layer ? m_wipe_tower_depth - m_perimeter_width : m_layer_info->depth) - WT_EPSILON < m_depth_traversed);
|
2017-12-21 12:28:26 +00:00
|
|
|
}
|
|
|
|
|
2019-06-17 08:16:07 +00:00
|
|
|
std::vector<float> get_used_filament() const { return m_used_filament_length; }
|
|
|
|
int get_number_of_toolchanges() const { return m_num_tool_changes; }
|
2018-09-17 13:12:13 +00:00
|
|
|
|
2019-06-10 10:26:47 +00:00
|
|
|
struct FilamentParameters {
|
2019-06-14 12:31:53 +00:00
|
|
|
std::string material = "PLA";
|
2019-06-10 10:26:47 +00:00
|
|
|
int temperature = 0;
|
|
|
|
int first_layer_temperature = 0;
|
|
|
|
float loading_speed = 0.f;
|
|
|
|
float loading_speed_start = 0.f;
|
|
|
|
float unloading_speed = 0.f;
|
|
|
|
float unloading_speed_start = 0.f;
|
|
|
|
float delay = 0.f ;
|
|
|
|
int cooling_moves = 0;
|
|
|
|
float cooling_initial_speed = 0.f;
|
|
|
|
float cooling_final_speed = 0.f;
|
2019-07-19 10:59:56 +00:00
|
|
|
float ramming_line_width_multiplicator = 1.f;
|
|
|
|
float ramming_step_multiplicator = 1.f;
|
2019-06-10 10:26:47 +00:00
|
|
|
float max_e_speed = std::numeric_limits<float>::max();
|
|
|
|
std::vector<float> ramming_speed;
|
|
|
|
float nozzle_diameter;
|
2019-07-23 11:58:07 +00:00
|
|
|
float filament_area;
|
2019-06-10 10:26:47 +00:00
|
|
|
};
|
2017-05-16 11:45:28 +00:00
|
|
|
|
|
|
|
private:
|
2019-06-17 08:16:07 +00:00
|
|
|
WipeTower();
|
2017-05-16 11:45:28 +00:00
|
|
|
|
2018-03-21 14:57:17 +00:00
|
|
|
enum wipe_shape // A fill-in direction
|
2017-05-16 11:45:28 +00:00
|
|
|
{
|
2018-02-21 12:07:32 +00:00
|
|
|
SHAPE_NORMAL = 1,
|
2017-05-16 11:45:28 +00:00
|
|
|
SHAPE_REVERSED = -1
|
|
|
|
};
|
|
|
|
|
2018-03-21 14:57:17 +00:00
|
|
|
const bool m_peters_wipe_tower = false; // sparse wipe tower inspired by Peter's post processor - not finished yet
|
|
|
|
const float Width_To_Nozzle_Ratio = 1.25f; // desired line width (oval) in multiples of nozzle diameter - may not be actually neccessary to adjust
|
|
|
|
const float WT_EPSILON = 1e-3f;
|
2019-07-23 11:58:07 +00:00
|
|
|
const float filament_area() const {
|
|
|
|
return m_filpar[0].filament_area; // all extruders are assumed to have the same filament diameter at this point
|
|
|
|
}
|
2018-03-21 14:57:17 +00:00
|
|
|
|
|
|
|
|
2019-06-12 08:54:52 +00:00
|
|
|
bool m_semm = true; // Are we using a single extruder multimaterial printer?
|
2019-06-17 08:16:07 +00:00
|
|
|
Vec2f m_wipe_tower_pos; // Left front corner of the wipe tower in mm.
|
2018-02-21 12:07:32 +00:00
|
|
|
float m_wipe_tower_width; // Width of the wipe tower.
|
|
|
|
float m_wipe_tower_depth = 0.f; // Depth of the wipe tower
|
2018-03-21 14:57:17 +00:00
|
|
|
float m_wipe_tower_rotation_angle = 0.f; // Wipe tower rotation angle in degrees (with respect to x axis)
|
2018-07-27 13:56:27 +00:00
|
|
|
float m_internal_rotation = 0.f;
|
2018-02-21 12:07:32 +00:00
|
|
|
float m_y_shift = 0.f; // y shift passed to writer
|
|
|
|
float m_z_pos = 0.f; // Current Z position.
|
|
|
|
float m_layer_height = 0.f; // Current layer height.
|
|
|
|
size_t m_max_color_changes = 0; // Maximum number of color changes per layer.
|
|
|
|
bool m_is_first_layer = false;// Is this the 1st layer of the print? If so, print the brim around the waste tower.
|
2018-05-11 15:35:42 +00:00
|
|
|
int m_old_temperature = -1; // To keep track of what was the last temp that we set (so we don't issue the command when not neccessary)
|
2017-05-16 11:45:28 +00:00
|
|
|
|
|
|
|
// G-code generator parameters.
|
2018-03-01 15:15:00 +00:00
|
|
|
float m_cooling_tube_retraction = 0.f;
|
|
|
|
float m_cooling_tube_length = 0.f;
|
|
|
|
float m_parking_pos_retraction = 0.f;
|
2018-04-16 12:26:57 +00:00
|
|
|
float m_extra_loading_move = 0.f;
|
2018-03-12 14:41:25 +00:00
|
|
|
float m_bridging = 0.f;
|
2018-12-14 19:09:10 +00:00
|
|
|
bool m_set_extruder_trimpot = false;
|
2018-03-12 14:41:25 +00:00
|
|
|
bool m_adhesion = true;
|
2019-04-24 10:01:57 +00:00
|
|
|
GCodeFlavor m_gcode_flavor;
|
2018-03-05 09:45:35 +00:00
|
|
|
|
2019-08-14 23:20:38 +00:00
|
|
|
// Bed properties
|
|
|
|
enum {
|
|
|
|
RectangularBed,
|
|
|
|
CircularBed
|
|
|
|
} m_bed_shape;
|
|
|
|
float m_bed_width; // width of the bed bounding box
|
|
|
|
|
Export of filament statistics into G-code for multi-material prints
has been rewritten to be easier to parse.
Old format
; filament used = 19248.8mm (46.3cm3)
; filament used = 57.4
; filament cost = 1.5
; filament used = 8007.6mm (19.3cm3)
; filament used = 23.9
; filament cost = 0.6
; filament used = 0.0mm (0.0cm3)
; filament used = 0.0mm (0.0cm3)
; filament used = 0.0mm (0.0cm3)
; total filament cost = 2.1
New format
; filament used [mm] = 1600.7,1600.7,1600.7,1600.7,1600.7
; filament used [cm3] = 3.9,3.9,3.9,3.9,3.9
; filament used [g] = 4.8,4.8,4.8,4.8,4.8
; filament cost = 1.5,1.5,1.5,1.5,1.5
; total filament used [g] = 24.0
; total filament cost = 7.5
Where the non-printing extruders are filled in with zeros, and
the trailing non-printing extruders are not exported.
; filament used [g]
and
; filament cost
are only printed if non zero (material density and cost are defined)
2019-04-16 12:25:50 +00:00
|
|
|
float m_perimeter_width = 0.4f * Width_To_Nozzle_Ratio; // Width of an extrusion line, also a perimeter spacing for 100% infill.
|
|
|
|
float m_extrusion_flow = 0.038f; //0.029f;// Extrusion flow is derived from m_perimeter_width, layer height and filament diameter.
|
2017-05-16 11:45:28 +00:00
|
|
|
|
|
|
|
// Extruder specific parameters.
|
2018-03-20 14:45:11 +00:00
|
|
|
std::vector<FilamentParameters> m_filpar;
|
2018-03-05 09:45:35 +00:00
|
|
|
|
2017-05-16 11:45:28 +00:00
|
|
|
|
2018-03-21 14:57:17 +00:00
|
|
|
// State of the wipe tower generator.
|
2018-02-21 12:07:32 +00:00
|
|
|
unsigned int m_num_layer_changes = 0; // Layer change counter for the output statistics.
|
|
|
|
unsigned int m_num_tool_changes = 0; // Tool change change counter for the output statistics.
|
|
|
|
///unsigned int m_idx_tool_change_in_layer = 0; // Layer change counter in this layer. Counting up to m_max_color_changes.
|
2017-12-21 12:28:26 +00:00
|
|
|
bool m_print_brim = true;
|
2017-05-17 08:42:39 +00:00
|
|
|
// A fill-in direction (positive Y, negative Y) alternates with each layer.
|
2017-05-16 11:45:28 +00:00
|
|
|
wipe_shape m_current_shape = SHAPE_NORMAL;
|
2017-05-25 20:27:53 +00:00
|
|
|
unsigned int m_current_tool = 0;
|
2018-05-24 15:24:37 +00:00
|
|
|
const std::vector<std::vector<float>> wipe_volumes;
|
2018-02-21 12:07:32 +00:00
|
|
|
|
2018-03-21 14:57:17 +00:00
|
|
|
float m_depth_traversed = 0.f; // Current y position at the wipe tower.
|
|
|
|
bool m_left_to_right = true;
|
|
|
|
float m_extra_spacing = 1.f;
|
|
|
|
|
2018-02-22 10:03:29 +00:00
|
|
|
// Calculates extrusion flow needed to produce required line width for given layer height
|
|
|
|
float extrusion_flow(float layer_height = -1.f) const // negative layer_height - return current m_extrusion_flow
|
2017-12-21 12:28:26 +00:00
|
|
|
{
|
|
|
|
if ( layer_height < 0 )
|
|
|
|
return m_extrusion_flow;
|
2019-07-23 11:58:07 +00:00
|
|
|
return layer_height * ( m_perimeter_width - layer_height * (1.f-float(M_PI)/4.f)) / filament_area();
|
2017-12-21 12:28:26 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 10:03:29 +00:00
|
|
|
// Calculates length of extrusion line to extrude given volume
|
2018-02-21 12:07:32 +00:00
|
|
|
float volume_to_length(float volume, float line_width, float layer_height) const {
|
Export of filament statistics into G-code for multi-material prints
has been rewritten to be easier to parse.
Old format
; filament used = 19248.8mm (46.3cm3)
; filament used = 57.4
; filament cost = 1.5
; filament used = 8007.6mm (19.3cm3)
; filament used = 23.9
; filament cost = 0.6
; filament used = 0.0mm (0.0cm3)
; filament used = 0.0mm (0.0cm3)
; filament used = 0.0mm (0.0cm3)
; total filament cost = 2.1
New format
; filament used [mm] = 1600.7,1600.7,1600.7,1600.7,1600.7
; filament used [cm3] = 3.9,3.9,3.9,3.9,3.9
; filament used [g] = 4.8,4.8,4.8,4.8,4.8
; filament cost = 1.5,1.5,1.5,1.5,1.5
; total filament used [g] = 24.0
; total filament cost = 7.5
Where the non-printing extruders are filled in with zeros, and
the trailing non-printing extruders are not exported.
; filament used [g]
and
; filament cost
are only printed if non zero (material density and cost are defined)
2019-04-16 12:25:50 +00:00
|
|
|
return std::max(0.f, volume / (layer_height * (line_width - layer_height * (1.f - float(M_PI) / 4.f))));
|
2018-02-21 12:07:32 +00:00
|
|
|
}
|
|
|
|
|
2018-03-21 14:57:17 +00:00
|
|
|
// Calculates depth for all layers and propagates them downwards
|
|
|
|
void plan_tower();
|
|
|
|
|
|
|
|
// Goes through m_plan and recalculates depths and width of the WT to make it exactly square - experimental
|
|
|
|
void make_wipe_tower_square();
|
|
|
|
|
|
|
|
// Goes through m_plan, calculates border and finish_layer extrusions and subtracts them from last wipe
|
|
|
|
void save_on_last_wipe();
|
|
|
|
|
2018-02-21 12:07:32 +00:00
|
|
|
|
2017-05-16 11:45:28 +00:00
|
|
|
struct box_coordinates
|
|
|
|
{
|
|
|
|
box_coordinates(float left, float bottom, float width, float height) :
|
|
|
|
ld(left , bottom ),
|
|
|
|
lu(left , bottom + height),
|
|
|
|
rd(left + width, bottom ),
|
|
|
|
ru(left + width, bottom + height) {}
|
2019-06-17 08:16:07 +00:00
|
|
|
box_coordinates(const Vec2f &pos, float width, float height) : box_coordinates(pos(0), pos(1), width, height) {}
|
|
|
|
void translate(const Vec2f &shift) {
|
2017-05-17 14:45:37 +00:00
|
|
|
ld += shift; lu += shift;
|
|
|
|
rd += shift; ru += shift;
|
|
|
|
}
|
2019-06-17 08:16:07 +00:00
|
|
|
void translate(const float dx, const float dy) { translate(Vec2f(dx, dy)); }
|
2017-05-16 11:45:28 +00:00
|
|
|
void expand(const float offset) {
|
2019-06-17 08:16:07 +00:00
|
|
|
ld += Vec2f(- offset, - offset);
|
|
|
|
lu += Vec2f(- offset, offset);
|
|
|
|
rd += Vec2f( offset, - offset);
|
|
|
|
ru += Vec2f( offset, offset);
|
2017-05-16 11:45:28 +00:00
|
|
|
}
|
2017-05-17 14:45:37 +00:00
|
|
|
void expand(const float offset_x, const float offset_y) {
|
2019-06-17 08:16:07 +00:00
|
|
|
ld += Vec2f(- offset_x, - offset_y);
|
|
|
|
lu += Vec2f(- offset_x, offset_y);
|
|
|
|
rd += Vec2f( offset_x, - offset_y);
|
|
|
|
ru += Vec2f( offset_x, offset_y);
|
2017-05-17 14:45:37 +00:00
|
|
|
}
|
2019-06-17 08:16:07 +00:00
|
|
|
Vec2f ld; // left down
|
|
|
|
Vec2f lu; // left upper
|
|
|
|
Vec2f rd; // right lower
|
|
|
|
Vec2f ru; // right upper
|
2017-05-16 11:45:28 +00:00
|
|
|
};
|
|
|
|
|
2017-12-21 12:28:26 +00:00
|
|
|
|
|
|
|
// to store information about tool changes for a given layer
|
|
|
|
struct WipeTowerInfo{
|
|
|
|
struct ToolChange {
|
|
|
|
unsigned int old_tool;
|
|
|
|
unsigned int new_tool;
|
|
|
|
float required_depth;
|
2018-03-06 18:14:12 +00:00
|
|
|
float ramming_depth;
|
|
|
|
float first_wipe_line;
|
2018-05-24 15:24:37 +00:00
|
|
|
float wipe_volume;
|
|
|
|
ToolChange(unsigned int old, unsigned int newtool, float depth=0.f, float ramming_depth=0.f, float fwl=0.f, float wv=0.f)
|
|
|
|
: old_tool{old}, new_tool{newtool}, required_depth{depth}, ramming_depth{ramming_depth}, first_wipe_line{fwl}, wipe_volume{wv} {}
|
2017-12-21 12:28:26 +00:00
|
|
|
};
|
|
|
|
float z; // z position of the layer
|
|
|
|
float height; // layer height
|
|
|
|
float depth; // depth of the layer based on all layers above
|
2018-02-21 12:07:32 +00:00
|
|
|
float extra_spacing;
|
2017-12-21 12:28:26 +00:00
|
|
|
float toolchanges_depth() const { float sum = 0.f; for (const auto &a : tool_changes) sum += a.required_depth; return sum; }
|
|
|
|
|
|
|
|
std::vector<ToolChange> tool_changes;
|
|
|
|
|
|
|
|
WipeTowerInfo(float z_par, float layer_height_par)
|
2018-02-21 12:07:32 +00:00
|
|
|
: z{z_par}, height{layer_height_par}, depth{0}, extra_spacing{1.f} {}
|
2017-12-21 12:28:26 +00:00
|
|
|
};
|
|
|
|
|
2018-02-22 10:03:29 +00:00
|
|
|
std::vector<WipeTowerInfo> m_plan; // Stores information about all layers and toolchanges for the future wipe tower (filled by plan_toolchange(...))
|
2018-03-07 10:44:47 +00:00
|
|
|
std::vector<WipeTowerInfo>::iterator m_layer_info = m_plan.end();
|
2017-12-21 12:28:26 +00:00
|
|
|
|
2018-09-17 13:12:13 +00:00
|
|
|
// Stores information about used filament length per extruder:
|
|
|
|
std::vector<float> m_used_filament_length;
|
|
|
|
|
2017-12-21 12:28:26 +00:00
|
|
|
|
2017-05-16 11:45:28 +00:00
|
|
|
// Returns gcode for wipe tower brim
|
2017-12-21 12:28:26 +00:00
|
|
|
// sideOnly -- set to false -- experimental, draw brim on sides of wipe tower
|
2017-05-16 11:45:28 +00:00
|
|
|
// offset -- set to 0 -- experimental, offset to replace brim in front / rear of wipe tower
|
2018-03-08 15:44:52 +00:00
|
|
|
ToolChangeResult toolchange_Brim(bool sideOnly = false, float y_offset = 0.f);
|
2017-05-16 11:45:28 +00:00
|
|
|
|
|
|
|
void toolchange_Unload(
|
2019-06-17 08:16:07 +00:00
|
|
|
WipeTowerWriter &writer,
|
2017-05-16 11:45:28 +00:00
|
|
|
const box_coordinates &cleaning_box,
|
2019-06-14 12:31:53 +00:00
|
|
|
const std::string& current_material,
|
2017-05-17 14:45:37 +00:00
|
|
|
const int new_temperature);
|
2017-05-16 11:45:28 +00:00
|
|
|
|
|
|
|
void toolchange_Change(
|
2019-06-17 08:16:07 +00:00
|
|
|
WipeTowerWriter &writer,
|
2017-09-01 15:30:18 +00:00
|
|
|
const unsigned int new_tool,
|
2019-06-14 12:31:53 +00:00
|
|
|
const std::string& new_material);
|
2017-05-16 11:45:28 +00:00
|
|
|
|
|
|
|
void toolchange_Load(
|
2019-06-17 08:16:07 +00:00
|
|
|
WipeTowerWriter &writer,
|
2017-05-16 11:45:28 +00:00
|
|
|
const box_coordinates &cleaning_box);
|
|
|
|
|
|
|
|
void toolchange_Wipe(
|
2019-06-17 08:16:07 +00:00
|
|
|
WipeTowerWriter &writer,
|
2017-09-12 13:55:38 +00:00
|
|
|
const box_coordinates &cleaning_box,
|
2018-03-09 11:40:39 +00:00
|
|
|
float wipe_volume);
|
2017-05-16 11:45:28 +00:00
|
|
|
};
|
|
|
|
|
2018-02-28 15:04:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-16 11:45:28 +00:00
|
|
|
}; // namespace Slic3r
|
|
|
|
|
2019-06-17 08:16:07 +00:00
|
|
|
#endif // WipeTowerPrusaMM_hpp_
|