# Grid storage ## What this builds A grid storage system: a base plate with a regular pitch, and bins that sit in the cells. The model is code, so pitch, walls, magnet pockets and stacking lips follow the inputs. A script measures the meshes against this spec. No physical print is required to accept the build. Read `spekkr.inputs.json` first. `pitch`, `wall`, `bins_x` and `bins_y` size the grid, all in millimetres except the counts. `magnets` and `lips` add features. `tool` is the modeller. ## Out of scope - A particular printer's profile or a slicer preset. - A branded storage ecosystem's exact parts, or its name in the id. - A physical print, or magnets actually inserted. ## Requirements Each requirement has an id. Checks name the id they cover. ### R1. Pitch and cells - The plate's cell centres are `pitch` apart in X and Y. A `bins_x` by `bins_y` plate's overall size matches the formula in `design.md` within 0.05 mm. - A 1 by 1 bin's outer footprint sits in a cell with the mating clearance in `design.md` (0.2 mm a side, unless the file says otherwise). - A value of `pitch` or `wall` outside the stated range is refused before modelling. Accept when: default and two other input sets match the formulas, a short-of-range input is refused, and the bin-to-cell clearance holds. ### R2. Pockets, lips, meshes - If `magnets` is on, each pocket is a cylinder of the diameter and depth in `design.md`, at the documented centres, and does not break through the plate. - If `lips` is on, the stacking clearance is the documented gap, and two plates stacked in code do not overlap. - Each exported part is a manifold, watertight mesh. Wall thickness is at least `wall` almost everywhere, with the check in `design.md`. Overhangs in the print position are not past 45 degrees. Accept when: pocket and lip measures match, stacked plates do not overlap, and the mesh checks pass. ### R3. Files and frames - Parts: `plate` and `bin` as STL (and STEP if CadQuery). A report lists bounding boxes, volumes, and pass or fail against `design.md`. - Renders: plate, bin, a mated assembly, and an exploded view. - One command builds from the inputs, measures, writes the report, and writes the renders. Running it twice writes the same mesh bytes. No physical print. Accept when: the command passes for both tools, the report fails a deliberately wrong pitch, and the four renders are written. ### R4. Inputs - Numeric inputs are read from `spekkr.inputs.json` and must stay inside the ranges in the Inputs table in `design.md`. - A value outside a range is refused before modelling, with a message that names the key. - Options add or remove the features in that table. The `tool` swap selects CadQuery or OpenSCAD; both must meet the same numbers. Accept when: default and one out-of-range value are handled as above, and a second legal input set still matches the formulas in `design.md`. ## Verification Generated plates and bins are measured for pitch, magnet-pocket dimensions, and stacking or mating clearances against a formula file. Meshes are manifold and checked for wall thickness and overhangs. Assembly and exploded renders are written. No physical print, and no magnets, are required. ## Definition of done - Every acceptance check above runs from one command, and all pass at the person's inputs. - A README says how to install the tool, how to make the parts, and that a print is optional and not part of the checks.