Skip to content

Thread plate numbers through bill of materials and filenames#17

Open
jaysi1001 wants to merge 5 commits into
HopperDropper:mainfrom
jaysi1001:feature/plate-numbers-bom-clean
Open

Thread plate numbers through bill of materials and filenames#17
jaysi1001 wants to merge 5 commits into
HopperDropper:mainfrom
jaysi1001:feature/plate-numbers-bom-clean

Conversation

@jaysi1001
Copy link
Copy Markdown

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.

Jay 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant