From 54e86b7307b6571edc165246d09e09dc7717d5b8 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Fri, 5 Jan 2018 20:02:54 -0600 Subject: [PATCH] Reduce bounds on auto width again (the math likes to go very wide which is not feasible if your nozzle isn't really big). Should address #4212 --- xs/src/libslic3r/Flow.cpp | 10 +++++----- xs/src/libslic3r/Flow.hpp | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/xs/src/libslic3r/Flow.cpp b/xs/src/libslic3r/Flow.cpp index cc87ec0bb..c3346e82b 100644 --- a/xs/src/libslic3r/Flow.cpp +++ b/xs/src/libslic3r/Flow.cpp @@ -90,18 +90,18 @@ Flow::_bridge_width(float nozzle_diameter, float bridge_flow_ratio) { /* This static method returns a sane extrusion width default. */ float -Flow::_auto_width(FlowRole role, float nozzle_diameter, float height) { +Flow::_auto_width(FlowRole role, float nozzle_diameter, float height) const { // here we calculate a sane default by matching the flow speed (at the nozzle) and the feed rate // shape: rectangle with semicircles at the ends float width = ((nozzle_diameter*nozzle_diameter) * PI + (height*height) * (4.0 - PI)) / (4.0 * height); float min = nozzle_diameter * 1.05; - float max = nozzle_diameter * 3; // cap width to 3x nozzle diameter + float max = nozzle_diameter * 1.25; // cap width to 1.25x nozzle diameter if (role == frExternalPerimeter || role == frSupportMaterial || role == frSupportMaterialInterface) { - min = max = nozzle_diameter; + min = max = nozzle_diameter*1.1; } else if (role != frInfill) { - // do not limit width for sparse infill so that we use full native flow for it - max = nozzle_diameter * 1.7; + // limit width a bit for sparse infill to avoid unwanted overextrusion. + max = nozzle_diameter * 1.4; } if (width > max) width = max; if (width < min) width = min; diff --git a/xs/src/libslic3r/Flow.hpp b/xs/src/libslic3r/Flow.hpp index 5f2467d54..85fa5be85 100644 --- a/xs/src/libslic3r/Flow.hpp +++ b/xs/src/libslic3r/Flow.hpp @@ -69,7 +69,8 @@ class Flow static float _bridge_width(float nozzle_diameter, float bridge_flow_ratio); /// Calculate a relatively sane extrusion width, based on height and nozzle diameter. /// Algorithm used does not play nice with layer heights < 0.1mm. - static float _auto_width(FlowRole role, float nozzle_diameter, float height); + /// To avoid extra headaches, min and max are capped at 105% and 125% of nozzle diameter. + static float _auto_width(FlowRole role, float nozzle_diameter, float height) const; static float _width_from_spacing(float spacing, float nozzle_diameter, float height, bool bridge); };