Skip to content

Commit

Permalink
Don't use bridge flow over dense infill
Browse files Browse the repository at this point in the history
  • Loading branch information
jschuh committed Apr 12, 2024
1 parent dba0377 commit f97da07
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
18 changes: 18 additions & 0 deletions src/libslic3r/LayerRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1006,5 +1006,23 @@ void LayerRegion::export_region_fill_surfaces_to_svg_debug(const char *name) con
this->export_region_fill_surfaces_to_svg(debug_out_path("LayerRegion-fill_surfaces-%s-%d.svg", name, idx ++).c_str());
}


bool LayerRegion::needs_bridge_over_infill() const
{
// Minimum width of voids in sparse infill for the layer above to be treated as a bridge.
// Scaled based on layer height, with a 3mm void at 0.2mm layer height as the baseline.
const float min_void_width = bridging_flow(frSolidInfill, true).scaled_width() * 3.f * m_layer->height / 0.2;

const float fill_density = region().config().fill_density.value / 100.0;
if (fill_density > 0.0) {
// Estimate the infill void width from infill density and extrusion width.
const float infill_extrusion_width = flow(frInfill).scaled_width();
if (min_void_width > (infill_extrusion_width / fill_density - infill_extrusion_width))
return false;
}

return true;
}

}

3 changes: 3 additions & 0 deletions src/libslic3r/LayerRegion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ class LayerRegion

// Is there any valid extrusion assigned to this LayerRegion?
bool has_extrusions() const { return ! this->perimeters().empty() || ! this->fills().empty(); }
// True if infill is sparse enough that it requires bridge flow above, false if infill is
// dense enough to support normal solid infill layer above.
bool needs_bridge_over_infill() const;

protected:
friend class Layer;
Expand Down
6 changes: 3 additions & 3 deletions src/libslic3r/PrintObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2499,7 +2499,7 @@ void PrintObject::bridge_over_infill()
for (const Surface *surface : internal_solids) {
if (cs.original_surface == surface) {
Surface tmp{*surface, {}};
tmp.surface_type = stInternalBridge;
tmp.surface_type = region->needs_bridge_over_infill() ? stInternalBridge : stInternalSolid;
tmp.bridge_angle = cs.bridge_angle;
for (const ExPolygon &ep : union_ex(cs.new_polys)) {
new_surfaces.emplace_back(tmp, ep);
Expand Down Expand Up @@ -2817,8 +2817,8 @@ void PrintObject::discover_horizontal_shells()
if (region_config.solid_infill_every_layers.value > 0 && region_config.fill_density.value > 0 &&
(i % region_config.solid_infill_every_layers) == 0) {
// Insert a solid internal layer. Mark stInternal surfaces as stInternalSolid or stInternalBridge.
SurfaceType type = (region_config.fill_density == 100 || region_config.solid_infill_every_layers == 1) ? stInternalSolid :
stInternalBridge;
SurfaceType type = (!layerm->needs_bridge_over_infill() || region_config.solid_infill_every_layers == 1) ? stInternalSolid :
stInternalBridge;
for (Surface &surface : layerm->m_fill_surfaces.surfaces)
if (surface.surface_type == stInternal)
surface.surface_type = type;
Expand Down

0 comments on commit f97da07

Please sign in to comment.