mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-26 06:14:23 +08:00
fix: When removing too thin bridge, use it as solid instead of sparse.
supermerill/SuperSlicer#1766 supermerill/SuperSlicer#1781
This commit is contained in:
parent
703e26bc6d
commit
1822af7854
@ -241,22 +241,57 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly
|
||||
break;
|
||||
}
|
||||
// Grown by bridged_infill_margin.
|
||||
// also, remove all bridge area that are thinner than a single line.
|
||||
Polygons polys = offset2(to_polygons(bridges[i].expolygon),
|
||||
(-this->flow(frInfill).scaled_width() / 2),
|
||||
(this->flow(frInfill).scaled_width() / 2) + float(margin_bridged),
|
||||
EXTERNAL_SURFACES_OFFSET_PARAMETERS);
|
||||
Polygons polys;
|
||||
if (idx_island == -1) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "Bridge did not fall into the source region!";
|
||||
} else {
|
||||
// also, remove all bridge area that are thinner than a single line.
|
||||
ExPolygons expoly_collapsed = offset2_ex(bridges[i].expolygon,
|
||||
(-this->flow(frInfill).scaled_width() / 2),
|
||||
(this->flow(frInfill).scaled_width() / 2) + SCALED_EPSILON,
|
||||
EXTERNAL_SURFACES_OFFSET_PARAMETERS);
|
||||
//check if there is something cut
|
||||
ExPolygons cut = diff_ex({ bridges[i].expolygon }, expoly_collapsed, true);
|
||||
double area_cut = 0; for (ExPolygon& c : cut) area_cut += c.area();
|
||||
if (area_cut > (this->flow(frInfill).scaled_width() * this->flow(frInfill).scaled_width())) {
|
||||
//if area not negligible, we will consider it.
|
||||
// compute the bridge area, if any.
|
||||
ExPolygons ex_polys = offset_ex(expoly_collapsed, float(margin_bridged), EXTERNAL_SURFACES_OFFSET_PARAMETERS);
|
||||
polys = to_polygons(ex_polys);
|
||||
//add the cut section as solid infill
|
||||
Surface srf_bottom = bridges[i];
|
||||
srf_bottom.surface_type = stPosBottom | stDensSolid;
|
||||
// clip it to the infill area and remove the bridge part.
|
||||
surfaces_append(
|
||||
bottom,
|
||||
diff_ex(
|
||||
intersection_ex(
|
||||
ExPolygons{ fill_boundaries_ex[idx_island] },
|
||||
offset_ex(cut, double(margin), EXTERNAL_SURFACES_OFFSET_PARAMETERS)
|
||||
),
|
||||
ex_polys),
|
||||
srf_bottom);
|
||||
} else {
|
||||
//negligible, don't offset2
|
||||
polys = offset(to_polygons(bridges[i].expolygon), float(margin_bridged), EXTERNAL_SURFACES_OFFSET_PARAMETERS);
|
||||
}
|
||||
// Found an island, to which this bridge region belongs. Trim it,
|
||||
polys = intersection(polys, to_polygons(fill_boundaries_ex[idx_island]));
|
||||
}
|
||||
//keep bridges & bridge_bboxes & bridges_grown the SAME SIZE
|
||||
if (!polys.empty()) {
|
||||
bridge_bboxes.push_back(get_extents(polys));
|
||||
bridges_grown.push_back(std::move(polys));
|
||||
} else {
|
||||
bridges.erase(bridges.begin() + i);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (bridges.empty())
|
||||
{
|
||||
fill_boundaries = union_(fill_boundaries, true);
|
||||
} else {
|
||||
// 2) Group the bridge surfaces by overlaps.
|
||||
std::vector<size_t> bridge_group(bridges.size(), (size_t)-1);
|
||||
size_t n_groups = 0;
|
||||
@ -348,6 +383,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Surfaces new_surfaces;
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user