Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsupermerill <merill@free.fr>2021-12-04 04:05:31 +0300
committersupermerill <merill@free.fr>2021-12-07 17:05:14 +0300
commit0bf2bed2bc7f62d53e57739057a828267914b1d1 (patch)
tree8fbee14ab8f2d6a8378163882cf6d5ab10bd64e5 /src
parent519e78abf3383c908f295498ca3d7fb7d3dbf1ac (diff)
avoid unneeded unretract followed by a retract in mid-air for sparse wipe tower.
supermerill/SuperSlicer#1467
Diffstat (limited to 'src')
-rw-r--r--src/libslic3r/GCode.cpp15
-rw-r--r--src/libslic3r/GCodeWriter.hpp1
2 files changed, 11 insertions, 5 deletions
diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp
index 3a16f51ba..acdc5d731 100644
--- a/src/libslic3r/GCode.cpp
+++ b/src/libslic3r/GCode.cpp
@@ -288,6 +288,7 @@ static inline void set_extra_lift(const float previous_print_z, const int layer_
gcodegen.m_gcode_label_objects_end = "";
}
+ bool need_unretract = false;
if (! tcr.priming) {
// Move over the wipe tower.
// Retract for a tool change, using the toolchange retract value and setting the priming extra length.
@@ -298,17 +299,21 @@ static inline void set_extra_lift(const float previous_print_z, const int layer_
wipe_tower_point_to_object_point(gcodegen, start_pos),
erMixed);
gcodegen.write_travel_to(gcode, polyline, "Travel to a Wipe Tower");
- gcode += gcodegen.unretract();
+ need_unretract = true;
}
- double current_z = gcodegen.writer().get_position().z();
+ double current_z = gcodegen.writer().get_unlifted_position().z();
if (z == -1.) // in case no specific z was provided, print at current_z pos
z = current_z;
if (! is_approx(z, current_z)) {
- gcode += gcodegen.writer().retract();
+ if (!need_unretract)
+ gcode += gcodegen.writer().retract();
gcode += gcodegen.writer().travel_to_z(z, "Travel down to the last wipe tower layer.");
- gcode += gcodegen.writer().unretract();
+ need_unretract = true;
}
+ // only unretract when travel is finished
+ if(need_unretract)
+ gcode += gcodegen.unretract();
// Process the end filament gcode.
@@ -374,7 +379,7 @@ static inline void set_extra_lift(const float previous_print_z, const int layer_
if (!is_approx(z, current_z)) {
gcode += gcodegen.writer().retract();
gcode += gcodegen.writer().travel_to_z(current_z, "Travel back up to the topmost object layer.");
- gcode += gcodegen.writer().unretract();
+ //gcode += gcodegen.writer().unretract(); //why? it's done automatically later, where needed!
} else {
// Prepare a future wipe.
gcodegen.m_wipe.reset_path();
diff --git a/src/libslic3r/GCodeWriter.hpp b/src/libslic3r/GCodeWriter.hpp
index f74eec403..fa4b1de0c 100644
--- a/src/libslic3r/GCodeWriter.hpp
+++ b/src/libslic3r/GCodeWriter.hpp
@@ -78,6 +78,7 @@ public:
std::string lift(int layer_id);
std::string unlift();
Vec3d get_position() const { return m_pos; }
+ Vec3d get_unlifted_position() const { return m_pos - Vec3d{0, 0, m_extra_lift + m_lifted}; }
private:
// Extruders are sorted by their ID, so that binary search is possible.