Skip to content

Commit 34e49a4

Browse files
Feature: Retract amount after wipe
A new setting added - `Retract amount after wipe`. It controls the length of fast retraction after wipe, relative to retraction length. The value will be clamped by 100% minus the retract amount before the wipe value.
1 parent 3e321a1 commit 34e49a4

File tree

10 files changed

+758
-3126
lines changed

10 files changed

+758
-3126
lines changed

src/libslic3r/Extruder.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,13 @@ double Extruder::filament_flow_ratio() const
168168
// Return a "retract_before_wipe" percentage as a factor clamped to <0, 1>
169169
double Extruder::retract_before_wipe() const
170170
{
171-
return std::min(1., std::max(0., m_config->retract_before_wipe.get_at(m_id) * 0.01));
171+
return std::clamp(m_config->retract_before_wipe.get_at(m_id) * 0.01, 0., 1.);
172+
}
173+
174+
// Return a "retract_after_wipe" percentage as a factor clamped to <0, 1>
175+
double Extruder::retract_after_wipe() const
176+
{
177+
return std::min(std::clamp(m_config->retract_after_wipe.get_at(m_id) * 0.01, 0., 1.), 1. - retract_before_wipe());
172178
}
173179

174180
double Extruder::retraction_length() const

src/libslic3r/Extruder.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class Extruder
6363
double filament_cost() const;
6464
double filament_flow_ratio() const;
6565
double retract_before_wipe() const;
66+
double retract_after_wipe() const;
6667
double retraction_length() const;
6768
double retract_lift() const;
6869
int retract_speed() const;

src/libslic3r/GCode.cpp

Lines changed: 524 additions & 1184 deletions
Large diffs are not rendered by default.

src/libslic3r/GCode.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ class Wipe {
6060
public:
6161
bool enable;
6262
Polyline path;
63+
6364
struct RetractionValues{
64-
double retractLengthBeforeWipe;
65-
double retractLengthDuringWipe;
65+
double retraction_length_before_wipe = 0.;
66+
double retraction_length_during_wipe = 0.;
67+
double retraction_length_after_wipe = 0.;
6668
};
6769

6870
Wipe() : enable(false) {}

src/libslic3r/Preset.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ static std::vector<std::string> s_Preset_filament_options {/*"filament_colour",
964964
"activate_air_filtration","during_print_exhaust_fan_speed","complete_print_exhaust_fan_speed",
965965
// Retract overrides
966966
"filament_retraction_length", "filament_z_hop", "filament_z_hop_types", "filament_retract_lift_above", "filament_retract_lift_below", "filament_retract_lift_enforce", "filament_retraction_speed", "filament_deretraction_speed", "filament_retract_restart_extra", "filament_retraction_minimum_travel",
967-
"filament_retract_when_changing_layer", "filament_wipe", "filament_retract_before_wipe",
967+
"filament_retract_when_changing_layer", "filament_wipe", "filament_retract_before_wipe", "filament_retract_after_wipe",
968968
// Profile compatibility
969969
"filament_vendor", "compatible_prints", "compatible_prints_condition", "compatible_printers", "compatible_printers_condition", "inherits",
970970
//BBS

src/libslic3r/Print.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
172172
"filename_format",
173173
"retraction_minimum_travel",
174174
"retract_before_wipe",
175+
"retract_after_wipe",
175176
"retract_when_changing_layer",
176177
"retraction_length",
177178
"retract_length_toolchange",

0 commit comments

Comments
 (0)