Thread plate numbers through bill of materials and filenames#17
Open
jaysi1001 wants to merge 5 commits into
Open
Thread plate numbers through bill of materials and filenames#17jaysi1001 wants to merge 5 commits into
jaysi1001 wants to merge 5 commits into
Conversation
added 5 commits
May 5, 2026 20:12
When the total grid units on both axes left a 1-unit remainder after splitting by the max printer size, the old code tried to fix each axis independently by overwriting cells from the previously placed plate. At the corner where both x and y had a 1-unit remainder, the two overwrites collided, producing L-shaped plates and visible color crossover in the visualization. Replace the overwrite approach with compute_splits(), which pre-computes clean rectangular chunk sizes before filling the matrix. A 1-unit final chunk is merged into the previous chunk (e.g. [5,5,1] becomes [5,4,2]) so every plate is always a clean rectangle with no overlaps.
The padding adjustment loop checked (max_units * 42) + leftover against the printer size, incorrectly assuming the rightmost/topmost plate is always max_units wide. It isn't — compute_splits distributes the total across plates, so the edge plate is often smaller than max_units. For example with printer=180mm, space=324x231mm: compute_splits(7,4)=[4,3], so the rightmost plate is 3 units (126mm), and 126+30mm padding=156mm fits in 180mm. The old check used 4*42+30=198mm and needlessly reduced max from 4 to 3, producing 6 plates instead of the correct 4. Replace the crude 1mm-decrement loop with adjust_max_units_for_padding(), which computes the actual edge plate size via compute_splits and reduces max_units only when the padded plate genuinely does not fit. Also handles x and y axes independently rather than always decrementing both together. Fixes HopperDropper#10
Each plate now shows its number centered inside the colored region using white bold text with a black outline, making it easy to match the visual layout to the bill of materials and downloaded file names.
Bill of materials entries and downloaded .scad filenames now use the same plate number shown in the visualization (e.g. 'Plate 1: 4x3', 'Plate_1_4x3.scad') so users can match each file to its position in the drawer without counting manually. Refactors determine_padding() and summarize_bom() to return per-plate dicts keyed by plate ID instead of size-string-keyed count dicts.
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.
Bill of materials entries and downloaded .scad filenames now use the same plate number shown in the visualization (e.g. 'Plate 1: 4x3', 'Plate_1_4x3.scad') so users can match each file to its position in the drawer without counting manually.
This PR includes all four commits: corner overlap fix, padding fix, visualization, and BOM updates.