Plate 2d nesting - #720
Open
nbbosco wants to merge 17 commits into
Open
Conversation
…ract methods and `PlateNester` for 2D nesting optimization
…into plate_2d_nesting
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #720 +/- ##
==========================================
+ Coverage 80.38% 80.60% +0.22%
==========================================
Files 79 79
Lines 11250 11691 +441
==========================================
+ Hits 9043 9424 +381
- Misses 2207 2267 +60 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
nbbosco
marked this pull request as ready for review
March 20, 2026 11:14
nbbosco
marked this pull request as draft
March 20, 2026 12:29
…into plate_2d_nesting
…into plate_2d_nesting
…into plate_2d_nesting
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces 2D sheet nesting for Plate elements via a new PlateNester, expanding the existing nesting framework (previously beam-focused) to support plate stock packing and richer nesting result reporting.
Changes:
- Added
PlateNesterwith skyline-based (fast) and bottom-left-style (non-fast) placement strategies, including deterministic vs seeded ordering and 0/90° orientation trials. - Extended
PlateStockandNestingResultto support plate nesting state, unplaced-element reporting, and per-stock utilization/report payloads. - Added a comprehensive plate nesting test suite and exported
PlateNesterfromcompas_timber.planning.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
src/compas_timber/planning/nesting.py |
Adds PlateNester, extends PlateStock for 2D nesting, and augments NestingResult with reporting/utilization metadata. |
tests/compas_timber/test_nesting.py |
Adds tests validating plate nesting placement bounds, overlap avoidance, spacing, determinism, seeded ordering, and reporting. |
src/compas_timber/planning/__init__.py |
Exposes PlateNester at the planning package level. |
CHANGELOG.md |
Adds changelog notes for the new plate nesting feature and reporting changes. |
10 tasks
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.
PlateNesteris a 2D packing class that takes the plates and tries to place them on sheet stock with as little waste as possible, while keeping placements valid for fabrication.Continuing @papachap base work I implemented the following workflow:
Filters and groups plates:
It decides which stock each plate is compatible with (mainly by thickness), and optionally nests per model group (NOTE: Currently is based on the blank bounding box of the plate shape, maybe this could be improved using the edges of the shape?)..
Orders plates for placement:
It places larger/more critical plates first (deterministic order), or uses a reproducible shuffled order when a seed is given (NOTE: Seeds are useful to give the user nesting options and keep track of them).
Tries both orientations:
For each plate, it tests normal and 90° rotated layouts (NOTE: More angle rotation can take more process time but maybe could also be added as an optional input).
Chooses a placement strategy:
Validates geometry before committing:
Even if a candidate looks good by bounding logic, it still checks polygon fit to avoid overlaps/out-of-bounds placements.
Updates stock state:
When a plate is placed, it updates:
It returns a NestingResult with:
Basically:
Sort plates → pick a stock → find best valid spot (with rotation options) → place → update sheet profile → repeat → report leftovers.
What type of change is this?
Checklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.CHANGELOG.mdfile in theUnreleasedsection under the most fitting heading (e.g.Added,Changed,Removed).invoke test).invoke lint).compas_timber.datastructures.Beam.class_diagrams.rst(if appropriate).