| name | gridfinity-openscad |
| description | Interpretive guidance for generating OpenSCAD code for Gridfinity desktop/drawer organizers. Provides pattern selection frameworks, dimensional constraints, and stacking system integration specific to the Gridfinity ecosystem. Use when generating OpenSCAD files for Gridfinity bins, baseplates, or accessories. |
Gridfinity OpenSCAD Code Generation
Generates OpenSCAD code for desktop and drawer storage compatible with Gridfinity
(42mm grid, 7mm height units).
Canonical Source
The authoritative reference implementation is kennetek's gridfinity-rebuilt-openscad
(https://github.com/kennetek/gridfinity-rebuilt-openscad), a ground-up parametric port
of the original spec. All dimensions in this skill are taken from its
src/core/standard.scad. When in doubt, that file is ground truth.
Two ways to generate Gridfinity geometry — pick based on the request:
-
Self-contained modules (this skill's default). Spec-correct, dependency-free
.scad files in the patterns under ./common_items/. Use for standard bins,
divider bins, lite bins, and baseplates. The output is a single portable file the
user can print without any library. This is the right choice for the large majority
of requests.
-
Wrap gridfinity-rebuilt as a library. When the user needs advanced features that
are tedious and error-prone to hand-roll — scoops, label tabs, Gridfinity Refined
holes, crush-rib magnet holes, supportless/printable holes, thumbscrews, vase mode —
do not reimplement them. Point the user at gridfinity-rebuilt and, if they want it
vendored, use its real API (new_bin() → bin_render() with bin_subdivide() /
cut_compartment_auto() / compartment_cutter()). Hand-rolling that feature set is
exactly how earlier versions of this skill produced non-interoperable parts.
Required Reading Before Generating Code
./common_items/*.md — full, render-verified OpenSCAD modules for each pattern. Read
the relevant one and adapt it; do not invent base/lip geometry from scratch.
Core Understanding (Critical Architecture)
Construction is subtractive
Gridfinity geometry is built subtractively, matching both gridfinity-rebuilt and the
proven files in this repo (gridfinity/gridfinity-bin.scad,
gridfinity/gridfinity-plate-box.scad):
- Build the solid: interlocking feet (one per grid cell) + a solid body block.
- Subtract the interior cavity (which also shapes the stacking-lip receiving profile).
- Subtract holes (magnet / screw).
This produces clean internal fillets that approximate the original bins. Do not start
from a flat cube or model the base as a hollow box — that will not lock into a baseplate.
The grid and the numbers that matter
// Gridfinity constants — from gridfinity-rebuilt src/core/standard.scad. Do not change.
GRID = 42; // grid pitch, mm (center-to-center of cells)
HEIGHT_U = 7; // vertical height unit, mm
CLEARANCE = 0.5; // total footprint clearance vs grid (0.25 per side)
CORNER_R = 4; // outer corner reference; body/foot-top radius = 3.75
Footprint (the #1 thing earlier versions got wrong):
body_w = GRID * grid_x - CLEARANCE; // = 42*N - 0.5 (NOT 41.5 * N)
body_d = GRID * grid_y - CLEARANCE;
body_r = CORNER_R - CLEARANCE/2; // = 3.75
Bins are pitched at 42mm; the base top of a single cell is 41.5mm, but a 2-wide
bin is 42*2 - 0.5 = 83.5mm, not 41.5*2 = 83. The 41.5 * N formula undercounts by
0.5*(N-1) and produces bins that do not tile correctly.
Height: total height = grid_z * 7mm. The stacking lip sits on top and is not
counted in that height (it is carved into the top of the body). Stock heights are 2u, 3u,
6u → 14, 21, 42mm of body.
The base foot profile (interlocking)
From the spec, each foot is a swept profile, bottom→top (these are the real numbers):
BASE_C1 = 0.8; // bottom 45-degree chamfer (rise & run)
BASE_STRAIGHT = 1.8; // vertical section
BASE_C2 = 2.15; // top 45-degree chamfer
BASE_H = BASE_C1 + BASE_STRAIGHT + BASE_C2; // = 4.75mm
// Foot cross-sections per cell (top -> bottom):
foot_top = GRID - CLEARANCE; // 41.5, r = 3.75
foot_mid = foot_top - 2*BASE_C2; // 37.2, r = 1.6
foot_bot = foot_mid - 2*BASE_C1; // 35.6, r = 0.8
One foot is placed at the center of each 42mm cell. See basic_bin.md for the exact
foot() / rrect() / taper() modules — this is the house style used throughout the repo.
The stacking lip (its own profile — NOT a mirrored base)
The lip is a distinct spec profile carved as a female receiving cut into the top inner
edge of the wall, so another bin's foot nests into it:
LIP_BOT_CHAMFER = 0.7; // up the inner tip
LIP_VERT = 1.8; // vertical
LIP_TOP_CHAMFER = 1.9; // out to the rim
LIP_H = 0.7 + 1.8 + 1.9; // = 4.4mm (nominal)
LIP_TIP_INSET = 2.6; // innermost protrusion of the lip
LIP_VERT_INSET = 1.9; // inset of the vertical section
LIP_RIM = 0.6; // small flat top rim (avoids a fragile knife edge)
A 0.6mm rim/fillet replaces the theoretical sharp point — actual lip height comes out
~3.55mm, which does not affect stacking. A support ramp blends the lip tip back to the
wall when the wall is thinner than the lip depth. Mirroring the base profile is wrong and
will not stack with real bins. See basic_bin.md for the verified cavity() module.
Base holes (magnet / screw)
MAGNET_HOLE_D = 6.5; // hole diameter to fit a 6mm magnet
MAGNET_HOLE_H = 2.4; // 2mm magnet + 2 print layers
SCREW_HOLE_D = 3.0; // M3
HOLE_OFFSET = 13; // hole centers at +/-13mm from each cell center (26mm spacing)
Note the magnet hole is 6.5mm (not 6mm — that is the magnet itself). Four holes per cell.
Pattern Selection Framework
| User wants to store | Pattern | Module |
|---|
| Generic desktop/drawer organization | Basic Bin | basic_bin.md |
| Sorted small parts (screws, resistors) | Divider Bin | divider_bin.md |
| Fast / low-filament bins | Lite Bin | lite_bin.md |
| Mounting surface for bins | Baseplate | baseplate.md |
| Scoops, tabs, refined/printable holes | → gridfinity-rebuilt library (see Canonical Source) | |
When unclear, ask: Desktop or drawer? Similar items or mixed categories? Speed or
strength? Standard sizes or exact drawer fit? Default to Basic Bin.
Code Generation Conventions (house style)
Match the existing files in gridfinity/:
- Customizer sections with
/* [Group] */ headers and // comment above each param;
put constants under /* [Hidden] */.
- Centered on the origin (feet laid out symmetrically),
$fn = 48, EPS = 0.01
overlap to avoid coincident faces.
- Shared 2D/3D primitives:
rrect(w,d,r) (centered rounded rectangle), taper(...)
(hull between two cross-sections). Reuse them; don't reinvent.
- Include a
cross_section debug switch at the end so the user can -D cross_section=true
to inspect the wall/lip profile.
- Cite gridfinity-rebuilt as the spec source in a header comment.
Communicate actual dimensions
When the user gives grid units, state the real numbers back:
- "2×3×4u bin = 83.5mm × 125.5mm × 28mm body" (
42N - 0.5), lip adds ~0 to stacking.
- Usable interior ≈ body minus
2*wall (default 1.2mm) in X/Y, and height minus
BASE_H + floor_t (≈ 5.95mm) for the floor, minus the lip region at the top.
Height budget / minimums
BASE_H (4.75mm) + floor (~1.2mm) ≈ 6mm is consumed at the bottom before usable space.
A 1u (7mm) bin has almost no interior; recommend ≥ 3u (21mm) for functional storage
unless the user wants deliberately shallow compartments.
Common Pitfalls (all previously shipped wrong — do not repeat)
41.5 * N footprint. Use 42*N - 0.5. (41.5 is one cell's base top, not the pitch.)
- Hollow-box "base profile." The base is interlocking swept feet (0.8/1.8/2.15 =
4.75mm), one per cell, built as positive geometry. A hollow box won't lock into a baseplate.
- Stacking lip = mirrored base. Wrong geometry. The lip is its own profile
(0.7/1.8/1.9 = 4.4mm) carved into the top inner wall. Won't stack otherwise.
- Magnet hole = 6mm. The hole is 6.5mm; 6mm is the magnet. Holes at ±13mm from cell center.
- "Lite = vase mode." Lite means a hollowed base (thin floor + shelled feet) to
save filament; it still prints normally with walls and lip. Vase mode is a separate
spiralized model — use gridfinity-rebuilt's vase file for that.
- Hardcoded magic numbers. Parameterize from
GRID, HEIGHT_U, grid units.
Quality Checklist
Before delivering, and always render to verify (this repo's CLAUDE.md requires visual
verification; the entire historical failure mode was unverified wrong geometry):
- ✓ Footprint uses
42*N - 0.5; outer radius 3.75
- ✓ Interlocking feet (0.8/1.8/2.15 = 4.75mm), one per cell, built subtractively
- ✓ Stacking lip uses the real profile (0.7/1.8/1.9, 0.6 rim) if included
- ✓ Magnet holes 6.5×2.4mm / screw 3mm at ±13mm from cell centers (if included)
- ✓ Height =
grid_z * 7; warned if < 3u
- ✓ Rendered (
openscad -o out.stl …): manifold, NoError, and visually correct
(use -D cross_section=true to check the lip/foot profile)
- ✓ Parameterized, customizer sections,
$fn set, gridfinity-rebuilt cited
- ✓ Advanced features (scoop/tab/refined/printable holes) → deferred to gridfinity-rebuilt,
not hand-rolled
Module Reference
./common_items/
├── basic_bin.md - Standard bin: feet + body + carved cavity + optional lip + holes
├── divider_bin.md - Basic bin + internal divider walls (stop below the lip)
├── lite_bin.md - Hollowed base (thin floor + shelled feet) to save filament
└── baseplate.md - Tiled slab with foot-shaped sockets + optional magnet/mount holes
Workflow: select pattern → read its .md → adapt grid dims → state actual mm
dimensions → render & verify manifold + visually → add holes/lip only if requested →
for scoops/tabs/refined holes, reach for gridfinity-rebuilt.
Related Skills
home-organization — choosing between organization systems
opengrid-openscad — OpenGrid (28mm) wall-mounted system. Note: 2×Gridfinity (84mm) =
3×OpenGrid (84mm), so the two systems share an 84mm alignment for hybrid layouts.