ENH: filter small gap

thanks SoftFever

Signed-off-by: qing.zhang <qing.zhang@bambulab.com>
Change-Id: I9bffe629419455b2a7b4494aa595b711619939da
This commit is contained in:
qing.zhang 2023-06-16 12:05:56 +08:00 committed by Lane.Wei
parent 346321379a
commit 739d8c9b28
12 changed files with 25 additions and 5 deletions

View file

@ -479,6 +479,7 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:
if (surface_fill.params.pattern == ipGrid)
params.can_reverse = false;
LayerRegion* layerm = this->m_regions[surface_fill.region_id];
params.filter_out_gap_fill = layerm->region().config().filter_out_gap_fill.value;
for (ExPolygon& expoly : surface_fill.expolygons) {
f->no_overlap_expolygons = intersection_ex(surface_fill.no_overlap_expolygons, ExPolygons() = {expoly}, ApplySafetyOffset::Yes);
// Spacing is modified by the filler to indicate adjustments. Reset it for each expolygon.

View file

@ -40,7 +40,7 @@ struct FillParams
bool full_infill() const { return density > 0.9999f; }
// Don't connect the fill lines around the inner perimeter.
bool dont_connect() const { return anchor_length_max < 0.05f; }
double filter_out_gap_fill { 0.0 };
// Fill density, fraction in <0, 1>
float density { 0.f };

View file

@ -3174,6 +3174,11 @@ void FillMonotonicLineWGapFill::fill_surface_extrusion(const Surface* surface, c
if (!polylines.empty() && !is_bridge(params.extrusion_role)) {
ExtrusionEntityCollection gap_fill;
// SoftFever: filter out tiny gap fills
polylines.erase(std::remove_if(polylines.begin(), polylines.end(), [&](const ThickPolyline &p) {
return p.length() < scale_(params.filter_out_gap_fill);
}), polylines.end());
variable_width(polylines, erGapFill, params.flow, gap_fill.entities);
coll_nosort->append(std::move(gap_fill.entities));
}