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 <salt.wei@bambulab.com>
Change-Id: I9ba8388b85b978ae39caf2df04f96c704b5d2e05
This commit is contained in:
salt.wei 2022-10-11 22:12:58 +08:00 committed by Lane.Wei
parent 17076cc1bd
commit 54377760b9
2 changed files with 5 additions and 8 deletions

View file

@ -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.; const bool has_infill = this->region().config().sparse_infill_density.value > 0.;
//BBS //BBS
auto nozzle_diameter = this->region().nozzle_dmr_avg(this->layer()->object()->print()->config()); 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 // BBS
const PrintObjectConfig& object_config = this->layer()->object()->config(); const PrintObjectConfig& object_config = this->layer()->object()->config();
@ -224,7 +225,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly
break; break;
} }
// Grown by 3mm. // 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) { if (idx_island == -1) {
BOOST_LOG_TRIVIAL(trace) << "Bridge did not fall into the source region!"; BOOST_LOG_TRIVIAL(trace) << "Bridge did not fall into the source region!";
} else { } else {

View file

@ -70,12 +70,8 @@ static constexpr double SUPPORT_RESOLUTION = 0.05;
static constexpr double INSET_OVERLAP_TOLERANCE = 0.4; static constexpr double INSET_OVERLAP_TOLERANCE = 0.4;
// 3mm ring around the top / bottom / bridging areas. // 3mm ring around the top / bottom / bridging areas.
//FIXME This is quite a lot. //FIXME This is quite a lot.
// BBS: 3mm is too large and will cause overflow when printing object which likes shell. static constexpr double EXTERNAL_INFILL_MARGIN = 3;
// We decided to reduce this value according to superslicer. static constexpr double BRIDGE_INFILL_MARGIN = 1;
// 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;
//FIXME Better to use an inline function with an explicit return type. //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)); } //inline coord_t scale_(coordf_t v) { return coord_t(floor(v / SCALING_FACTOR + 0.5f)); }
#define scale_(val) ((val) / SCALING_FACTOR) #define scale_(val) ((val) / SCALING_FACTOR)