Generative design · Photo to printable parts

A drawer organizer, generated from one photo

Photograph an empty drawer with a coin on its floor. The tool measures the floor from the coin, generates layouts that tile it exactly, shapes every container from a few parameters, joins neighbours with snap-fit connectors, and exports labelled, print-ready STL files with a plan to assemble them. The same rules drive a Grasshopper definition, so the web tool and the CAD model agree.

A wooden drawer filled with seven 3D-printed containers: warm-white Standard boxes with straight and slanted walls, and pale blue Dome containers whose floors curve into bowls holding coins, AA batteries and SD cards
Rendered from the tool's own geometry · 18 × 12 in drawer, 7 containers, 8 connectors under the floorBlue = Dome (bowl floor) · white = Standard
  1. 01Measure
  2. 02Generate
  3. 03Shape
  4. 04Connect
  5. 05Label
  6. 06Print
  7. 07Grasshopper
1 photoand a US coin are the only measuring tools
5 layoutsgenerated per request, each tiling the floor exactly
6 parametersshape a container: size, type, slant, blend, bowl, name
0 supportsfor Standard containers printed rim-down
01 · Measure

A coin and four corners undo the camera

A phone photo of a drawer is a perspective projection: parallel edges converge and a round coin looks like an oval. Projective geometry reverses it. The four floor corners define a homography, a 3 × 3 matrix that maps the photographed floor back onto a flat unit square.

Once the floor is flat, the only distortion left is that its width and depth were squeezed into the same unit. A circle on the floor therefore becomes an axis-aligned ellipse, and its two radii say exactly how much: W = d / 2a and D = d / 2b, with d the coin's known diameter.

The coin's rim is found by colour, not brightness: rays from the tapped centre walk outward until pixels match the floor's chromaticity, which survives shadows. An ellipse is fitted to the hits by least squares, the worst quarter dropped, and fitted again.

Camera tilt38°
Turn12°
Rim noise3 %
What the phone sees
The same floor as a unit square: the coin becomes an ellipse

rim → H−1 → fit A x² + C y² + D x + E y = 1 → W = d / 2a, D = d / 2b

02 · Generate

Five ways to cut a floor into containers

The generator solves a constrained space-partitioning problem. The drawer floor has to be covered completely, by exactly n rectangles, none smaller than 3 × 3 in, with every edge on a 0.5 in grid so containers line up and remain easy to edit.

Each layout is a guillotine partition: a cut runs across the whole remaining rectangle, splitting it in two, and each half is cut again recursively. Five strategies choose the cuts differently: an even grid, columns, rows, one large container with small ones, and a mixed recursion that picks the axis and count at random.

Randomness comes from a seeded generator (Mulberry32), so Regenerate gives five new layouts while any one stays reproducible. Every candidate is checked: no overlaps, every container at least 3 in, and areas that add up to the floor. Before a cut is made, a capacity test (⌊w/3⌋ · ⌊d/3⌋ ≥ n) rules out halves that could never fit their share.

Containers7

03 · Shape

Rims tile the drawer; everything else is derived

The user edits each container's rim, the outline seen from above, because rims are what must tile the drawer. Every other dimension follows from the parameters: the base is the rim pulled in by the wall slant, the blend rounds the corners and the wall-to-floor curve with one radius, and one wall thickness, 1.5 mm by default, shells every container. Heights count down from the drawer: the 1/4 in track base and the body together fill the drawer's height less 1/4 in of headroom.

A Dome container keeps the same outside but its floor is a bowl, so small parts slide to the middle and can be scooped out. The bowl is the Project 01 dome curve turned upside down: a degree-5 Bézier profile that leaves the wall steeply and flattens to zero slope at the centre.

Constraints keep the parameters honest: slant is capped so the base stays ≥ 2.3 in wide for its track, blend is capped at 45 % of the base and the height, and the bowl is never so shallow that it cuts through the blended outer wall.

Type
Slant
Blend
Wall
Bowl

z(s) = zE − b · Q(s/2) / Q(½),  Q = Bernstein degree 5, c = [0, F, 1, 1, F, 0], F = 1.8

A pale blue Dome container turned over, rim down as it prints, showing the closed track loop on its underside and its tag C01 debossed in the middle; behind it an upright slanted Standard container, in front a cobalt connector with its two slotted snap buttons
As it prints: rim down, so the track and the debossed label come out on top. A connector lies in front, strap down.
04 · Connect

A graph of neighbours, joined on the shortest line

Containers with straight walls sit flush and hold each other in place. Slanted walls leave a gap between bases, so those neighbours need joining. The tool builds an adjacency graph from the rims: two containers are neighbours when they share at least 0.75 in of edge, and an edge needs a connector when either side is slanted.

Under every base runs one closed track: an outer wall, a 0.5 in channel and an inner wall, each an inward offset of the base outline. A connector is two snap buttons and a strap. Its buttons sit on the shortest line between the two facing channels: straight across the overlap of the two sides when they share one, otherwise diagonally between their nearest ends.

Rules on the graph: every side that meets a neighbour keeps at least one connector, two buttons on one side stay 0.75 in apart, a button stays 0.35 in clear of a corner, and a strap may pass under any outer wall (the slit runs all the way round) but never into a third container's inner wall.

Walls

05 · Label

Letters cut into a watertight mesh

Every part is debossed 0.5 mm deep with its tag: C01 under a container, and K03 C02-C06 under a connector strap, which names the two containers it joins. Names such as COINS stay on the plan and in the file names, where they can change without reprinting. The letters come from IBM Plex Mono Bold, stored as polygons, and are mirrored so they read with the part turned over.

Cutting text into a mesh without a CAD kernel is a geometry problem. The underside face becomes a polygon with a hole for every letter; it is split into triangles by ear clipping with hole bridging (earcut), each letter gets a ceiling 0.5 mm up, and walls join the two. A letter's counters, the inside of an O or an A, stay at the surface as islands.

A mesh only prints if it is closed: every edge shared by exactly two faces, in opposite directions. Letters that share a baseline put many vertices on one exact line, which can trip the triangulator, so each vertex is moved by a few millionths of an inch first. 700 random labels in the test suite all come out closed.

Underside face, triangulated around the letters

06 · Print

A snap fit, not a wedge

Each part leaves as a binary STL in millimetres, named by number, name and size. Containers print rim-down: the open top sits on the bed and the underside, with its track and label, is printed last as a crisp top surface. Standard containers need no supports; a Dome needs a little under the flat middle of its bowl.

A connector has to click in, not be forced in. Each button is a slotted ring, 0.38 in across with a rounded top, so it finds its own way into the channel and clears both bead crests by 0.01 in. One slot, facing the inner wall, turns the ring into two curved spring arms, held only where the strap's narrow neck runs under them. On the inner side a small lip reaches 0.02 in past the bead: pressing in, the bead rides down its 30° lead-in and squeezes the ring 0.5 mm narrower; past the bead it springs back and the lip sits on top. A domed post in the middle stops the arms before they bend too far.

Each arm is a curved cantilever of radius R swept through α. Pushed in by δ at its tip, it peaks at ε = δt / 2R²k, with k = α/2 − sin 2α/4. The arms run 138° round the ring, so a 0.5 mm click strains the plastic about 0.8 %. Four fingers standing up would be only 3 mm tall in a quarter-inch track, and would strain 6.7 % for the same click: that is why the slot runs round, not down.

One button in its channel, from above

to scale · 1 in = 330 px

The lip reaches 0.02 in past the inner bead crest (dashed). Pressing in, both arms bend toward the post; once past, they spring back and the lip rests on top of the bead. The outer side only clears its crest, so the strap can leave there.

Section through the lip

Snap strain by arm sweep

Section across the gap: strap under both outer walls

to scale · 1 in = 165 px
FeatureValueWhy
Ring vs bead crests⌀ 0.38 / 0.40 in0.01 in each side: the button slides along the channel and never wedges.
Ring wall · slot0.9 mm · 1 mmTwo perimeters at a 0.4 mm nozzle; one slot facing the inner wall makes two arms of 138°.
Lip0.02 in past the bead30° lead-in on top squeezes the ring in; a 45° face below lets the part be pulled off again.
Strap neck0.2 inHolds the ring across 72° only, so the arms stay free; a strap leaning 45° still leaves arms of 93° at 1.4 %.
Post⌀ 0.24 inStops the arms at 0.035 in, so a hard push can't overstrain them.
Strap vs slit0.098 / 0.1 in0.002 in less than the slit, so it passes under the outer wall.
Snap beadr 0.05 inWhole on the inner wall, upper half on the outer wall over the slit.
Wall and floor1.5 mm · 0.8–3One slider for every container. 1.5 mm is three or four perimeters at a 0.4 mm nozzle: stiff, light, quick.
Label depth0.5 mmTwo or three layers: legible, and the floor keeps 1 mm.
Fit gap · headroom1/16 in · 1/4 inThe organizer drops into the drawer, and the drawer still closes.
Heightbase + bodyThe 1/4 in track base counts toward the drawer height you enter: base + body = drawer height − headroom.
07 · Grasshopper

One layout file, six groups of components

The system began as a Grasshopper definition: one container, its tracks and one connector, driven by sliders. To run it for any layout, every block was made to work per container. A layout.json exported by the web tool is read once, each container is grafted onto its own branch of a data tree, and the original chains run for all of them at once.

The web kernel and the definition follow the same rules, so they act as a check on each other: the app's 5 × 5 in Dome in a 4 in drawer measures 127 × 127 × 95.25 mm, and matching bounding boxes mean the two agree.

Where the original definition used fixed indices (fillet edges 0 2 6 7 8 9 10 11, shell face 1), the per-container version picks by geometry instead: bottom edges by midpoint height, the top face by centroid. Indices change whenever a loft does.

ARead

File Path → Read File → Python 3 Script unpacks base planes, sizes, draft, blend, bowl and track offsets from layout.json; Graft puts each container on branch {i}.

BBody

Rectangle (radius = blend) → Move up → Offset by the draft → Loft → Cap Holes → Fillet Edge on the bottom edges. Standard: Shell 1.5 mm. Dome: loft the bowl's sections from the Bézier curve and Solid Difference the cavity; Stream Filter picks per branch.

CTracks

Four inward Offset curves of the base → Boundary Surfaces → Extrude → Solid Difference with the body so the walls meet its underside; Pipe the beads, cut the slit all the way round, Solid Union with the body.

DConnectors

At each point the ring section and the lip section Revolved through 352°, blended over the lip's 100°, plus a domed post; strap as a necked Polyline → Extrude → Solid Union. Without the app, Curve Proximity between two facing centre lines finds the same shortest line.

ELabels

Curve.CreateTextOutlines in a Python component, mirrored and placed from the label's centre and angle → Boundary Surfaces → Extrude 0.5 mm → Solid Difference.

FExport

Centre each part at the origin, Scale by 25.4 (the model is in inches, slicers read millimetres), bake with names, one STL per part.

Outputs

Everything the printer and the drawer need, in one ZIP

Sheet 1 of the printable plan: the drawer drawn to scale 1:3 with every container's number, name, size and type, the connectors in cobalt, dimensions and a scale bar
plan.pdf · sheet 1 of 2, drawn at a standard scale with a parts schedule on sheet 2
layout.json · the hand-off to Grasshopper, in inches
    One STL per part, in millimetres, plus parts.txt
    Method

    The algorithms, in order

    1. Homography from four points

      Square-to-quad projective map (Heckbert) from the corner pins; its inverse rectifies every rim point.

    2. Rim by chromaticity

      Coin and floor colours sampled as normalised RGB plus a little brightness; rays stop after four floor-coloured samples in a row.

    3. Robust ellipse fit

      Linear least squares for an axis-aligned conic, then the worst 25 % of points dropped and the fit repeated.

    4. Guillotine partition

      Recursive straight cuts with a capacity test, grid snapping and five strategies, seeded by Mulberry32 so each layout can be reproduced.

    5. Offset profiles

      Each container is a sweep of rounded-rectangle rings along its wall profile; the inner surface is that profile offset by the wall thickness.

    6. Bézier bowl

      The degree-5 Bernstein curve from Project 01, halved, normalised and inverted; sections crowd where it is steepest.

    7. Adjacency and shortest lines

      Shared rim edges form the neighbour graph; connector points come from the overlap of facing channel centre lines, or their nearest ends.

    8. Curved cantilever snap fit

      A slotted ring whose two arms sweep 138°, sized by ε = δt / 2R²k: a 0.5 mm click stays under 1 % strain.

    9. Text to triangles

      Font outlines as polygons, mirrored, triangulated by earcut with holes, then closed into pockets and checked edge by edge.

    10. Binary STL and vector PDF

      Both written in the browser with no libraries: STL triangles scaled to millimetres, and a two-sheet PDF in Helvetica at a printed scale.

    11. Grasshopper per container

      The same rules as data trees: one branch per container, geometry picked by position rather than index, layout.json as the shared source.

    Credits. Concept, form logic and the Grasshopper definition by Dhyey Acharya. The web tool and its geometry kernel were developed with the assistance of Claude, translating the .ghx definition into JavaScript. The hero images are Cycles renders of meshes exported by that kernel.

    Measure a drawer and print an organizer for it.

    Open the tool