Skip to content

Bed splitting can leave pieces longer than the bed #262

Open

Description

@jasonmadigan

_split_along_axis in backend/app/services/stl_generator_manifold.py takes the cut positions in ascending order, but keeps the positive side of each split_by_plane cut as a finished piece and carries on cutting the negative side. Every later cut lies beyond that remainder, so an axis that needs three or more pieces is cut once and one of its two pieces is still longer than the bed. That is any side longer than 2 × floor(bed / 21) × 21 mm: 504 mm on a 256 mm bed, 336 mm on 180, 294 mm on 150.

Separately, when a partial bin's enabled cells form separate bodies, export_split_parts returns those bodies from export_separated_parts as they are and never cuts them to the bed. The contrast insert is not cut at all: a split bin's ZIP holds the cut parts and the whole insert.

Reproduction

  1. Make a 13×1 bin (546 mm) with one tool in it: Auto-size grid off, Bed Size 256 mm.
  2. Generate it. POST /api/bins/{id}/generate returns split_count: 2, so the sidebar shows "Split into 2 pieces" and the menu "ZIP (2 parts)". The ZIP holds 356.75 × 41.5 mm and 188.75 × 41.5 mm.
  3. Turn on Partial Bins, switch off the third cell and leave Connect base off. The ZIP holds the two separated bodies, 83.75 mm and 419.75 mm long.
  4. Make a 25×1 bin with Partial Bins on, the left 12 cells off and Connect base off. The remaining 13 cells are one body, so export_split_parts falls through to split_bin, whose first cut, 315 mm left of the bin centre, has the whole body on its positive side. The export is one 545.75 mm part, split_count: 1, with no banner.
  5. Make a 2×9 bin, Bed Size 256 mm, with a 340 × 20 mm outline along its depth and Contrast Insert on. The bin is cut into two 188.75 mm pieces, and the insert is one 341.6 mm piece.

Exported parts with Partial Bins off:

Bin Bed Pieces needed Exported
12×1 256 2 251.75 + 251.75 mm
13×1 256 3 356.75 + 188.75 mm
25×1 256 5 839.75 + 209.75 mm
13×7 256 6 4 pieces, two of them 356.75 × 146.75 mm
8.5×2 180 3 230.75 + 125.75 mm
7.5×1 150 3 209.75 + 104.75 mm

Expected

Every exported piece fits the bed, including the separated bodies of a partial bin and the insert. A 13×1 bin on a 256 mm bed gives three pieces of at most 189 mm.

Notes

  • With _split_along_axis patched in memory to keep the negative side of each cut and cut the positive remainder, the rows above export 2, 3, 5, 6, 3 and 3 pieces with longest sides of 251.75, 189, 210, 189, 126 and 105 mm, and step 4 gives three pieces. Step 3 also needs export_split_parts to cut each separated body to the bed.
  • test_split_half_unit_bin in backend/tests/test_half_grid.py (5.5×2 on a 100 mm bed) passes with a 146.75 mm piece, because it only asserts len(parts) >= 2.
  • In step 4 the generate response still has a zip_url, so the menu offers "Full STL" and "ZIP (1 parts)" for a ZIP holding the one 545.75 mm STL. The menu wording is covered in Bin editor messages disagree with the export #271.

Seen on main at a73e0e6 (0.11.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingscope:in-scopeFits the product constitution; eligible for prioritisation, not promised

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions