Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::WipeTowerWriter Class Reference
+ Collaboration diagram for Slic3r::WipeTowerWriter:

Public Member Functions

 WipeTowerWriter (float layer_height, float line_width, GCodeFlavor flavor, const std::vector< WipeTower::FilamentParameters > &filament_parameters)
 
WipeTowerWriterchange_analyzer_line_width (float line_width)
 
WipeTowerWriterset_initial_position (const Vec2f &pos, float width=0.f, float depth=0.f, float internal_angle=0.f)
 
WipeTowerWriterset_position (const Vec2f &pos)
 
WipeTowerWriterset_initial_tool (size_t tool)
 
WipeTowerWriterset_z (float z)
 
WipeTowerWriterset_extrusion_flow (float flow)
 
WipeTowerWriterset_y_shift (float shift)
 
WipeTowerWriterdisable_linear_advance ()
 
WipeTowerWritersuppress_preview ()
 
WipeTowerWriterresume_preview ()
 
WipeTowerWriterfeedrate (float f)
 
const std::string & gcode () const
 
const std::vector< WipeTower::Extrusion > & extrusions () const
 
float x () const
 
float y () const
 
const Vec2fpos () const
 
const Vec2f start_pos_rotated () const
 
const Vec2f pos_rotated () const
 
float elapsed_time () const
 
float get_and_reset_used_filament_length ()
 
WipeTowerWriterextrude_explicit (float x, float y, float e, float f=0.f, bool record_length=false, bool limit_volumetric_flow=true)
 
WipeTowerWriterextrude_explicit (const Vec2f &dest, float e, float f=0.f, bool record_length=false, bool limit_volumetric_flow=true)
 
WipeTowerWritertravel (float x, float y, float f=0.f)
 
WipeTowerWritertravel (const Vec2f &dest, float f=0.f)
 
WipeTowerWriterextrude (float x, float y, float f=0.f)
 
WipeTowerWriterextrude (const Vec2f &dest, const float f=0.f)
 
WipeTowerWriterrectangle (const Vec2f &ld, float width, float height, const float f=0.f)
 
WipeTowerWriterrectangle (const WipeTower::box_coordinates &box, const float f=0.f)
 
WipeTowerWriterload (float e, float f=0.f)
 
WipeTowerWriterretract (float e, float f=0.f)
 
WipeTowerWriterload_move_x_advanced (float farthest_x, float loading_dist, float loading_speed, float max_x_speed=50.f)
 
WipeTowerWriterz_hop (float hop, float f=0.f)
 
WipeTowerWriterz_hop_reset (float f=0.f)
 
WipeTowerWriterram (float x1, float x2, float dy, float e0, float e, float f)
 
WipeTowerWritercool (float x1, float x2, float e1, float e2, float f)
 
WipeTowerWriterset_tool (size_t tool)
 
WipeTowerWriterset_extruder_temp (int temperature, bool wait=false)
 
WipeTowerWriterwait (float time)
 
WipeTowerWriterspeed_override (int speed)
 
WipeTowerWriterspeed_override_backup ()
 
WipeTowerWriterspeed_override_restore ()
 
WipeTowerWriterset_extruder_trimpot (int current)
 
WipeTowerWriterflush_planner_queue ()
 
WipeTowerWriterreset_extruder ()
 
WipeTowerWritercomment_with_value (const char *comment, int value)
 
WipeTowerWriterset_fan (unsigned speed)
 
WipeTowerWriterappend (const std::string &text)
 
const std::vector< Vec2f > & wipe_path () const
 
WipeTowerWriteradd_wipe_point (const Vec2f &pt)
 
WipeTowerWriteradd_wipe_point (float x, float y)
 

Private Member Functions

std::string set_format_X (float x)
 
std::string set_format_Y (float y)
 
std::string set_format_Z (float z)
 
std::string set_format_E (float e)
 
std::string set_format_F (float f)
 
WipeTowerWriteroperator= (const WipeTowerWriter &rhs)
 
Vec2f rotate (Vec2f pt) const
 

Private Attributes

Vec2f m_start_pos
 
Vec2f m_current_pos
 
std::vector< Vec2fm_wipe_path
 
float m_current_z
 
float m_current_feedrate
 
size_t m_current_tool
 
float m_layer_height
 
float m_extrusion_flow
 
bool m_preview_suppressed
 
std::string m_gcode
 
std::vector< WipeTower::Extrusionm_extrusions
 
float m_elapsed_time
 
float m_internal_angle = 0.f
 
float m_y_shift = 0.f
 
float m_wipe_tower_width = 0.f
 
float m_wipe_tower_depth = 0.f
 
unsigned m_last_fan_speed = 0
 
int current_temp = -1
 
float m_used_filament_length = 0.f
 
GCodeFlavor m_gcode_flavor
 
const std::vector< WipeTower::FilamentParameters > & m_filpar
 

Detailed Description

Constructor & Destructor Documentation

◆ WipeTowerWriter()

Slic3r::WipeTowerWriter::WipeTowerWriter ( float  layer_height,
float  line_width,
GCodeFlavor  flavor,
const std::vector< WipeTower::FilamentParameters > &  filament_parameters 
)
inline
28 :
29 m_current_pos(std::numeric_limits<float>::max(), std::numeric_limits<float>::max()),
30 m_current_z(0.f),
35 m_elapsed_time(0.f),
36#if ENABLE_GCODE_VIEWER_DATA_CHECKING
37 m_default_analyzer_line_width(line_width),
38#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
39 m_gcode_flavor(flavor),
40 m_filpar(filament_parameters)
41 {
42 // adds tag for analyzer:
43 std::ostringstream str;
44 str << ";" << GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) << m_layer_height << "\n"; // don't rely on GCodeAnalyzer knowing the layer height - it knows nothing at priming
46 m_gcode += str.str();
48 }
static const std::string & reserved_tag(ETags tag)
Definition GCodeProcessor.hpp:186
float m_current_z
Definition WipeTower.cpp:433
Vec2f m_current_pos
Definition WipeTower.cpp:431
const std::vector< WipeTower::FilamentParameters > & m_filpar
Definition WipeTower.cpp:453
bool m_preview_suppressed
Definition WipeTower.cpp:438
GCodeFlavor m_gcode_flavor
Definition WipeTower.cpp:452
float m_elapsed_time
Definition WipeTower.cpp:441
WipeTowerWriter & change_analyzer_line_width(float line_width)
Definition WipeTower.cpp:50
float m_layer_height
Definition WipeTower.cpp:436
std::string m_gcode
Definition WipeTower.cpp:439
float m_current_feedrate
Definition WipeTower.cpp:434
float m_extrusion_flow
Definition WipeTower.cpp:437
layer_height((ConfigOptionInt, faded_layers))((ConfigOptionFloat
std::string gcode_extrusion_role_to_string(GCodeExtrusionRole role)
Definition ExtrusionRole.cpp:34

References change_analyzer_line_width(), Slic3r::gcode_extrusion_role_to_string(), Slic3r::GCodeProcessor::Height, m_gcode, m_layer_height, Slic3r::GCodeProcessor::reserved_tag(), Slic3r::GCodeProcessor::Role, and Slic3r::WipeTower.

+ Here is the call graph for this function:

Member Function Documentation

◆ add_wipe_point() [1/2]

WipeTowerWriter & Slic3r::WipeTowerWriter::add_wipe_point ( const Vec2f pt)
inline
419 {
420 m_wipe_path.push_back(rotate(pt));
421 return *this;
422 }
Vec2f rotate(Vec2f pt) const
Definition WipeTower.cpp:484
std::vector< Vec2f > m_wipe_path
Definition WipeTower.cpp:432

References m_wipe_path, and rotate().

Referenced by add_wipe_point(), Slic3r::WipeTower::finish_layer(), and Slic3r::WipeTower::toolchange_Wipe().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_wipe_point() [2/2]

WipeTowerWriter & Slic3r::WipeTowerWriter::add_wipe_point ( float  x,
float  y 
)
inline
425 {
426 return add_wipe_point(Vec2f(x, y));
427 }
float x() const
Definition WipeTower.cpp:127
WipeTowerWriter & add_wipe_point(const Vec2f &pt)
Definition WipeTower.cpp:418
float y() const
Definition WipeTower.cpp:128
Eigen::Matrix< float, 2, 1, Eigen::DontAlign > Vec2f
Definition Point.hpp:48

References add_wipe_point(), x(), and y().

+ Here is the call graph for this function:

◆ append()

WipeTowerWriter & Slic3r::WipeTowerWriter::append ( const std::string &  text)
inline
411{ m_gcode += text; return *this; }

References m_gcode.

Referenced by Slic3r::WipeTower::finish_layer(), Slic3r::WipeTower::prime(), Slic3r::WipeTower::tool_change(), Slic3r::WipeTower::toolchange_Change(), Slic3r::WipeTower::toolchange_Load(), Slic3r::WipeTower::toolchange_Unload(), and Slic3r::WipeTower::toolchange_Wipe().

+ Here is the caller graph for this function:

◆ change_analyzer_line_width()

WipeTowerWriter & Slic3r::WipeTowerWriter::change_analyzer_line_width ( float  line_width)
inline
50 {
51 // adds tag for analyzer:
52 std::stringstream str;
53 str << ";" << GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Width) << line_width << "\n";
54 m_gcode += str.str();
55 return *this;
56 }

References m_gcode, Slic3r::GCodeProcessor::reserved_tag(), and Slic3r::GCodeProcessor::Width.

Referenced by WipeTowerWriter(), and Slic3r::WipeTower::toolchange_Unload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ comment_with_value()

WipeTowerWriter & Slic3r::WipeTowerWriter::comment_with_value ( const char *  comment,
int  value 
)
inline
393 {
394 m_gcode += std::string(";") + comment + std::to_string(value) + "\n";
395 return *this;
396 }
#define comment
Definition lexer.c:1004

References comment, and m_gcode.

Referenced by Slic3r::WipeTower::tool_change().

+ Here is the caller graph for this function:

◆ cool()

WipeTowerWriter & Slic3r::WipeTowerWriter::cool ( float  x1,
float  x2,
float  e1,
float  e2,
float  f 
)
inline
314 {
315 extrude_explicit(x1, m_current_pos.y(), e1, f, false, false);
316 extrude_explicit(x2, m_current_pos.y(), e2, false, false);
317 return *this;
318 }
WipeTowerWriter & extrude_explicit(float x, float y, float e, float f=0.f, bool record_length=false, bool limit_volumetric_flow=true)
Definition WipeTower.cpp:136
static double f(double x, double z_sin, double z_cos, bool vertical, bool flip)
Definition FillGyroid.cpp:12

References extrude_explicit(), Slic3r::f(), and m_current_pos.

+ Here is the call graph for this function:

◆ disable_linear_advance()

WipeTowerWriter & Slic3r::WipeTowerWriter::disable_linear_advance ( )
inline
95 {
97 m_gcode += (std::string("M572 D") + std::to_string(m_current_tool) + " S0\n");
98 else if (m_gcode_flavor == gcfKlipper)
99 m_gcode += "SET_PRESSURE_ADVANCE ADVANCE=0\n";
100 else
101 m_gcode += "M900 K0\n";
102 return *this;
103 }
size_t m_current_tool
Definition WipeTower.cpp:435
@ gcfKlipper
Definition PrintConfig.hpp:35
@ gcfRepRapFirmware
Definition PrintConfig.hpp:35
@ gcfRepRapSprinter
Definition PrintConfig.hpp:35

References Slic3r::gcfKlipper, Slic3r::gcfRepRapFirmware, Slic3r::gcfRepRapSprinter, m_current_tool, m_gcode, and m_gcode_flavor.

Referenced by Slic3r::WipeTower::toolchange_Unload().

+ Here is the caller graph for this function:

◆ elapsed_time()

float Slic3r::WipeTowerWriter::elapsed_time ( ) const
inline
132{ return m_elapsed_time; }

References m_elapsed_time.

Referenced by Slic3r::WipeTower::construct_tcr().

+ Here is the caller graph for this function:

◆ extrude() [1/2]

WipeTowerWriter & Slic3r::WipeTowerWriter::extrude ( const Vec2f dest,
const float  f = 0.f 
)
inline
219 { return extrude(dest.x(), dest.y(), f); }
WipeTowerWriter & extrude(float x, float y, float f=0.f)
Definition WipeTower.cpp:211

References extrude(), and Slic3r::f().

+ Here is the call graph for this function:

◆ extrude() [2/2]

WipeTowerWriter & Slic3r::WipeTowerWriter::extrude ( float  x,
float  y,
float  f = 0.f 
)
inline
212 {
213 float dx = x - m_current_pos.x();
214 float dy = y - m_current_pos.y();
215 return extrude_explicit(x, y, std::sqrt(dx*dx+dy*dy) * m_extrusion_flow, f, true);
216 }

References extrude_explicit(), Slic3r::f(), m_current_pos, m_extrusion_flow, x(), and y().

Referenced by extrude(), Slic3r::WipeTower::finish_layer(), rectangle(), Slic3r::WipeTower::toolchange_Unload(), and Slic3r::WipeTower::toolchange_Wipe().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extrude_explicit() [1/2]

WipeTowerWriter & Slic3r::WipeTowerWriter::extrude_explicit ( const Vec2f dest,
float  e,
float  f = 0.f,
bool  record_length = false,
bool  limit_volumetric_flow = true 
)
inline
201 { return extrude_explicit(dest.x(), dest.y(), e, f, record_length); }

References extrude_explicit(), and Slic3r::f().

+ Here is the call graph for this function:

◆ extrude_explicit() [2/2]

WipeTowerWriter & Slic3r::WipeTowerWriter::extrude_explicit ( float  x,
float  y,
float  e,
float  f = 0.f,
bool  record_length = false,
bool  limit_volumetric_flow = true 
)
inline
137 {
138 if (x == m_current_pos.x() && y == m_current_pos.y() && e == 0.f && (f == 0.f || f == m_current_feedrate))
139 // Neither extrusion nor a travel move.
140 return *this;
141
142 float dx = x - m_current_pos.x();
143 float dy = y - m_current_pos.y();
144 float len = std::sqrt(dx*dx+dy*dy);
145 if (record_length)
147
148 // Now do the "internal rotation" with respect to the wipe tower center
149 Vec2f rotated_current_pos(this->pos_rotated());
150 Vec2f rot(this->rotate(Vec2f(x,y))); // this is where we want to go
151
152 if (! m_preview_suppressed && e > 0.f && len > 0.f) {
153#if ENABLE_GCODE_VIEWER_DATA_CHECKING
154 change_analyzer_mm3_per_mm(len, e);
155#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
156 // Width of a squished extrusion, corrected for the roundings of the squished extrusions.
157 // This is left zero if it is a travel move.
158 float width = e * m_filpar[0].filament_area / (len * m_layer_height);
159 // Correct for the roundings of a squished extrusion.
160 width += m_layer_height * float(1. - M_PI / 4.);
161 if (m_extrusions.empty() || m_extrusions.back().pos != rotated_current_pos)
162 m_extrusions.emplace_back(WipeTower::Extrusion(rotated_current_pos, 0, m_current_tool));
163 m_extrusions.emplace_back(WipeTower::Extrusion(rot, width, m_current_tool));
164 }
165
166 m_gcode += "G1";
167 if (std::abs(rot.x() - rotated_current_pos.x()) > (float)EPSILON)
168 m_gcode += set_format_X(rot.x());
169
170 if (std::abs(rot.y() - rotated_current_pos.y()) > (float)EPSILON)
171 m_gcode += set_format_Y(rot.y());
172
173
174 if (e != 0.f)
175 m_gcode += set_format_E(e);
176
177 if (f != 0.f && f != m_current_feedrate) {
178 if (limit_volumetric_flow) {
179 float e_speed = e / (((len == 0.f) ? std::abs(e) : len) / f * 60.f);
180 f /= std::max(1.f, e_speed / m_filpar[m_current_tool].max_e_speed);
181 }
183 }
184
185 // Append newline if at least one of X,Y,E,F was changed.
186 // Otherwise, remove the "G1".
187 if (! boost::ends_with(m_gcode, "G1"))
188 m_gcode += "\n";
189 else
190 m_gcode.erase(m_gcode.end()-2, m_gcode.end());
191
192 m_current_pos.x() = x;
193 m_current_pos.y() = y;
194
195 // Update the elapsed time with a rough estimate.
196 m_elapsed_time += ((len == 0.f) ? std::abs(e) : len) / m_current_feedrate * 60.f;
197 return *this;
198 }
#define M_PI
Definition ExtrusionSimulator.cpp:20
std::string set_format_Y(float y)
Definition WipeTower.cpp:461
std::string set_format_X(float x)
Definition WipeTower.cpp:455
std::string set_format_F(float f)
Definition WipeTower.cpp:474
std::vector< WipeTower::Extrusion > m_extrusions
Definition WipeTower.cpp:440
float m_used_filament_length
Definition WipeTower.cpp:451
const Vec2f pos_rotated() const
Definition WipeTower.cpp:131
std::string set_format_E(float e)
Definition WipeTower.cpp:470
static constexpr double EPSILON
Definition libslic3r.h:51
coord_t width(const BoundingBox &box)
Definition Arrange.cpp:539

References EPSILON, Slic3r::f(), m_current_feedrate, m_current_pos, m_current_tool, m_elapsed_time, m_extrusions, m_filpar, m_gcode, m_layer_height, M_PI, m_preview_suppressed, m_used_filament_length, pos_rotated(), rotate(), set_format_E(), set_format_F(), set_format_X(), set_format_Y(), x(), and y().

Referenced by cool(), extrude(), extrude_explicit(), load_move_x_advanced(), ram(), travel(), and travel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extrusions()

const std::vector< WipeTower::Extrusion > & Slic3r::WipeTowerWriter::extrusions ( ) const
inline
126{ return m_extrusions; }

References m_extrusions.

Referenced by Slic3r::WipeTower::construct_tcr().

+ Here is the caller graph for this function:

◆ feedrate()

WipeTowerWriter & Slic3r::WipeTowerWriter::feedrate ( float  f)
inline
117 {
118 if (f != m_current_feedrate) {
119 m_gcode += "G1" + set_format_F(f) + "\n";
121 }
122 return *this;
123 }

References Slic3r::f(), m_current_feedrate, m_gcode, and set_format_F().

Referenced by Slic3r::WipeTower::prime(), Slic3r::WipeTower::tool_change(), and Slic3r::WipeTower::toolchange_Change().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flush_planner_queue()

WipeTowerWriter & Slic3r::WipeTowerWriter::flush_planner_queue ( )
inline
380 {
381 m_gcode += "G4 S0\n";
382 return *this;
383 }

References m_gcode.

Referenced by Slic3r::WipeTower::prime(), Slic3r::WipeTower::tool_change(), Slic3r::WipeTower::toolchange_Change(), and Slic3r::WipeTower::toolchange_Unload().

+ Here is the caller graph for this function:

◆ gcode()

const std::string & Slic3r::WipeTowerWriter::gcode ( ) const
inline
125{ return m_gcode; }

References m_gcode.

Referenced by Slic3r::WipeTower::construct_tcr().

+ Here is the caller graph for this function:

◆ get_and_reset_used_filament_length()

float Slic3r::WipeTowerWriter::get_and_reset_used_filament_length ( )
inline
133{ float temp = m_used_filament_length; m_used_filament_length = 0.f; return temp; }

References m_used_filament_length.

Referenced by Slic3r::WipeTower::finish_layer(), Slic3r::WipeTower::prime(), Slic3r::WipeTower::tool_change(), and Slic3r::WipeTower::toolchange_Change().

+ Here is the caller graph for this function:

◆ load()

WipeTowerWriter & Slic3r::WipeTowerWriter::load ( float  e,
float  f = 0.f 
)
inline
255 {
256 if (e == 0.f && (f == 0.f || f == m_current_feedrate))
257 return *this;
258 m_gcode += "G1";
259 if (e != 0.f)
260 m_gcode += set_format_E(e);
261 if (f != 0.f && f != m_current_feedrate)
263 m_gcode += "\n";
264 return *this;
265 }

References Slic3r::f(), m_current_feedrate, m_gcode, set_format_E(), and set_format_F().

Referenced by retract(), and Slic3r::WipeTower::toolchange_Load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_move_x_advanced()

WipeTowerWriter & Slic3r::WipeTowerWriter::load_move_x_advanced ( float  farthest_x,
float  loading_dist,
float  loading_speed,
float  max_x_speed = 50.f 
)
inline
272 {
273 float time = std::abs(loading_dist / loading_speed); // time that the move must take
274 float x_distance = std::abs(farthest_x - x()); // max x-distance that we can travel
275 float x_speed = x_distance / time; // x-speed to do it in that time
276
277 if (x_speed > max_x_speed) {
278 // Necessary x_speed is too high - we must shorten the distance to achieve max_x_speed and still respect the time.
279 x_distance = max_x_speed * time;
280 x_speed = max_x_speed;
281 }
282
283 float end_point = x() + (farthest_x > x() ? 1.f : -1.f) * x_distance;
284 return extrude_explicit(end_point, y(), loading_dist, x_speed * 60.f, false, false);
285 }

References extrude_explicit(), x(), and y().

Referenced by Slic3r::WipeTower::toolchange_Load(), and Slic3r::WipeTower::toolchange_Unload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

WipeTowerWriter & Slic3r::WipeTowerWriter::operator= ( const WipeTowerWriter rhs)
private

◆ pos()

const Vec2f & Slic3r::WipeTowerWriter::pos ( ) const
inline
129{ return m_current_pos; }

References m_current_pos.

Referenced by Slic3r::WipeTower::construct_tcr(), Slic3r::WipeTower::finish_layer(), set_initial_position(), and set_position().

+ Here is the caller graph for this function:

◆ pos_rotated()

const Vec2f Slic3r::WipeTowerWriter::pos_rotated ( ) const
inline
131{ return this->rotate(m_current_pos); }

References m_current_pos, and rotate().

Referenced by Slic3r::WipeTower::construct_tcr(), extrude_explicit(), and Slic3r::WipeTower::toolchange_Change().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ram()

WipeTowerWriter & Slic3r::WipeTowerWriter::ram ( float  x1,
float  x2,
float  dy,
float  e0,
float  e,
float  f 
)
inline
304 {
305 extrude_explicit(x1, m_current_pos.y() + dy, e0, f, true, false);
306 extrude_explicit(x2, m_current_pos.y(), e, 0.f, true, false);
307 return *this;
308 }

References extrude_explicit(), Slic3r::f(), and m_current_pos.

Referenced by Slic3r::WipeTower::toolchange_Unload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rectangle() [1/2]

WipeTowerWriter & Slic3r::WipeTowerWriter::rectangle ( const Vec2f ld,
float  width,
float  height,
const float  f = 0.f 
)
inline
222 {
223 Vec2f corners[4];
224 corners[0] = ld;
225 corners[1] = ld + Vec2f(width,0.f);
226 corners[2] = ld + Vec2f(width,height);
227 corners[3] = ld + Vec2f(0.f,height);
228 int index_of_closest = 0;
229 if (x()-ld.x() > ld.x()+width-x()) // closer to the right
230 index_of_closest = 1;
231 if (y()-ld.y() > ld.y()+height-y()) // closer to the top
232 index_of_closest = (index_of_closest==0 ? 3 : 2);
233
234 travel(corners[index_of_closest].x(), y()); // travel to the closest corner
235 travel(x(),corners[index_of_closest].y());
236
237 int i = index_of_closest;
238 do {
239 ++i;
240 if (i==4) i=0;
241 extrude(corners[i], f);
242 } while (i != index_of_closest);
243 return (*this);
244 }
WipeTowerWriter & travel(float x, float y, float f=0.f)
Definition WipeTower.cpp:204

References extrude(), Slic3r::f(), travel(), x(), and y().

Referenced by Slic3r::WipeTower::finish_layer(), and rectangle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rectangle() [2/2]

WipeTowerWriter & Slic3r::WipeTowerWriter::rectangle ( const WipeTower::box_coordinates box,
const float  f = 0.f 
)
inline
247 {
248 rectangle(Vec2f(box.ld.x(), box.ld.y()),
249 box.ru.x() - box.lu.x(),
250 box.ru.y() - box.rd.y(), f);
251 return (*this);
252 }
WipeTowerWriter & rectangle(const Vec2f &ld, float width, float height, const float f=0.f)
Definition WipeTower.cpp:221

References Slic3r::f(), Slic3r::WipeTower::box_coordinates::ld, Slic3r::WipeTower::box_coordinates::lu, Slic3r::WipeTower::box_coordinates::rd, rectangle(), and Slic3r::WipeTower::box_coordinates::ru.

+ Here is the call graph for this function:

◆ reset_extruder()

WipeTowerWriter & Slic3r::WipeTowerWriter::reset_extruder ( )
inline
387 {
388 m_gcode += "G92 E0\n";
389 return *this;
390 }

References m_gcode.

Referenced by Slic3r::WipeTower::prime(), and Slic3r::WipeTower::tool_change().

+ Here is the caller graph for this function:

◆ resume_preview()

WipeTowerWriter & Slic3r::WipeTowerWriter::resume_preview ( )
inline
113{ m_preview_suppressed = false; return *this; }

References m_preview_suppressed.

Referenced by Slic3r::WipeTower::toolchange_Unload().

+ Here is the caller graph for this function:

◆ retract()

WipeTowerWriter & Slic3r::WipeTowerWriter::retract ( float  e,
float  f = 0.f 
)
inline
268 { return load(-e, f); }
WipeTowerWriter & load(float e, float f=0.f)
Definition WipeTower.cpp:254

References Slic3r::f(), and load().

Referenced by Slic3r::WipeTower::toolchange_Unload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rotate()

Vec2f Slic3r::WipeTowerWriter::rotate ( Vec2f  pt) const
inlineprivate
485 {
486 pt.x() -= m_wipe_tower_width / 2.f;
487 pt.y() += m_y_shift - m_wipe_tower_depth / 2.f;
488 double angle = m_internal_angle * float(M_PI/180.);
489 double c = cos(angle);
490 double s = sin(angle);
491 return Vec2f(float(pt.x() * c - pt.y() * s) + m_wipe_tower_width / 2.f, float(pt.x() * s + pt.y() * c) + m_wipe_tower_depth / 2.f);
492 }
EIGEN_DEVICE_FUNC const CosReturnType cos() const
Definition ArrayCwiseUnaryOps.h:202
EIGEN_DEVICE_FUNC const SinReturnType sin() const
Definition ArrayCwiseUnaryOps.h:220
float m_y_shift
Definition WipeTower.cpp:443
float m_wipe_tower_width
Definition WipeTower.cpp:444
float m_internal_angle
Definition WipeTower.cpp:442
float m_wipe_tower_depth
Definition WipeTower.cpp:445
double angle(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:112

References Slic3r::angle(), cos(), m_internal_angle, M_PI, m_wipe_tower_depth, m_wipe_tower_width, m_y_shift, and sin().

Referenced by add_wipe_point(), extrude_explicit(), pos_rotated(), and set_initial_position().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_extruder_temp()

WipeTowerWriter & Slic3r::WipeTowerWriter::set_extruder_temp ( int  temperature,
bool  wait = false 
)
inline
328 {
329 m_gcode += "M" + std::to_string(wait ? 109 : 104) + " S" + std::to_string(temperature) + "\n";
330 return *this;
331 }
WipeTowerWriter & wait(float time)
Definition WipeTower.cpp:334
std::string to_string(const Vec2crd &pt)
Definition Point.hpp:139
STL namespace.

References m_gcode, and wait().

Referenced by Slic3r::WipeTower::toolchange_Unload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_extruder_trimpot()

WipeTowerWriter & Slic3r::WipeTowerWriter::set_extruder_trimpot ( int  current)
inline
368 {
370 return *this;
372 m_gcode += "M906 E";
373 else
374 m_gcode += "M907 E";
375 m_gcode += std::to_string(current) + "\n";
376 return *this;
377 }

References Slic3r::gcfKlipper, Slic3r::gcfRepRapFirmware, Slic3r::gcfRepRapSprinter, m_gcode, and m_gcode_flavor.

Referenced by Slic3r::WipeTower::prime(), Slic3r::WipeTower::tool_change(), and Slic3r::WipeTower::toolchange_Load().

+ Here is the caller graph for this function:

◆ set_extrusion_flow()

WipeTowerWriter & Slic3r::WipeTowerWriter::set_extrusion_flow ( float  flow)
inline
87 { m_extrusion_flow = flow; return *this; }

References m_extrusion_flow.

Referenced by Slic3r::WipeTower::finish_layer(), Slic3r::WipeTower::prime(), Slic3r::WipeTower::tool_change(), and Slic3r::WipeTower::toolchange_Wipe().

+ Here is the caller graph for this function:

◆ set_fan()

WipeTowerWriter & Slic3r::WipeTowerWriter::set_fan ( unsigned  speed)
inline
400 {
401 if (speed == m_last_fan_speed)
402 return *this;
403 if (speed == 0)
404 m_gcode += "M107\n";
405 else
406 m_gcode += "M106 S" + std::to_string(unsigned(255.0 * speed / 100.0)) + "\n";
407 m_last_fan_speed = speed;
408 return *this;
409 }
unsigned m_last_fan_speed
Definition WipeTower.cpp:446

References m_gcode, and m_last_fan_speed.

◆ set_format_E()

std::string Slic3r::WipeTowerWriter::set_format_E ( float  e)
inlineprivate
470 {
471 return " E" + Slic3r::float_to_string_decimal_point(e, 4);
472 }
std::string float_to_string_decimal_point(double value, int precision)
Definition LocalesUtils.cpp:74

References Slic3r::float_to_string_decimal_point().

Referenced by extrude_explicit(), and load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_format_F()

std::string Slic3r::WipeTowerWriter::set_format_F ( float  f)
inlineprivate
474 {
475 char buf[64];
476 sprintf(buf, " F%d", int(floor(f + 0.5f)));
478 return buf;
479 }
EIGEN_DEVICE_FUNC const FloorReturnType floor() const
Definition ArrayCwiseUnaryOps.h:388

References Slic3r::f(), floor(), and m_current_feedrate.

Referenced by extrude_explicit(), feedrate(), load(), and z_hop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_format_X()

std::string Slic3r::WipeTowerWriter::set_format_X ( float  x)
inlineprivate
456 {
457 m_current_pos.x() = x;
459 }

References Slic3r::float_to_string_decimal_point(), m_current_pos, and x().

Referenced by extrude_explicit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_format_Y()

std::string Slic3r::WipeTowerWriter::set_format_Y ( float  y)
inlineprivate
461 {
462 m_current_pos.y() = y;
464 }

References Slic3r::float_to_string_decimal_point(), m_current_pos, and y().

Referenced by extrude_explicit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_format_Z()

std::string Slic3r::WipeTowerWriter::set_format_Z ( float  z)
inlineprivate
466 {
467 return " Z" + Slic3r::float_to_string_decimal_point(z, 3);
468 }

References Slic3r::float_to_string_decimal_point().

Referenced by z_hop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_initial_position()

WipeTowerWriter & Slic3r::WipeTowerWriter::set_initial_position ( const Vec2f pos,
float  width = 0.f,
float  depth = 0.f,
float  internal_angle = 0.f 
)
inline
70 {
72 m_wipe_tower_depth = depth;
73 m_internal_angle = internal_angle;
74 m_start_pos = this->rotate(pos);
76 return *this;
77 }
const Vec2f & pos() const
Definition WipeTower.cpp:129
Vec2f m_start_pos
Definition WipeTower.cpp:430

References m_current_pos, m_internal_angle, m_start_pos, m_wipe_tower_depth, m_wipe_tower_width, pos(), and rotate().

Referenced by Slic3r::WipeTower::finish_layer(), Slic3r::WipeTower::prime(), and Slic3r::WipeTower::tool_change().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_initial_tool()

WipeTowerWriter & Slic3r::WipeTowerWriter::set_initial_tool ( size_t  tool)
inline
81{ m_current_tool = tool; return *this; }

References m_current_tool.

Referenced by Slic3r::WipeTower::finish_layer(), Slic3r::WipeTower::prime(), and Slic3r::WipeTower::tool_change().

+ Here is the caller graph for this function:

◆ set_position()

WipeTowerWriter & Slic3r::WipeTowerWriter::set_position ( const Vec2f pos)
inline
79{ m_current_pos = pos; return *this; }

References m_current_pos, and pos().

Referenced by Slic3r::WipeTower::toolchange_Unload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_tool()

WipeTowerWriter & Slic3r::WipeTowerWriter::set_tool ( size_t  tool)
inline
321 {
322 m_current_tool = tool;
323 return *this;
324 }

References m_current_tool.

Referenced by Slic3r::WipeTower::toolchange_Change().

+ Here is the caller graph for this function:

◆ set_y_shift()

WipeTowerWriter & Slic3r::WipeTowerWriter::set_y_shift ( float  shift)
inline
89 {
90 m_current_pos.y() -= shift-m_y_shift;
91 m_y_shift = shift;
92 return (*this);
93 }

References m_current_pos, and m_y_shift.

Referenced by Slic3r::WipeTower::finish_layer(), and Slic3r::WipeTower::tool_change().

+ Here is the caller graph for this function:

◆ set_z()

WipeTowerWriter & Slic3r::WipeTowerWriter::set_z ( float  z)
inline
84 { m_current_z = z; return *this; }

References m_current_z.

Referenced by Slic3r::WipeTower::finish_layer(), Slic3r::WipeTower::prime(), and Slic3r::WipeTower::tool_change().

+ Here is the caller graph for this function:

◆ speed_override()

WipeTowerWriter & Slic3r::WipeTowerWriter::speed_override ( int  speed)
inline
344 {
345 m_gcode += "M220 S" + std::to_string(speed) + "\n";
346 return *this;
347 }

References m_gcode.

Referenced by Slic3r::WipeTower::prime(), and Slic3r::WipeTower::tool_change().

+ Here is the caller graph for this function:

◆ speed_override_backup()

WipeTowerWriter & Slic3r::WipeTowerWriter::speed_override_backup ( )
inline
351 {
352 // This is only supported by Prusa at this point (https://github.com/prusa3d/PrusaSlicer/issues/3114)
354 m_gcode += "M220 B\n";
355 return *this;
356 }
@ gcfMarlinFirmware
Definition PrintConfig.hpp:35
@ gcfMarlinLegacy
Definition PrintConfig.hpp:35

References Slic3r::gcfMarlinFirmware, Slic3r::gcfMarlinLegacy, m_gcode, and m_gcode_flavor.

Referenced by Slic3r::WipeTower::prime(), and Slic3r::WipeTower::tool_change().

+ Here is the caller graph for this function:

◆ speed_override_restore()

WipeTowerWriter & Slic3r::WipeTowerWriter::speed_override_restore ( )
inline
360 {
362 m_gcode += "M220 R\n";
363 return *this;
364 }

References Slic3r::gcfMarlinFirmware, Slic3r::gcfMarlinLegacy, m_gcode, and m_gcode_flavor.

Referenced by Slic3r::WipeTower::prime(), and Slic3r::WipeTower::tool_change().

+ Here is the caller graph for this function:

◆ start_pos_rotated()

const Vec2f Slic3r::WipeTowerWriter::start_pos_rotated ( ) const
inline
130{ return m_start_pos; }

References m_start_pos.

Referenced by Slic3r::WipeTower::construct_tcr().

+ Here is the caller graph for this function:

◆ suppress_preview()

WipeTowerWriter & Slic3r::WipeTowerWriter::suppress_preview ( )
inline
112{ m_preview_suppressed = true; return *this; }

References m_preview_suppressed.

Referenced by Slic3r::WipeTower::toolchange_Load(), and Slic3r::WipeTower::toolchange_Unload().

+ Here is the caller graph for this function:

◆ travel() [1/2]

WipeTowerWriter & Slic3r::WipeTowerWriter::travel ( const Vec2f dest,
float  f = 0.f 
)
inline
208 { return extrude_explicit(dest.x(), dest.y(), 0.f, f); }

References extrude_explicit(), and Slic3r::f().

+ Here is the call graph for this function:

◆ travel() [2/2]

WipeTowerWriter & Slic3r::WipeTowerWriter::travel ( float  x,
float  y,
float  f = 0.f 
)
inline
205 { return extrude_explicit(x, y, 0.f, f); }

References extrude_explicit(), Slic3r::f(), x(), and y().

Referenced by Slic3r::WipeTower::finish_layer(), Slic3r::WipeTower::prime(), rectangle(), Slic3r::WipeTower::tool_change(), Slic3r::WipeTower::toolchange_Load(), Slic3r::WipeTower::toolchange_Unload(), and Slic3r::WipeTower::toolchange_Wipe().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wait()

WipeTowerWriter & Slic3r::WipeTowerWriter::wait ( float  time)
inline
335 {
336 if (time==0.f)
337 return *this;
338 m_gcode += "G4 S" + Slic3r::float_to_string_decimal_point(time, 3) + "\n";
339 return *this;
340 }

References Slic3r::float_to_string_decimal_point(), and m_gcode.

Referenced by set_extruder_temp(), and Slic3r::WipeTower::toolchange_Unload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wipe_path()

const std::vector< Vec2f > & Slic3r::WipeTowerWriter::wipe_path ( ) const
inline
414 {
415 return m_wipe_path;
416 }

References m_wipe_path.

Referenced by Slic3r::WipeTower::construct_tcr().

+ Here is the caller graph for this function:

◆ x()

float Slic3r::WipeTowerWriter::x ( ) const
inline
127{ return m_current_pos.x(); }

References m_current_pos.

Referenced by add_wipe_point(), extrude(), extrude_explicit(), Slic3r::WipeTower::finish_layer(), load_move_x_advanced(), rectangle(), set_format_X(), Slic3r::WipeTower::tool_change(), Slic3r::WipeTower::toolchange_Load(), Slic3r::WipeTower::toolchange_Unload(), Slic3r::WipeTower::toolchange_Wipe(), and travel().

+ Here is the caller graph for this function:

◆ y()

float Slic3r::WipeTowerWriter::y ( ) const
inline
128{ return m_current_pos.y(); }

References m_current_pos.

Referenced by add_wipe_point(), extrude(), extrude_explicit(), Slic3r::WipeTower::finish_layer(), load_move_x_advanced(), Slic3r::WipeTower::prime(), rectangle(), set_format_Y(), Slic3r::WipeTower::tool_change(), Slic3r::WipeTower::toolchange_Load(), Slic3r::WipeTower::toolchange_Unload(), Slic3r::WipeTower::toolchange_Wipe(), and travel().

+ Here is the caller graph for this function:

◆ z_hop()

WipeTowerWriter & Slic3r::WipeTowerWriter::z_hop ( float  hop,
float  f = 0.f 
)
inline
289 {
290 m_gcode += std::string("G1") + set_format_Z(m_current_z + hop);
291 if (f != 0 && f != m_current_feedrate)
293 m_gcode += "\n";
294 return *this;
295 }
std::string set_format_Z(float z)
Definition WipeTower.cpp:466

References Slic3r::f(), m_current_feedrate, m_current_z, m_gcode, set_format_F(), and set_format_Z().

Referenced by z_hop_reset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ z_hop_reset()

WipeTowerWriter & Slic3r::WipeTowerWriter::z_hop_reset ( float  f = 0.f)
inline
299 { return z_hop(0, f); }
WipeTowerWriter & z_hop(float hop, float f=0.f)
Definition WipeTower.cpp:288

References Slic3r::f(), and z_hop().

+ Here is the call graph for this function:

Member Data Documentation

◆ current_temp

int Slic3r::WipeTowerWriter::current_temp = -1
private

◆ m_current_feedrate

float Slic3r::WipeTowerWriter::m_current_feedrate
private

◆ m_current_pos

◆ m_current_tool

size_t Slic3r::WipeTowerWriter::m_current_tool
private

◆ m_current_z

float Slic3r::WipeTowerWriter::m_current_z
private

Referenced by set_z(), and z_hop().

◆ m_elapsed_time

float Slic3r::WipeTowerWriter::m_elapsed_time
private

Referenced by elapsed_time(), and extrude_explicit().

◆ m_extrusion_flow

float Slic3r::WipeTowerWriter::m_extrusion_flow
private

Referenced by extrude(), and set_extrusion_flow().

◆ m_extrusions

std::vector<WipeTower::Extrusion> Slic3r::WipeTowerWriter::m_extrusions
private

Referenced by extrude_explicit(), and extrusions().

◆ m_filpar

const std::vector<WipeTower::FilamentParameters>& Slic3r::WipeTowerWriter::m_filpar
private

Referenced by extrude_explicit().

◆ m_gcode

◆ m_gcode_flavor

GCodeFlavor Slic3r::WipeTowerWriter::m_gcode_flavor
private

◆ m_internal_angle

float Slic3r::WipeTowerWriter::m_internal_angle = 0.f
private

Referenced by rotate(), and set_initial_position().

◆ m_last_fan_speed

unsigned Slic3r::WipeTowerWriter::m_last_fan_speed = 0
private

Referenced by set_fan().

◆ m_layer_height

float Slic3r::WipeTowerWriter::m_layer_height
private

◆ m_preview_suppressed

bool Slic3r::WipeTowerWriter::m_preview_suppressed
private

◆ m_start_pos

Vec2f Slic3r::WipeTowerWriter::m_start_pos
private

◆ m_used_filament_length

float Slic3r::WipeTowerWriter::m_used_filament_length = 0.f
private

◆ m_wipe_path

std::vector<Vec2f> Slic3r::WipeTowerWriter::m_wipe_path
private

Referenced by add_wipe_point(), and wipe_path().

◆ m_wipe_tower_depth

float Slic3r::WipeTowerWriter::m_wipe_tower_depth = 0.f
private

Referenced by rotate(), and set_initial_position().

◆ m_wipe_tower_width

float Slic3r::WipeTowerWriter::m_wipe_tower_width = 0.f
private

Referenced by rotate(), and set_initial_position().

◆ m_y_shift

float Slic3r::WipeTowerWriter::m_y_shift = 0.f
private

Referenced by rotate(), and set_y_shift().


The documentation for this class was generated from the following file: