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 02:51:07 +0300
committersupermerill <merill@free.fr>2021-12-06 12:04:11 +0300
commit519e78abf3383c908f295498ca3d7fb7d3dbf1ac (patch)
tree94eed7bfea39eef1f43b1cbfa30b6fef00a0e5dd /src
parent769b5de64d84047e4e09307c90e791e038b0f7f9 (diff)
Apply 'small perimeter' slowdown at the right time, after 0 was replaced.
Also added some safeguards supermerill/SuperSlicer#1948
Diffstat (limited to 'src')
-rw-r--r--src/libslic3r/GCode.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp
index 7198c1d85..3a16f51ba 100644
--- a/src/libslic3r/GCode.cpp
+++ b/src/libslic3r/GCode.cpp
@@ -2959,14 +2959,17 @@ std::string GCode::extrude_loop_vase(const ExtrusionLoop &original_loop, const s
if (paths.empty()) return "";
// apply the small/external? perimeter speed
- if (speed == -1 && is_perimeter(paths.front().role()) && loop.length() <=
- scale_(this->m_config.small_perimeter_max_length.get_abs_value(EXTRUDER_CONFIG_WITH_DEFAULT(nozzle_diameter, 0)))) {
+ if (speed == -1 && is_perimeter(paths.front().role())){
coordf_t min_length = scale_d(this->m_config.small_perimeter_min_length.get_abs_value(EXTRUDER_CONFIG_WITH_DEFAULT(nozzle_diameter, 0)));
coordf_t max_length = scale_d(this->m_config.small_perimeter_max_length.get_abs_value(EXTRUDER_CONFIG_WITH_DEFAULT(nozzle_diameter, 0)));
- if (loop.length() <= min_length) {
- speed = m_config.small_perimeter_speed.get_abs_value(m_config.perimeter_speed);
- } else {
- speed = - (loop.length() - min_length) / (max_length - min_length);
+ max_length = std::max(min_length, max_length);
+ if (loop.length() < max_length) {
+ if (loop.length() <= min_length) {
+ speed = m_config.small_perimeter_speed.get_abs_value(m_config.perimeter_speed);
+ } else if (max_length > min_length) {
+ //use a negative speed: it will be use as a ratio when computing the real speed
+ speed = -(loop.length() - min_length) / (max_length - min_length);
+ }
}
}
@@ -3840,11 +3843,12 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &descri
double_t GCode::_compute_speed_mm_per_sec(const ExtrusionPath& path, double speed) {
+ float factor = 1;
// set speed
if (speed < 0) {
- //if speed == -1, then it's means "choose yourself, but if it's -1 < speed <0 , then it's a scaling from small_periemter.
+ //if speed == -1, then it's means "choose yourself, but if it's -1 < speed <0 , then it's a scaling from small_perimeter.
+ factor = float(-speed);
//it's a bit hacky, so if you want to rework it, help yourself.
- float factor = float(-speed);
if (path.role() == erPerimeter) {
speed = m_config.get_computed_value("perimeter_speed");
} else if (path.role() == erExternalPerimeter) {
@@ -3874,12 +3878,6 @@ double_t GCode::_compute_speed_mm_per_sec(const ExtrusionPath& path, double spee
} else {
throw Slic3r::InvalidArgument("Invalid speed");
}
- //don't modify bridge speed
- if (factor < 1 && !(is_bridge(path.role()))) {
- float small_speed = (float)m_config.small_perimeter_speed.get_abs_value(m_config.perimeter_speed);
- //apply factor between feature speed and small speed
- speed = (speed * factor) + double((1.f - factor) * small_speed);
- }
}
if (m_volumetric_speed != 0. && speed == 0) {
//if m_volumetric_speed, use the max size for thinwall & gapfill, to avoid variations
@@ -3904,6 +3902,14 @@ double_t GCode::_compute_speed_mm_per_sec(const ExtrusionPath& path, double spee
}
if (speed == 0) // this code shouldn't trigger as if it's 0, you have to get a m_volumetric_speed
speed = m_config.max_print_speed.value;
+ // Apply small perimeter 'modifier
+ // don't modify bridge speed
+ if (factor < 1 && !(is_bridge(path.role()))) {
+ float small_speed = (float)m_config.small_perimeter_speed.get_abs_value(m_config.perimeter_speed);
+ //apply factor between feature speed and small speed
+ speed = (speed * factor) + double((1.f - factor) * small_speed);
+ }
+ // Apply first layer modifier
if (this->on_first_layer()) {
const double base_speed = speed;
if (path.role() == erInternalInfill || path.role() == erSolidInfill) {