OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::WipeTowerWriter2 Class Reference
Collaboration diagram for Slic3r::WipeTowerWriter2:

Public Member Functions

 WipeTowerWriter2 (float layer_height, float line_width, GCodeFlavor flavor, const std::vector< WipeTower2::FilamentParameters > &filament_parameters, bool enable_arc_fitting)
WipeTowerWriter2 & change_analyzer_line_width (float line_width)
WipeTowerWriter2 & set_initial_position (const Vec2f &pos, float width=0.f, float depth=0.f, float internal_angle=0.f)
WipeTowerWriter2 & set_position (const Vec2f &pos)
WipeTowerWriter2 & set_initial_tool (size_t tool)
WipeTowerWriter2 & set_z (float z)
WipeTowerWriter2 & set_extrusion_flow (float flow)
WipeTowerWriter2 & set_y_shift (float shift)
WipeTowerWriter2 & disable_linear_advance ()
WipeTowerWriter2 & switch_filament_monitoring (bool enable)
WipeTowerWriter2 & suppress_preview ()
WipeTowerWriter2 & resume_preview ()
WipeTowerWriter2 & feedrate (float f)
const std::string & gcode () const
const std::vector< WipeTower::Extrusion > & extrusions () const
float x () const
float y () const
const Vec2f & pos () const
const Vec2f start_pos_rotated () const
const Vec2f pos_rotated () const
const Vec2f rotated (const Vec2f &pt) const
float elapsed_time () const
float get_and_reset_used_filament_length ()
WipeTowerWriter2 & extrude_explicit (float x, float y, float e, float f=0.f, bool record_length=false, bool limit_volumetric_flow=true)
WipeTowerWriter2 & extrude_explicit (const Vec2f &dest, float e, float f=0.f, bool record_length=false, bool limit_volumetric_flow=true)
WipeTowerWriter2 & travel (float x, float y, float f=0.f)
WipeTowerWriter2 & travel (const Vec2f &dest, float f=0.f)
WipeTowerWriter2 & extrude (float x, float y, float f=0.f)
WipeTowerWriter2 & extrude (const Vec2f &dest, const float f=0.f)
WipeTowerWriter2 & rectangle (const Vec2f &ld, float width, float height, const float f=0.f)
WipeTowerWriter2 & rectangle (const WipeTower::box_coordinates &box, const float f=0.f)
WipeTowerWriter2 & load (float e, float f=0.f)
WipeTowerWriter2 & retract (float e, float f=0.f)
WipeTowerWriter2 & load_move_x_advanced (float farthest_x, float loading_dist, float loading_speed, float max_x_speed=50.f)
WipeTowerWriter2 & load_move_x_advanced_there_and_back (float farthest_x, float e_dist, float e_speed, float x_speed)
WipeTowerWriter2 & z_hop (float hop, float f=0.f)
WipeTowerWriter2 & z_hop_reset (float f=0.f)
WipeTowerWriter2 & ram (float x1, float x2, float dy, float e0, float e, float f)
WipeTowerWriter2 & cool (float x1, float x2, float e1, float e2, float f)
WipeTowerWriter2 & set_tool (size_t tool)
WipeTowerWriter2 & set_extruder_temp (int temperature, bool wait=false, const std::string &comment=std::string())
WipeTowerWriter2 & wait (float time)
WipeTowerWriter2 & speed_override (int speed)
WipeTowerWriter2 & speed_override_backup ()
WipeTowerWriter2 & speed_override_restore ()
WipeTowerWriter2 & set_extruder_trimpot (int current)
WipeTowerWriter2 & flush_planner_queue ()
WipeTowerWriter2 & reset_extruder ()
WipeTowerWriter2 & comment_with_value (const char *comment, int value)
WipeTowerWriter2 & set_fan (unsigned speed)
WipeTowerWriter2 & append (const std::string &text)
const std::vector< Vec2f > & wipe_path () const
WipeTowerWriter2 & add_wipe_point (const Vec2f &pt)
WipeTowerWriter2 & add_wipe_point (float x, float y)
void spiral_flat_ironing (const Vec2f &center, float area, float step_length, float feedrate)
WipeTowerWriter2 & extrude_arc_explicit (ArcSegment &arc, float f=0.f, bool record_length=false, LimitFlow limit_flow=LimitFlow::LimitPrintFlow)
WipeTowerWriter2 & extrude_arc (ArcSegment &arc, float f=0.f, LimitFlow limit_flow=LimitFlow::LimitPrintFlow)
void generate_path (Polylines &pls, float feedrate, float retract_length, float retract_speed, bool used_fillet)

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)
std::string set_format_I (float i)
std::string set_format_J (float j)
WipeTowerWriter2 & operator= (const WipeTowerWriter2 &rhs)
Vec2f rotate (Vec2f pt) const

Private Attributes

Vec2f m_start_pos
Vec2f m_current_pos
std::vector< Vec2f > m_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::Extrusion > m_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
bool m_enable_arc_fitting = false
const std::vector< WipeTower2::FilamentParameters > & m_filpar

Detailed Description

Constructor & Destructor Documentation

◆ WipeTowerWriter2()

Slic3r::WipeTowerWriter2::WipeTowerWriter2 ( float layer_height,
float line_width,
GCodeFlavor flavor,
const std::vector< WipeTower2::FilamentParameters > & filament_parameters,
bool enable_arc_fitting )
inline
345 :
346 m_current_pos(std::numeric_limits<float>::max(), std::numeric_limits<float>::max()),
347 m_current_z(0.f),
350 m_extrusion_flow(0.f),
352 m_elapsed_time(0.f),
353 m_gcode_flavor(flavor), m_filpar(filament_parameters)
354 //m_enable_arc_fitting(enable_arc_fitting)
355 {
356 // ORCA: This class is only used by non BBL printers, so set the parameter appropriately.
357 // This fixes an issue where the wipe tower was using BBL tags resulting in statistics for purging in the purge tower not being displayed.
359 // adds tag for analyzer:
360 std::ostringstream str;
361 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
363 m_gcode += str.str();
364 change_analyzer_line_width(line_width);
365 }
static std::string role_to_string(ExtrusionRole role)
Definition ExtrusionEntity.cpp:673
static const std::string & reserved_tag(ETags tag)
Definition GCodeProcessor.hpp:636
@ Role
Definition GCodeProcessor.hpp:604
@ Height
Definition GCodeProcessor.hpp:607
static bool s_IsBBLPrinter
Definition GCodeProcessor.hpp:650
std::string m_gcode
Definition WipeTower2.cpp:941
bool m_preview_suppressed
Definition WipeTower2.cpp:940
WipeTowerWriter2 & change_analyzer_line_width(float line_width)
Definition WipeTower2.cpp:367
const std::vector< WipeTower2::FilamentParameters > & m_filpar
Definition WipeTower2.cpp:953
float m_extrusion_flow
Definition WipeTower2.cpp:939
float m_elapsed_time
Definition WipeTower2.cpp:943
Vec2f m_current_pos
Definition WipeTower2.cpp:933
float m_current_z
Definition WipeTower2.cpp:935
float m_current_feedrate
Definition WipeTower2.cpp:936
float m_layer_height
Definition WipeTower2.cpp:938
GCodeFlavor m_gcode_flavor
Definition WipeTower2.cpp:951
layer_height((ConfigOptionInt, faded_layers))((ConfigOptionFloat
@ erWipeTower
Definition ExtrusionEntity.hpp:44

References change_analyzer_line_width(), Slic3r::erWipeTower, Slic3r::GCodeProcessor::Height, Slic3r::layer_height(), m_current_feedrate, m_current_pos, m_current_z, m_elapsed_time, m_extrusion_flow, m_filpar, m_gcode, m_gcode_flavor, m_layer_height, m_preview_suppressed, Slic3r::GCodeProcessor::reserved_tag(), Slic3r::GCodeProcessor::Role, Slic3r::ExtrusionEntity::role_to_string(), and Slic3r::GCodeProcessor::s_IsBBLPrinter.

Referenced by add_wipe_point(), add_wipe_point(), append(), change_analyzer_line_width(), comment_with_value(), cool(), disable_linear_advance(), extrude(), extrude(), extrude_arc(), extrude_arc_explicit(), extrude_explicit(), extrude_explicit(), feedrate(), flush_planner_queue(), load(), load_move_x_advanced(), load_move_x_advanced_there_and_back(), operator=(), ram(), rectangle(), rectangle(), reset_extruder(), resume_preview(), retract(), set_extruder_temp(), set_extruder_trimpot(), set_extrusion_flow(), set_fan(), set_initial_position(), set_initial_tool(), set_position(), set_tool(), set_y_shift(), set_z(), speed_override(), speed_override_backup(), speed_override_restore(), suppress_preview(), switch_filament_monitoring(), travel(), travel(), wait(), z_hop(), and z_hop_reset().

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

Member Function Documentation

◆ add_wipe_point() [1/2]

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::add_wipe_point ( const Vec2f & pt)
inline
746 {
747 m_wipe_path.push_back(rotate(pt));
748 return *this;
749 }
Vec2f rotate(Vec2f pt) const
Definition WipeTower2.cpp:986
std::vector< Vec2f > m_wipe_path
Definition WipeTower2.cpp:934

References WipeTowerWriter2(), m_wipe_path, and rotate().

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

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

◆ add_wipe_point() [2/2]

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::add_wipe_point ( float x,
float y )
inline
752 {
753 return add_wipe_point(Vec2f(x, y));
754 }
WipeTowerWriter2 & add_wipe_point(const Vec2f &pt)
Definition WipeTower2.cpp:745
float y() const
Definition WipeTower2.cpp:434
float x() const
Definition WipeTower2.cpp:433
Eigen::Matrix< float, 2, 1, Eigen::DontAlign > Vec2f
Definition Point.hpp:64

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

Here is the call graph for this function:

◆ append()

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

References WipeTowerWriter2(), and m_gcode.

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

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

◆ change_analyzer_line_width()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::change_analyzer_line_width ( float line_width)
inline
367 {
368 // adds tag for analyzer:
369 std::stringstream str;
370 str << ";" << GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Width) << line_width << "\n";
371 m_gcode += str.str();
372 return *this;
373 }
@ Width
Definition GCodeProcessor.hpp:608

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

Referenced by WipeTowerWriter2(), Slic3r::WipeTower2::toolchange_Unload(), and Slic3r::WipeTower2::toolchange_Wipe().

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

◆ comment_with_value()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::comment_with_value ( const char * comment,
int value )
inline
720 {
721 m_gcode += std::string(";") + comment + std::to_string(value) + "\n";
722 return *this;
723 }

References WipeTowerWriter2(), and m_gcode.

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

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

◆ cool()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::cool ( float x1,
float x2,
float e1,
float e2,
float f )
inline
637 {
638 extrude_explicit(x1, m_current_pos.y(), e1, f, false, false);
639 extrude_explicit(x2, m_current_pos.y(), e2, false, false);
640 return *this;
641 }
WipeTowerWriter2 & extrude_explicit(float x, float y, float e, float f=0.f, bool record_length=false, bool limit_volumetric_flow=true)
Definition WipeTower2.cpp:443
static double f(double x, double z_sin, double z_cos, bool vertical, bool flip)
Definition FillGyroid.cpp:124

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

Here is the call graph for this function:

◆ disable_linear_advance()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::disable_linear_advance ( )
inline
400 {
402 m_gcode += (std::string("M572 D") + std::to_string(m_current_tool) + " S0\n");
403 else if (m_gcode_flavor == gcfKlipper)
404 m_gcode += "SET_PRESSURE_ADVANCE ADVANCE=0\n";
405 else
406 m_gcode += "M900 K0\n";
407 return *this;
408 }
size_t m_current_tool
Definition WipeTower2.cpp:937
@ gcfKlipper
Definition PrintConfig.hpp:53
@ gcfRepRapFirmware
Definition PrintConfig.hpp:54
@ gcfRepRapSprinter
Definition PrintConfig.hpp:57

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

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

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

◆ elapsed_time()

float Slic3r::WipeTowerWriter2::elapsed_time ( ) const
inline
439{ return m_elapsed_time; }

References m_elapsed_time.

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

Here is the caller graph for this function:

◆ extrude() [1/2]

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::extrude ( const Vec2f & dest,
const float f = 0.f )
inline
523 { return extrude(dest.x(), dest.y(), f); }
WipeTowerWriter2 & extrude(float x, float y, float f=0.f)
Definition WipeTower2.cpp:515

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

Here is the call graph for this function:

◆ extrude() [2/2]

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::extrude ( float x,
float y,
float f = 0.f )
inline
516 {
517 float dx = x - m_current_pos.x();
518 float dy = y - m_current_pos.y();
519 return extrude_explicit(x, y, std::sqrt(dx*dx+dy*dy) * m_extrusion_flow, f, true);
520 }

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

Referenced by extrude(), Slic3r::WipeTower2::finish_layer(), generate_path(), Slic3r::WipeTower2::generate_support_cone_wall(), rectangle(), Slic3r::WipeTower2::toolchange_Unload(), and Slic3r::WipeTower2::toolchange_Wipe().

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

◆ extrude_arc()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::extrude_arc ( ArcSegment & arc,
float f = 0.f,
LimitFlow limit_flow = LimitFlow::LimitPrintFlow )
inline
858 {
859 return extrude_arc_explicit(arc, f, false, limit_flow);
860 }
WipeTowerWriter2 & extrude_arc_explicit(ArcSegment &arc, float f=0.f, bool record_length=false, LimitFlow limit_flow=LimitFlow::LimitPrintFlow)
Definition WipeTower2.cpp:776

References WipeTowerWriter2(), extrude_arc_explicit(), Slic3r::f(), and Slic3r::LimitPrintFlow.

Referenced by generate_path().

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

◆ extrude_arc_explicit()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::extrude_arc_explicit ( ArcSegment & arc,
float f = 0.f,
bool record_length = false,
LimitFlow limit_flow = LimitFlow::LimitPrintFlow )
inline
780 {
781 float x = (float) unscale(arc.end_point).x();
782 float y = (float) unscale(arc.end_point).y();
783 float len = unscaled<float>(arc.length);
784 float e = len * m_extrusion_flow;
785 if (len < (float) EPSILON && e == 0.f && (f == 0.f || f == m_current_feedrate))
786 // Neither extrusion nor a travel move.
787 return *this;
788 if (record_length)
790
791 // Now do the "internal rotation" with respect to the wipe tower center
792 Vec2f rotated_current_pos(this->pos_rotated());
793 Vec2f rot(this->rotate(Vec2f(x, y))); // this is where we want to go
794
795 if (!m_preview_suppressed && e > 0.f && len > 0.f) {
796#if ENABLE_GCODE_VIEWER_DATA_CHECKING
797 change_analyzer_mm3_per_mm(len, e);
798#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
799 // Width of a squished extrusion, corrected for the roundings of the squished extrusions.
800 // This is left zero if it is a travel move.
801 float width = e * m_filpar[0].filament_area / (len * m_layer_height);
802 // Correct for the roundings of a squished extrusion.
803 width += m_layer_height * float(1. - M_PI / 4.);
804 if (m_extrusions.empty() || m_extrusions.back().pos != rotated_current_pos)
805 m_extrusions.emplace_back(WipeTower::Extrusion(rotated_current_pos, 0, m_current_tool));
806 {
807 int n = arc_fit_size;
808 for (int j = 0; j < n; j++) {
809 float cur_angle = arc.polar_start_theta + (float) j / n * arc.angle_radians;
810 if (cur_angle > 2 * PI)
811 cur_angle -= 2 * PI;
812 else if (cur_angle < 0)
813 cur_angle += 2 * PI;
814 Point tmp = arc.center + Point{arc.radius * std::cos(cur_angle), arc.radius * std::sin(cur_angle)};
815 m_extrusions.emplace_back(WipeTower::Extrusion(this->rotate(unscaled<float>(tmp)), width, m_current_tool));
816 }
817 m_extrusions.emplace_back(WipeTower::Extrusion(rot, width, m_current_tool));
818 }
819 }
820
821 //if (e == 0.f) {
822 // m_gcode += set_travel_acceleration();
823 //} else {
824 // m_gcode += set_normal_acceleration();
825 //}
826
827 m_gcode += arc.direction == ArcDirection::Arc_Dir_CCW ? "G3" : "G2";
828 const Vec2f center_offset = this->rotate(unscaled<float>(arc.center)) - rotated_current_pos;
829 m_gcode += set_format_X(rot.x());
830 m_gcode += set_format_Y(rot.y());
831 m_gcode += set_format_I(center_offset.x());
832 m_gcode += set_format_J(center_offset.y());
833
834 if (e != 0.f)
835 m_gcode += set_format_E(e);
836
837 if (f != 0.f && f != m_current_feedrate) {
838 if (limit_flow != LimitFlow::None) {
839 float e_speed = e / (((len == 0.f) ? std::abs(e) : len) / f * 60.f);
840 float tmp = m_filpar[m_current_tool].max_e_speed;
841 //if (limit_flow == LimitFlow::LimitRammingFlow)
842 // tmp = m_filpar[m_current_tool].max_e_ramming_speed;
843 f /= std::max(1.f, e_speed / tmp);
844 }
846 }
847
848 m_current_pos.x() = x;
849 m_current_pos.y() = y;
850
851 // Update the elapsed time with a rough estimate.
852 m_elapsed_time += ((len == 0.f) ? std::abs(e) : len) / m_current_feedrate * 60.f;
853 m_gcode += "\n";
854 return *this;
855 }
#define EPSILON
Definition ColorUtils.cpp:64
#define M_PI
Definition ExtrusionSimulator.cpp:31
std::vector< WipeTower::Extrusion > m_extrusions
Definition WipeTower2.cpp:942
std::string set_format_Y(float y)
Definition WipeTower2.cpp:961
std::string set_format_E(float e)
Definition WipeTower2.cpp:970
std::string set_format_X(float x)
Definition WipeTower2.cpp:955
std::string set_format_I(float i)
Definition WipeTower2.cpp:980
std::string set_format_F(float f)
Definition WipeTower2.cpp:974
float m_used_filament_length
Definition WipeTower2.cpp:950
const Vec2f pos_rotated() const
Definition WipeTower2.cpp:437
std::string set_format_J(float j)
Definition WipeTower2.cpp:981
static constexpr double PI
Definition libslic3r.h:81
void arc(std::vector< std::pair< Vec2d, Vec2d > > &out, double cx, double cy, double rx, double ry, double a0, double a1, int n=14)
Definition DesignSketchTool.cpp:7759
Kernel::Point_3 Point
Definition MeshRepair.cpp:81
coord_t width(const BoundingBox &box)
Definition Arrange.cpp:1184
constexpr Eigen::Matrix< Tout, 2, EigenArgs... > unscaled(const Slic3r::Point &v) noexcept
Definition Arrange.cpp:81
T unscale(Q v)
Definition libslic3r.h:138
static constexpr int arc_fit_size
Definition WipeTower.cpp:48
@ None
Definition WipeTower.cpp:50
@ Arc_Dir_CCW
Definition Circle.hpp:63

References WipeTowerWriter2(), Slic3r::Arc_Dir_CCW, Slic3r::arc_fit_size, EPSILON, Slic3r::f(), Slic3r::LimitPrintFlow, m_current_feedrate, m_current_pos, m_current_tool, m_elapsed_time, m_extrusion_flow, m_extrusions, m_filpar, m_gcode, m_layer_height, M_PI, m_preview_suppressed, m_used_filament_length, Slic3r::None, PI, pos_rotated(), rotate(), set_format_E(), set_format_F(), set_format_I(), set_format_J(), set_format_X(), set_format_Y(), Slic3r::unscale(), Slic3r::unscaled(), x(), and y().

Referenced by extrude_arc().

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

◆ extrude_explicit() [1/2]

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

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

Here is the call graph for this function:

◆ extrude_explicit() [2/2]

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::extrude_explicit ( float x,
float y,
float e,
float f = 0.f,
bool record_length = false,
bool limit_volumetric_flow = true )
inline
444 {
445 if (x == m_current_pos.x() && y == m_current_pos.y() && e == 0.f && (f == 0.f || f == m_current_feedrate))
446 // Neither extrusion nor a travel move.
447 return *this;
448
449 float dx = x - m_current_pos.x();
450 float dy = y - m_current_pos.y();
451 float len = std::sqrt(dx*dx+dy*dy);
452 if (record_length)
454
455 // Now do the "internal rotation" with respect to the wipe tower center
456 Vec2f rotated_current_pos(this->pos_rotated());
457 Vec2f rot(this->rotate(Vec2f(x,y))); // this is where we want to go
458
459 if (! m_preview_suppressed && e > 0.f && len > 0.f) {
460 // Width of a squished extrusion, corrected for the roundings of the squished extrusions.
461 // This is left zero if it is a travel move.
462 float width = e * m_filpar[0].filament_area / (len * m_layer_height);
463 // Correct for the roundings of a squished extrusion.
464 width += m_layer_height * float(1. - M_PI / 4.);
465 if (m_extrusions.empty() || m_extrusions.back().pos != rotated_current_pos)
466 m_extrusions.emplace_back(WipeTower::Extrusion(rotated_current_pos, 0, m_current_tool));
467 m_extrusions.emplace_back(WipeTower::Extrusion(rot, width, m_current_tool));
468 }
469
470 m_gcode += "G1";
471 if (std::abs(rot.x() - rotated_current_pos.x()) > (float)EPSILON)
472 m_gcode += set_format_X(rot.x());
473
474 if (std::abs(rot.y() - rotated_current_pos.y()) > (float)EPSILON)
475 m_gcode += set_format_Y(rot.y());
476
477
478 if (e != 0.f)
479 m_gcode += set_format_E(e);
480
481 if (f != 0.f && f != m_current_feedrate) {
482 if (limit_volumetric_flow) {
483 float e_speed = e / (((len == 0.f) ? std::abs(e) : len) / f * 60.f);
484 f /= std::max(1.f, e_speed / m_filpar[m_current_tool].max_e_speed);
485 }
487 }
488
489 // Append newline if at least one of X,Y,E,F was changed.
490 // Otherwise, remove the "G1".
491 if (! boost::ends_with(m_gcode, "G1"))
492 m_gcode += "\n";
493 else
494 m_gcode.erase(m_gcode.end()-2, m_gcode.end());
495
496 m_current_pos.x() = x;
497 m_current_pos.y() = y;
498
499 // Update the elapsed time with a rough estimate.
500 m_elapsed_time += ((len == 0.f) ? std::abs(e) : len) / m_current_feedrate * 60.f;
501 return *this;
502 }

References WipeTowerWriter2(), 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(), load_move_x_advanced_there_and_back(), ram(), Slic3r::WipeTower2::tool_change(), 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::WipeTowerWriter2::extrusions ( ) const
inline
432{ return m_extrusions; }

References m_extrusions.

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

Here is the caller graph for this function:

◆ feedrate()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::feedrate ( float f)
inline
423 {
424 if (f != m_current_feedrate) {
425 m_gcode += "G1" + set_format_F(f) + "\n";
427 }
428 return *this;
429 }

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

Referenced by generate_path(), Slic3r::WipeTower2::prime(), spiral_flat_ironing(), Slic3r::WipeTower2::tool_change(), and Slic3r::WipeTower2::toolchange_Change().

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

◆ flush_planner_queue()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::flush_planner_queue ( )
inline
707 {
709 return *this;
710 }
const char * flush_planner_queue_command(GCodeFlavor flavor)
Definition WipeTower.cpp:719

References WipeTowerWriter2(), Slic3r::flush_planner_queue_command(), m_gcode, and m_gcode_flavor.

Referenced by Slic3r::WipeTower2::prime(), set_extruder_temp(), switch_filament_monitoring(), Slic3r::WipeTower2::tool_change(), Slic3r::WipeTower2::toolchange_Change(), and Slic3r::WipeTower2::toolchange_Unload().

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

◆ gcode()

const std::string & Slic3r::WipeTowerWriter2::gcode ( ) const
inline
431{ return m_gcode; }

References m_gcode.

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

Here is the caller graph for this function:

◆ generate_path()

void Slic3r::WipeTowerWriter2::generate_path ( Polylines & pls,
float feedrate,
float retract_length,
float retract_speed,
bool used_fillet )
inline
863 {
864 auto get_closet_idx = [this](std::vector<Segment>& corners) -> int {
865 Vec2f anchor{this->m_current_pos.x(), this->m_current_pos.y()};
866 int closestIndex = -1;
867 float minDistance = std::numeric_limits<float>::max();
868 for (int i = 0; i < corners.size(); ++i) {
869 float distance = (corners[i].start - anchor).squaredNorm();
870 if (distance < minDistance) {
871 minDistance = distance;
872 closestIndex = i;
873 }
874 }
875 return closestIndex;
876 };
877 std::vector<Segment> segments;
879 for (auto& pl : pls)
880 pl.simplify_by_fitting_arc(SCALED_WIPE_TOWER_RESOLUTION);
881
882 for (const auto& pl : pls) {
883 if (pl.points.size() < 2)
884 continue;
885 for (int i = 0; i < pl.fitting_result.size(); i++) {
886 if (pl.fitting_result[i].path_type == EMovePathType::Linear_move) {
887 for (int j = pl.fitting_result[i].start_point_index; j < pl.fitting_result[i].end_point_index; j++)
888 segments.push_back({unscaled<float>(pl.points[j]), unscaled<float>(pl.points[j + 1])});
889 } else {
890 int beg = pl.fitting_result[i].start_point_index;
891 int end = pl.fitting_result[i].end_point_index;
892 segments.push_back({unscaled<float>(pl.points[beg]), unscaled<float>(pl.points[end])});
893 segments.back().is_arc = true;
894 segments.back().arcsegment = pl.fitting_result[i].arc_data;
895 }
896 }
897 }
898 for (auto& pl : pls)
899 pl.simplify(SCALED_WIPE_TOWER_RESOLUTION);
900
901 } else {
902 for (const auto& pl : pls) {
903 if (pl.points.size() < 2)
904 continue;
905 for (int i = 0; i < pl.size() - 1; i++) {
906 segments.push_back({unscaled<float>(pl.points[i]), unscaled<float>(pl.points[i + 1])});
907 }
908 }
909 }
910
911 int index_of_closest = get_closet_idx(segments);
912 int i = index_of_closest;
913 travel(segments[i].start); // travel to the closest points
914 segments[i].is_arc ? extrude_arc(segments[i].arcsegment, feedrate) : extrude(segments[i].end, feedrate);
915 do {
916 i = (i + 1) % segments.size();
917 if (i == index_of_closest)
918 break;
919 float dx = segments[i].start.x() - m_current_pos.x();
920 float dy = segments[i].start.y() - m_current_pos.y();
921 float len = std::sqrt(dx * dx + dy * dy);
922 if (len > EPSILON) {
923 retract(retract_length, retract_speed);
924 travel(segments[i].start, 600.);
925 retract(-retract_length, retract_speed);
926 }
927 segments[i].is_arc ? extrude_arc(segments[i].arcsegment, feedrate) : extrude(segments[i].end, feedrate);
928 } while (1);
929 }
#define SCALED_WIPE_TOWER_RESOLUTION
Definition WipeTower.cpp:49
WipeTowerWriter2 & feedrate(float f)
Definition WipeTower2.cpp:422
WipeTowerWriter2 & travel(float x, float y, float f=0.f)
Definition WipeTower2.cpp:508
bool m_enable_arc_fitting
Definition WipeTower2.cpp:952
WipeTowerWriter2 & extrude_arc(ArcSegment &arc, float f=0.f, LimitFlow limit_flow=LimitFlow::LimitPrintFlow)
Definition WipeTower2.cpp:857
WipeTowerWriter2 & retract(float e, float f=0.f)
Definition WipeTower2.cpp:571
T * end(Slic3r::Mat< N, M, T > &mat)
Definition Point.hpp:841
float distance(SpiralVase::SpiralPoint a, SpiralVase::SpiralPoint b)
Definition SpiralVase.cpp:19
@ Linear_move
Definition ArcFitter.hpp:15

References EPSILON, extrude(), extrude_arc(), feedrate(), Slic3r::Linear_move, m_current_pos, m_enable_arc_fitting, retract(), SCALED_WIPE_TOWER_RESOLUTION, travel(), and Slic3r::unscaled().

Referenced by Slic3r::WipeTower2::generate_support_rib_wall().

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

◆ get_and_reset_used_filament_length()

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

References m_used_filament_length.

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

Here is the caller graph for this function:

◆ load()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::load ( float e,
float f = 0.f )
inline
559 {
560 if (e == 0.f && (f == 0.f || f == m_current_feedrate))
561 return *this;
562 m_gcode += "G1";
563 if (e != 0.f)
564 m_gcode += set_format_E(e);
565 if (f != 0.f && f != m_current_feedrate)
567 m_gcode += "\n";
568 return *this;
569 }

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

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

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

◆ load_move_x_advanced()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::load_move_x_advanced ( float farthest_x,
float loading_dist,
float loading_speed,
float max_x_speed = 50.f )
inline
576 {
577 float time = std::abs(loading_dist / loading_speed); // time that the move must take
578 float x_distance = std::abs(farthest_x - x()); // max x-distance that we can travel
579 float x_speed = x_distance / time; // x-speed to do it in that time
580
581 if (x_speed > max_x_speed) {
582 // Necessary x_speed is too high - we must shorten the distance to achieve max_x_speed and still respect the time.
583 x_distance = max_x_speed * time;
584 x_speed = max_x_speed;
585 }
586
587 float end_point = x() + (farthest_x > x() ? 1.f : -1.f) * x_distance;
588 return extrude_explicit(end_point, y(), loading_dist, x_speed * 60.f, false, false);
589 }

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

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

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

◆ load_move_x_advanced_there_and_back()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::load_move_x_advanced_there_and_back ( float farthest_x,
float e_dist,
float e_speed,
float x_speed )
inline
594 {
595 float old_x = x();
596 float time = std::abs(e_dist / e_speed); // time that the whole move must take
597 float x_max_dist = std::abs(farthest_x - x()); // max x-distance that we can travel
598 float x_dist = x_speed * time; // totel x-distance to travel during the move
599 int n = int(x_dist / (2*x_max_dist) + 1.f); // how many there and back moves should we do
600 float r = 2*n*x_max_dist / x_dist; // actual/required dist if the move is not shortened
601
602 float end_point = x() + (farthest_x > x() ? 1.f : -1.f) * x_max_dist / r;
603 for (int i=0; i<n; ++i) {
604 extrude_explicit(end_point, y(), e_dist/(2.f*n), x_speed * 60.f, false, false);
605 extrude_explicit(old_x, y(), e_dist/(2.f*n), x_speed * 60.f, false, false);
606 }
607 return *this;
608 }

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

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

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

◆ operator=()

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

References WipeTowerWriter2().

Here is the call graph for this function:

◆ pos()

const Vec2f & Slic3r::WipeTowerWriter2::pos ( ) const
inline
435{ return m_current_pos; }

References m_current_pos.

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

Here is the caller graph for this function:

◆ pos_rotated()

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

References m_current_pos, and rotate().

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

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

◆ ram()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::ram ( float x1,
float x2,
float dy,
float e0,
float e,
float f )
inline
627 {
628 extrude_explicit(x1, m_current_pos.y() + dy, e0, f, true, false);
629 extrude_explicit(x2, m_current_pos.y(), e, 0.f, true, false);
630 return *this;
631 }

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

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

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

◆ rectangle() [1/2]

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::rectangle ( const Vec2f & ld,
float width,
float height,
const float f = 0.f )
inline
526 {
527 Vec2f corners[4];
528 corners[0] = ld;
529 corners[1] = ld + Vec2f(width,0.f);
530 corners[2] = ld + Vec2f(width,height);
531 corners[3] = ld + Vec2f(0.f,height);
532 int index_of_closest = 0;
533 if (x()-ld.x() > ld.x()+width-x()) // closer to the right
534 index_of_closest = 1;
535 if (y()-ld.y() > ld.y()+height-y()) // closer to the top
536 index_of_closest = (index_of_closest==0 ? 3 : 2);
537
538 travel(corners[index_of_closest].x(), y()); // travel to the closest corner
539 travel(x(),corners[index_of_closest].y());
540
541 int i = index_of_closest;
542 do {
543 ++i;
544 if (i==4) i=0;
545 extrude(corners[i], f);
546 } while (i != index_of_closest);
547 return (*this);
548 }

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

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

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

◆ rectangle() [2/2]

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::rectangle ( const WipeTower::box_coordinates & box,
const float f = 0.f )
inline
551 {
552 rectangle(Vec2f(box.ld.x(), box.ld.y()),
553 box.ru.x() - box.lu.x(),
554 box.ru.y() - box.rd.y(), f);
555 return (*this);
556 }
WipeTowerWriter2 & rectangle(const Vec2f &ld, float width, float height, const float f=0.f)
Definition WipeTower2.cpp:525

References WipeTowerWriter2(), 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()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::reset_extruder ( )
inline
714 {
715 m_gcode += "G92 E0\n";
716 return *this;
717 }

References WipeTowerWriter2(), and m_gcode.

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

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

◆ resume_preview()

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

References WipeTowerWriter2(), and m_preview_suppressed.

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

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

◆ retract()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::retract ( float e,
float f = 0.f )
inline
572 { return load(-e, f); }
WipeTowerWriter2 & load(float e, float f=0.f)
Definition WipeTower2.cpp:558

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

Referenced by generate_path(), Slic3r::WipeTower2::toolchange_Unload(), and Slic3r::WipeTower2::toolchange_Wipe().

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

◆ rotate()

Vec2f Slic3r::WipeTowerWriter2::rotate ( Vec2f pt) const
inlineprivate
987 {
988 pt.x() -= m_wipe_tower_width / 2.f;
989 pt.y() += m_y_shift - m_wipe_tower_depth / 2.f;
990 double angle = m_internal_angle * float(M_PI/180.);
991 double c = cos(angle);
992 double s = sin(angle);
993 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);
994 }
float m_y_shift
Definition WipeTower2.cpp:945
float m_internal_angle
Definition WipeTower2.cpp:944
float m_wipe_tower_depth
Definition WipeTower2.cpp:947
float m_wipe_tower_width
Definition WipeTower2.cpp:946
double angle(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:138

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

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

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

◆ rotated()

const Vec2f Slic3r::WipeTowerWriter2::rotated ( const Vec2f & pt) const
inline
438{ return this->rotate(pt); }

References rotate().

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

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

◆ set_extruder_temp()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::set_extruder_temp ( int temperature,
bool wait = false,
const std::string & comment = std::string() )
inline
651 {
653 m_gcode += "M" + std::to_string(wait ? 109 : 104) + " S" + std::to_string(temperature);
654 if (!comment.empty())
655 m_gcode += " " + comment;
656 m_gcode += "\n";
657 return *this;
658 }
WipeTowerWriter2 & flush_planner_queue()
Definition WipeTower2.cpp:706
WipeTowerWriter2 & wait(float time)
Definition WipeTower2.cpp:661

References WipeTowerWriter2(), flush_planner_queue(), m_gcode, and wait().

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

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

◆ set_extruder_trimpot()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::set_extruder_trimpot ( int current)
inline
695 {
697 return *this;
699 m_gcode += "M906 E";
700 else
701 m_gcode += "M907 E";
702 m_gcode += std::to_string(current) + "\n";
703 return *this;
704 }

References WipeTowerWriter2(), Slic3r::gcfKlipper, Slic3r::gcfRepRapFirmware, Slic3r::gcfRepRapSprinter, m_gcode, and m_gcode_flavor.

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

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

◆ set_extrusion_flow()

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

References WipeTowerWriter2(), and m_extrusion_flow.

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

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

◆ set_fan()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::set_fan ( unsigned speed)
inline
727 {
728 if (speed == m_last_fan_speed)
729 return *this;
730 if (speed == 0)
731 m_gcode += "M107\n";
732 else
733 m_gcode += "M106 S" + std::to_string(unsigned(255.0 * speed / 100.0)) + "\n";
734 m_last_fan_speed = speed;
735 return *this;
736 }
unsigned m_last_fan_speed
Definition WipeTower2.cpp:948

References WipeTowerWriter2(), m_gcode, and m_last_fan_speed.

Here is the call graph for this function:

◆ set_format_E()

std::string Slic3r::WipeTowerWriter2::set_format_E ( float e)
inlineprivate
970 {
971 return " E" + Slic3r::float_to_string_decimal_point(e, 4);
972 }
std::string float_to_string_decimal_point(double value, int precision)
Definition LocalesUtils.cpp:108

References Slic3r::float_to_string_decimal_point().

Referenced by extrude_arc_explicit(), 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::WipeTowerWriter2::set_format_F ( float f)
inlineprivate
974 {
975 char buf[64];
976 sprintf(buf, " F%d", int(floor(f + 0.5f)));
978 return buf;
979 }

References Slic3r::f(), and m_current_feedrate.

Referenced by extrude_arc_explicit(), 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_I()

std::string Slic3r::WipeTowerWriter2::set_format_I ( float i)
inlineprivate
980{ return " I" + Slic3r::float_to_string_decimal_point(i, 3); }

References Slic3r::float_to_string_decimal_point().

Referenced by extrude_arc_explicit().

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

◆ set_format_J()

std::string Slic3r::WipeTowerWriter2::set_format_J ( float j)
inlineprivate
981{ return " J" + Slic3r::float_to_string_decimal_point(j, 3); }

References Slic3r::float_to_string_decimal_point().

Referenced by extrude_arc_explicit().

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

◆ set_format_X()

std::string Slic3r::WipeTowerWriter2::set_format_X ( float x)
inlineprivate
956 {
957 m_current_pos.x() = x;
959 }

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

Referenced by extrude_arc_explicit(), and extrude_explicit().

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

◆ set_format_Y()

std::string Slic3r::WipeTowerWriter2::set_format_Y ( float y)
inlineprivate
961 {
962 m_current_pos.y() = y;
964 }

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

Referenced by extrude_arc_explicit(), and extrude_explicit().

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

◆ set_format_Z()

std::string Slic3r::WipeTowerWriter2::set_format_Z ( float z)
inlineprivate
966 {
967 return " Z" + Slic3r::float_to_string_decimal_point(z, 3);
968 }

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()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::set_initial_position ( const Vec2f & pos,
float width = 0.f,
float depth = 0.f,
float internal_angle = 0.f )
inline
375 {
377 m_wipe_tower_depth = depth;
378 m_internal_angle = internal_angle;
379 m_start_pos = this->rotate(pos);
381 return *this;
382 }
Vec2f m_start_pos
Definition WipeTower2.cpp:932
const Vec2f & pos() const
Definition WipeTower2.cpp:435

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

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

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

◆ set_initial_tool()

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

References WipeTowerWriter2(), and m_current_tool.

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

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

◆ set_position()

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

References WipeTowerWriter2(), m_current_pos, and pos().

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

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

◆ set_tool()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::set_tool ( size_t tool)
inline
644 {
645 m_current_tool = tool;
646 return *this;
647 }

References WipeTowerWriter2(), and m_current_tool.

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

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

◆ set_y_shift()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::set_y_shift ( float shift)
inline
394 {
395 m_current_pos.y() -= shift-m_y_shift;
396 m_y_shift = shift;
397 return (*this);
398 }

References WipeTowerWriter2(), m_current_pos, and m_y_shift.

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

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

◆ set_z()

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

References WipeTowerWriter2(), and m_current_z.

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

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

◆ speed_override()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::speed_override ( int speed)
inline
671 {
672 m_gcode += "M220 S" + std::to_string(speed) + "\n";
673 return *this;
674 }

References WipeTowerWriter2(), and m_gcode.

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

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

◆ speed_override_backup()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::speed_override_backup ( )
inline
678 {
679 // This is only supported by Prusa at this point (https://github.com/prusa3d/PrusaSlicer/issues/3114)
681 m_gcode += "M220 B\n";
682 return *this;
683 }
@ gcfMarlinFirmware
Definition PrintConfig.hpp:56
@ gcfMarlinLegacy
Definition PrintConfig.hpp:52

References WipeTowerWriter2(), Slic3r::gcfMarlinFirmware, Slic3r::gcfMarlinLegacy, m_gcode, and m_gcode_flavor.

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

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

◆ speed_override_restore()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::speed_override_restore ( )
inline
687 {
689 m_gcode += "M220 R\n";
690 return *this;
691 }

References WipeTowerWriter2(), Slic3r::gcfMarlinFirmware, Slic3r::gcfMarlinLegacy, m_gcode, and m_gcode_flavor.

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

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

◆ spiral_flat_ironing()

void Slic3r::WipeTowerWriter2::spiral_flat_ironing ( const Vec2f & center,
float area,
float step_length,
float feedrate )
inline
757 {
758 float edge_length = std::sqrt(area);
759 Vec2f box_max = center + Vec2f{step_length, step_length};
760 Vec2f box_min = center - Vec2f{step_length, step_length};
761 int n = std::ceil(edge_length / step_length / 2.f);
762 if (n <= 0)
763 return;
764 while (n--) {
765 travel(box_max.x(), m_current_pos.y(), feedrate);
766 travel(m_current_pos.x(), box_max.y(), feedrate);
767 travel(box_min.x(), m_current_pos.y(), feedrate);
768 travel(m_current_pos.x(), box_min.y(), feedrate);
769
770 box_max += Vec2f{step_length, step_length};
771 box_min -= Vec2f{step_length, step_length};
772 }
773 }
static double edge_length(const VD::edge_type &edge)
Definition MultiMaterialSegmentation.cpp:1115
void center(ExPolygonsWithIds &e)
Definition Emboss.cpp:1382
double area(const ExPolygon &poly)
Definition ExPolygon.hpp:511

References Slic3r::area(), Slic3r::center(), Slic3r::edge_length(), feedrate(), m_current_pos, and travel().

Referenced by Slic3r::WipeTower2::toolchange_Wipe().

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

◆ start_pos_rotated()

const Vec2f Slic3r::WipeTowerWriter2::start_pos_rotated ( ) const
inline
436{ return m_start_pos; }

References m_start_pos.

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

Here is the caller graph for this function:

◆ suppress_preview()

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

References WipeTowerWriter2(), and m_preview_suppressed.

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

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

◆ switch_filament_monitoring()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::switch_filament_monitoring ( bool enable)
inline
410 {
412 m_gcode += enable ? "M591 R\n" : "M591 S0\n";
413 return *this;
414 }

References WipeTowerWriter2(), flush_planner_queue(), and m_gcode.

Referenced by Slic3r::WipeTower2::toolchange_Change(), and Slic3r::WipeTower2::toolchange_Unload().

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

◆ travel() [1/2]

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

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

Here is the call graph for this function:

◆ travel() [2/2]

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

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

Referenced by Slic3r::WipeTower2::finish_layer(), generate_path(), Slic3r::WipeTower2::generate_support_cone_wall(), Slic3r::WipeTower2::prime(), rectangle(), spiral_flat_ironing(), Slic3r::WipeTower2::tool_change(), Slic3r::WipeTower2::toolchange_Load(), Slic3r::WipeTower2::toolchange_Unload(), and Slic3r::WipeTower2::toolchange_Wipe().

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

◆ wait()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::wait ( float time)
inline
662 {
663 if (time==0.f)
664 return *this;
666 return *this;
667 }
std::string wait_command(GCodeFlavor flavor, float seconds)
Definition WipeTower.cpp:724

References WipeTowerWriter2(), m_gcode, m_gcode_flavor, and Slic3r::wait_command().

Referenced by set_extruder_temp(), and Slic3r::WipeTower2::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::WipeTowerWriter2::wipe_path ( ) const
inline
741 {
742 return m_wipe_path;
743 }

References m_wipe_path.

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

Here is the caller graph for this function:

◆ x()

◆ y()

◆ z_hop()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::z_hop ( float hop,
float f = 0.f )
inline
612 {
613 m_gcode += std::string("G1") + set_format_Z(m_current_z + hop);
614 if (f != 0 && f != m_current_feedrate)
616 m_gcode += "\n";
617 return *this;
618 }
std::string set_format_Z(float z)
Definition WipeTower2.cpp:966

References WipeTowerWriter2(), 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()

WipeTowerWriter2 & Slic3r::WipeTowerWriter2::z_hop_reset ( float f = 0.f)
inline
622 { return z_hop(0, f); }
WipeTowerWriter2 & z_hop(float hop, float f=0.f)
Definition WipeTower2.cpp:611

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

Here is the call graph for this function:

Member Data Documentation

◆ current_temp

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

◆ m_current_feedrate

float Slic3r::WipeTowerWriter2::m_current_feedrate
private

◆ m_current_pos

◆ m_current_tool

size_t Slic3r::WipeTowerWriter2::m_current_tool
private

◆ m_current_z

float Slic3r::WipeTowerWriter2::m_current_z
private

Referenced by WipeTowerWriter2(), set_z(), and z_hop().

◆ m_elapsed_time

float Slic3r::WipeTowerWriter2::m_elapsed_time
private

◆ m_enable_arc_fitting

bool Slic3r::WipeTowerWriter2::m_enable_arc_fitting = false
private

Referenced by generate_path().

◆ m_extrusion_flow

float Slic3r::WipeTowerWriter2::m_extrusion_flow
private

◆ m_extrusions

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

◆ m_filpar

const std::vector<WipeTower2::FilamentParameters>& Slic3r::WipeTowerWriter2::m_filpar
private

◆ m_gcode

◆ m_gcode_flavor

◆ m_internal_angle

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

Referenced by rotate(), and set_initial_position().

◆ m_last_fan_speed

unsigned Slic3r::WipeTowerWriter2::m_last_fan_speed = 0
private

Referenced by set_fan().

◆ m_layer_height

float Slic3r::WipeTowerWriter2::m_layer_height
private

◆ m_preview_suppressed

bool Slic3r::WipeTowerWriter2::m_preview_suppressed
private

◆ m_start_pos

Vec2f Slic3r::WipeTowerWriter2::m_start_pos
private

◆ m_used_filament_length

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

◆ m_wipe_path

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

Referenced by add_wipe_point(), and wipe_path().

◆ m_wipe_tower_depth

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

Referenced by rotate(), and set_initial_position().

◆ m_wipe_tower_width

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

Referenced by rotate(), and set_initial_position().

◆ m_y_shift

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

Referenced by rotate(), and set_y_shift().


The documentation for this class was generated from the following file:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/GCode/WipeTower2.cpp