Fix missing infill layers (fill_surface_by_multilines & fill_surface_trapezoidal bug fix)#12516
Merged
ianalexis merged 5 commits intoFeb 28, 2026
Conversation
This reverts commit 0de21ad.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes missing rectilinear infill in cases where contracting the surface by half line width splits the original ExPolygon into multiple polygons, by keeping the contracted geometry as ExPolygons and using overloads that accept multi-polygons.
Changes:
- Preserve the contracted result as
ExPolygons(instead of taking only.front()), and intersect infill lines against all resulting polygons. - Update the
connect_infillcall-site to work with the multi-polygon boundary representation. - Minor formatting/whitespace cleanup in the affected block.
Comments suppressed due to low confidence (3)
src/libslic3r/Fill/FillRectilinear.cpp:3027
contracted/intersection_surfaceare both declaredconstandintersection_surfaceis initialized via the ternary, which forces an extra copy of theExPolygonsin the non-empty case. Consider keepingcontractednon-const and moving it intointersection_surface(or assigning into a singleExPolygonsvariable) to avoid copying potentially large polygons in this hot path.
const ExPolygons contracted = offset_ex(surface->expolygon, -float(scale_(0.5 * this->spacing)));
// if contraction results in empty ExPolygons, use original surface
const ExPolygons intersection_surface = contracted.empty() ? ExPolygons{surface->expolygon} : contracted;
src/libslic3r/Fill/FillRectilinear.cpp:3042
connect_infill(..., to_polygons(intersection_surface), ...)materializes a fullPolygonscopy (including all points) just to immediately take pointers insideFill::connect_infill. Since there is already an overload takingstd::vector<const Polygon*>, consider usingto_polygon_ptrs(intersection_surface)and calling the pointer-based overload to avoid copying large geometry.
connect_infill(std::move(fill_lines), to_polygons(intersection_surface), get_extents(surface->expolygon.contour), polylines_out,
this->spacing, params);
src/libslic3r/Fill/FillRectilinear.cpp:3031
- This change fixes a regression where contracting by half line width can split the surface into multiple polygons, but there doesn’t appear to be a unit/regression test covering the multi-island contraction case for rectilinear/multiline infill. Please add a test (e.g., in
tests/fff_print/test_fill.cpp) that constructs an ExPolygon which splits afteroffset_ex(-0.5*spacing)and asserts infill is produced in all resulting islands.
const ExPolygons contracted = offset_ex(surface->expolygon, -float(scale_(0.5 * this->spacing)));
// if contraction results in empty ExPolygons, use original surface
const ExPolygons intersection_surface = contracted.empty() ? ExPolygons{surface->expolygon} : contracted;
// Intersect polylines with perimeter
fill_lines = intersection_pl(std::move(fill_lines), intersection_surface);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
Nice fix, thanks! |
dbaarda
pushed a commit
to dbaarda/OrcaSlicer
that referenced
this pull request
Mar 3, 2026
* upstream/main: (34 commits) Fix Bambu LAN printing with legacy network plugin (OrcaSlicer#12582) WIP: Parallelize macOS CI builds by splitting arm64 and x86_64 into separate jobs (OrcaSlicer#12562) VOLUMIC profils updates (OrcaSlicer#12565) Fix wiki redirection (OrcaSlicer#12569) Fix Celsius symbol not showing on G-code viewer (OrcaSlicer#12567) Revert "Revert "Set NSWindow color space to sRGB on macOS"" (OrcaSlicer#12546) Improve and complement the pt-BR translation (OrcaSlicer#12550) fix build errors on Linux with Clang 20 and GTK warnings (OrcaSlicer#12507) Fix "Glidlines" "gridlines locale (OrcaSlicer#12529) fix: typo "Glidlines" → "Gridlines" in View menu tooltip (OrcaSlicer#12527) Fix missing infill layers (fill_surface_by_multilines & fill_surface_trapezoidal bug fix) (OrcaSlicer#12516) fix missing translations for Canvas Toolbar Menu update profile version update locale Add option for hiding / showing gridlines (OrcaSlicer#10545) update locale and Simplified/Tranditional Chinese translation Enhancement: Enabling base patterns (infill) for Organic supports (OrcaSlicer#12141) I18n: Preview translations minor fix (Ukrainian) (OrcaSlicer#12504) update locale Fix: Init Serialized options (OrcaSlicer#12489) ...
Xipit
pushed a commit
to Xipit/OrcaSlicer
that referenced
this pull request
Mar 16, 2026
…trapezoidal bug fix) (OrcaSlicer#12516) * FillRectilinear bugfix * cleaning * Revert "cleaning" This reverts commit 0de21ad. * Filltrapezoidal is OK * Filltrapezoidal fix 2
davidjdixon
pushed a commit
to davidjdixon/OrcaSlicer
that referenced
this pull request
Mar 21, 2026
…trapezoidal bug fix) (OrcaSlicer#12516) * FillRectilinear bugfix * cleaning * Revert "cleaning" This reverts commit 0de21ad. * Filltrapezoidal is OK * Filltrapezoidal fix 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem
When generating rectilinear infill, the surface is contracted by half the line width to avoid excessive overlap with perimeters. This contraction can cause the original ExPolygon to split into multiple separate Polygons. The previous code incorrectly handled this case by:
OrcaSlicer/src/libslic3r/Fill/FillRectilinear.cpp
Lines 3026 to 3027 in 5c07cb5
This returns only the first polygon of the vector, which is why some sectors are left without infill lines.
I used the overloads that accept ExPolygons as an argument to avoid this problem.
Before:
After:
Fix #12510