Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use bridge flow over dense infill #4374

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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