Skip to content

The inside

The carcass is yours. The inside is the customer’s: they divide it into sections and put shelves, drawers or a door in each. You write the cavity, the default arrangement and the limits that keep it buildable.

"layout": {
"enabled": true,
"cavity": { "at": ["t", "t", "back_t"],
"size": ["inner_w", "height - 2*t", "depth - back_t"] },
"dividerThickness": "t",
"allowedFills": ["open", "shelves", "drawers", "door", "flap", "rod"],
"limits": {
"cell": { "minW": 100, "minH": 80 },
"shelves": { "maxSpan": 900, "minGap": 150 },
"drawers": { "minH": 100, "maxH": 400, "maxCount": 6 },
"door": { "minW": 250, "maxW": 600 },
"rod": { "minH": 900 }
},
"default": { "cell": { "fill": "shelves", "count": 1 } }
}

A recipe without this section is not broken. A worktop, a plinth and a cornice have no inside to divide, and a shelving unit whose shelves are PARTS is a different design with the same result.

Written in your own expressions, so it follows the cabinet without anybody restating it. Mind the back: written at z: 0 the first shelf sits in the same four millimetres as the back panel, which is an overlap and a refusal.

A cell is a compartment. A split shares its box among children and puts a divider between them:

{ "split": "x", "children": [
{ "size": { "fr": 1 }, "node": { "cell": { "fill": "drawers", "count": 3 } } },
{ "size": { "mm": 400 }, "node": { "cell": { "fill": "shelves", "count": 2 } } } ] }

Three ways to size a child:

Size Means
{ "mm": 400 } exactly that, whatever the cabinet does
{ "fr": 1 } a share of what is left
"auto" as much as its contents need, and no less

auto counts as fixed, because it is a demand rather than a preference: a section of three drawers cannot be squeezed to make room for a fraction. What does not fit is refused rather than clamped — a wall drag stops against the furniture because there is a sensible place to stop, and a layout that does not fit has no nearest legal arrangement.

The leftover millimetre of an fr division always goes to the last child, so the sections add up to the cavity exactly. That is the one property the drawing and the cut list both lean on.

Fill What it produces
open nothing — an empty compartment
shelves count shelves, evenly spaced, set back from the front
drawers count fronts, each with sides, a back, a bottom and two runners
door one leaf, or two when the cell is wider than door.maxW
flap one leaf hinged at the top
rod a hanging rail

allowedFills is what your recipe offers. A wall cabinet that lists only open and shelves is refusing to hang a rod its hinges cannot carry, and the customer’s panel offers exactly what you listed.

Watch the count when a fill changes. One shelf is an ordinary cabinet; one drawer is a front the height of the whole cavity, which drawers.maxH refuses. The interface starts a new bank of drawers at three for that reason.

Limits, and the divider that appears by itself

Section titled “Limits, and the divider that appears by itself”

shelves.maxSpan is the span past which a shelf sags. Above it the solver adds a divider on its own and says so — the customer sees the cabinet gain a structural post, with a sentence explaining it, rather than a refusal.

Which means your recipe should NOT also carry a divider part of its own for the same reason. Both appear, in the same place, and the cabinet is refused for overlapping itself — at a width nobody tests at, with everything green below it. The inside belongs to the layout.

  • select a section,
  • change its fill and its count,
  • divide it across or down,
  • remove a section, giving the room back to its neighbours,
  • drag a divider, which changes the two sections beside it in millimetres and stops at the minimum rather than refusing afterwards.

Every one of those is a single step of history: the arrangement, the geometry, the cut list and the price move together, and one undo returns the cabinet they had.

Only what the customer changed. A cabinet nobody has opened carries no layout at all, and it is the recipe’s default that was solved — which is what keeps the saved kitchens of a recipe from re-hashing the day you publish a new default. Their arrangement is written down; the untouched ones follow yours.