From 54377760b903ed66417f3306262aaa9122236c8b Mon Sep 17 00:00:00 2001 From: "salt.wei" Date: Tue, 11 Oct 2022 22:12:58 +0800 Subject: [PATCH] ENH: use different margin for top/bottom and bottom bridge Too large margin for bridge will cause overflow for shell model. But too small margin for top/bottom will cause infill area discontinuous. Using different margin for top/bottom and bridge to make a balance. Signed-off-by: salt.wei Change-Id: I9ba8388b85b978ae39caf2df04f96c704b5d2e05 --- src/libslic3r/LayerRegion.cpp | 5 +++-- src/libslic3r/libslic3r.h | 8 ++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/LayerRegion.cpp b/src/libslic3r/LayerRegion.cpp index 608d52083..d67468082 100644 --- a/src/libslic3r/LayerRegion.cpp +++ b/src/libslic3r/LayerRegion.cpp @@ -118,7 +118,8 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly const bool has_infill = this->region().config().sparse_infill_density.value > 0.; //BBS auto nozzle_diameter = this->region().nozzle_dmr_avg(this->layer()->object()->print()->config()); - const float margin = std::min(float(scale_(EXTERNAL_INFILL_MARGIN)), float(scale_(nozzle_diameter * EXTERNAL_INFILL_MARGIN / 0.4))); + const float margin = float(scale_(EXTERNAL_INFILL_MARGIN)); + const float bridge_margin = std::min(float(scale_(BRIDGE_INFILL_MARGIN)), float(scale_(nozzle_diameter * BRIDGE_INFILL_MARGIN / 0.4))); // BBS const PrintObjectConfig& object_config = this->layer()->object()->config(); @@ -224,7 +225,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly break; } // Grown by 3mm. - Polygons polys = offset(bridges[i].expolygon, margin, EXTERNAL_SURFACES_OFFSET_PARAMETERS); + Polygons polys = offset(bridges[i].expolygon, bridge_margin, EXTERNAL_SURFACES_OFFSET_PARAMETERS); if (idx_island == -1) { BOOST_LOG_TRIVIAL(trace) << "Bridge did not fall into the source region!"; } else { diff --git a/src/libslic3r/libslic3r.h b/src/libslic3r/libslic3r.h index 019a5f877..3a5e539bc 100644 --- a/src/libslic3r/libslic3r.h +++ b/src/libslic3r/libslic3r.h @@ -70,12 +70,8 @@ static constexpr double SUPPORT_RESOLUTION = 0.05; static constexpr double INSET_OVERLAP_TOLERANCE = 0.4; // 3mm ring around the top / bottom / bridging areas. //FIXME This is quite a lot. -// BBS: 3mm is too large and will cause overflow when printing object which likes shell. -// We decided to reduce this value according to superslicer. -// The right way is that area should not be enlarged. But should find arched point at last layer, expecially for -// bridge area. -//static constexpr double EXTERNAL_INFILL_MARGIN = 3; -static constexpr double EXTERNAL_INFILL_MARGIN = 1; +static constexpr double EXTERNAL_INFILL_MARGIN = 3; +static constexpr double BRIDGE_INFILL_MARGIN = 1; //FIXME Better to use an inline function with an explicit return type. //inline coord_t scale_(coordf_t v) { return coord_t(floor(v / SCALING_FACTOR + 0.5f)); } #define scale_(val) ((val) / SCALING_FACTOR)