# EX3D Studio — guide for AI models

You can model buildings in EX3D Studio (https://www.ex3d.com/studio/) through one
small JSON API, `window.EX3D`. This guide is everything you need. It is written for any model,
small or large: follow it literally and you will build correctly.

**Worked example:** the public Farnsworth House sample was built only with this API —
`llm/examples/farnsworth.ops.json` (open it in the app: `studio/?public=farnsworth`).

---

## 0. The fast lane: twelve tools, few tokens

**API keys are secret.** In the AI panel your key stays in your browser and is sent only to the provider you choose — EX3D never
stores it on its servers or in project data (collaborators, viewers and published copies never see it).

The same small tool set serves the in-app **AI panel** (left rail › AI: plug in any model with tool use, your own key) and
agents that drive the page from outside (a browser MCP). From outside, everything is ONE call returning compact text:

```js
EX3D.prompt                      // the short system prompt (rules + every op in one line) — read once
EX3D.tools                       // [{ name, description, args }]
await EX3D.call('get_state')     // name, stories, counts, bounds, the open view, the USER'S SELECTION, the views
await EX3D.call('catalog', { what: 'assemblies', filter: 'door' })   // assemblies | materials | library | sections | species | views
await EX3D.call('find', { type: 'wall', near: [4000, 2500], radius: 1500 })
await EX3D.call('find', { name: 'FU*', category: 'plant', show: true })   // show:true SELECTS ALL matches in one call; also material (id or name), sameMaterialAs: 'selection', selected: true
await EX3D.call('guide', { topic: 'stair' })                         // ONE op's fields, or rules | recipes | pitfalls | sheets | layout …
await EX3D.call('run_ops', { ops: [ … ] })                           // → { ok, created, changed: { wall: '+4' }, bounds } or errors
await EX3D.call('script', { source: 'for (let i = 0; i < 8; i++) EX3D.op({ op: "column", story: "story-0", at: [i * 6000, 0] })' })
                                                                     // JS → many ops, run as ONE batch (see § 0e)
await EX3D.call('look', { view: 'Plan - floor' })                    // PLAN / ELEVATION first: the clearest feedback (no light, no camera)
await EX3D.call('look', { view: 'Outside', eye: [x,y,z], target: [x,y,z], style: 'work' })   // 3D: flat colours + edges by default (never dark); 'lines' | 'clay' | 'render' (lit)
await EX3D.call('look', { at: [x,y], radius: 2500 })                 // ONE SPOT: the plan cropped to that square; view: '3d' = framed from above, NO view filter (the whole model)
                                                                     // from outside it opens the view ON SCREEN: take your own screenshot
await EX3D.call('plan_text', { story: 'Floor' })                     // a tiny SVG of the plan, no picture needed
await EX3D.call('show', { view: 'Plan - floor', ids: ['w1'] })       // point the user at something
await EX3D.call('undo')
await EX3D.call('reference')                                         // reference IMAGES on plans / sheets + where they lie (mm)
await EX3D.call('reference', { id, crop: [0, 0.5, 0.5, 1] })         // one image sharp (in-app models get the picture; from outside: its
                                                                     // pixel → mm mapping — open its plan and screenshot it to see it)
await EX3D.call('remember', { note: 'scale 1 ft = 304.8 mm; outline 15 × 15 m' })   // a pinned fact (EX3D.notes)
```

Token rules: never dump `EX3D.elements()` whole — `find` with a filter; read `guide(op)` only for ops you use;
batch a whole building part per `run_ops`; take a screenshot after a meaningful batch, not after every op
(from outside, `look` puts the view on screen so your browser tool's screenshot is a real, cheap image —
never pull a base64 data URL through JavaScript).

## 0e. Script: many ops from a few lines (guide topic: script)
The `script` tool runs JavaScript in a sandbox (no page, no network, no storage; at most 4 s and 5000 ops) and runs the ops it makes as ONE
`run_ops` batch — all or nothing, one undo. Use it whenever ops repeat or follow a rule: a column grid, a facade of fins, stepped terraces, a
spiral stair of slabs, a pattern of lights. The API inside:
- `EX3D.op({ op: 'wall', … })` queues one op (any run_ops op, same fields) · `EX3D.ops([…])` several · or `return [ … ]` an array of ops.
- `EX3D.model` = `{ stories, elements }` (the compact rows `find` gives), read-only — measure from what is there.
- `EX3D.log(…)` = notes that come back with the result. `dry: true` lists the ops without running them.
```js
// a 6 × 4 grid of 400 mm columns, 6 m × 5 m bays, and a slab over it
const st = EX3D.model.stories[0].id;
for (let i = 0; i < 6; i++) for (let j = 0; j < 4; j++) EX3D.op({ op: 'column', story: st, at: [i * 6000, j * 5000], w: 400, d: 400 });
EX3D.op({ op: 'slab', story: st, poly: [[-500, -500], [30500, -500], [30500, 15500], [-500, 15500]], top: 3000 });
```
New OBJECT CLASSES (a parametric object people create by gesture too) are not made in a script: `define_object` saves a plugin with the project.

## 0d. Big jobs: the plan of plans (optional)

A tool, not a rule — use it if it helps you. Small models that design a whole building in one thought run out of tokens
and build nothing; for them `plan({action:'start', brief})`
lays out an architect's phases — program, site, massing, layout per floor, openings, spaces, furnish, outside — with review
tasks that zoom out between them. Split a phase with `plan({action:'add', parent, items:['Ground floor','First floor']})`,
finish each task with `plan({action:'done', id, note:'one line: what was decided, key sizes'})`. In the AI panel the app then
hands you ONE task at a time in a small window (the plan outline, the task, the decisions so far); from outside, call
`plan({action:'show'})` to see where you are.

## 0c. The reference workflow (guide topic: underlay)

1. `reference()` — every reference with its `next`: a **photo / scan** → `prepare_image({id})` (cleans, straightens, splits the sheet
   into drawings d1…; a clean CAD export is left as it is); a **DXF** → `find_walls({id, layers})` — exact walls from its own
   parallel lines, no picture; a **3D / IFC model** → already 3D, use it.
2. Name the drawings with `remember` ("d3 = FLOOR 1"); if the sheet was not separated, `mark_drawing({id, name:'FLOOR 1', box})`
   with a box read off the overview's grid. Work on ONE: `reference({id, drawing:'FLOOR 1'})` (+ `crop` = a part of that drawing).
3. `calibrate({on, a, b, length})` once from one written dimension (images only — a DXF is already in mm).
4. `find_walls({id, drawing})` → numbered candidates → `{op:'trace', on:'<view>', use:'all', skip:[…]}` (skip dimension
   lines, text, furniture). Add what it missed with `"on"` points — walls `a`/`b`, doors `at`, rooms `box` — snapped onto the drawing.
5. `reference({id, drawing, overlay:true})`: your walls (red, yellow = off the drawing) over it, untraced lines orange. Fix, repeat.

## 0b. Real-world work: plan photos, unclear briefs, small models

- **A plan image is an UNDERLAY — draft on it.** Standard practice: `reference({ id, crop })` gives a picture with a pixel
  grid and a view id (`v1`…); `calibrate({ on: 'v1', a: [x,y], b: [x,y], length: "17'-1\"" })` scales the image from one
  written dimension; then every op can take points in that picture's pixels: `{ op: 'wall', on: 'v2', a: [120, 340],
  b: [480, 340], thickness: 150 }`, doors `at`, or a whole floor `{ op: 'rooms', on: 'v2', rooms: [{ name, box: [x0,y0,x1,y1] }] }`.
  `reference({ id, crop, overlay: true })` shows your walls (red) and rooms (blue) over the drawing — fix what is off.
  No re-measuring, no unit arithmetic: the app maps pixels to mm.

- **"The plan is in the plan view"** means a reference image: `reference()` lists every image on the plans and
  sheets with its rectangle in model mm; `reference({ id, crop })` zooms into one floor or one label. A photo is
  almost never to scale where it was dropped — scale it from ONE written dimension (the overall length, or the
  longest room) and `remember` that scale.
- **Write lengths as they are drawn:** `"21'-6\""`, `"14'"`, `"9'-1 1/2\""`, `"8in"`, `"3.2m"`, `"450mm"` are
  converted to mm inside `run_ops` (names and texts are left alone). No feet-inches arithmetic in your head.
- **Don't interrogate the user.** A hand drawing is ambiguous: list your assumptions in a few short lines, build,
  and let them correct you. At most one round of questions, all at once, only if something blocks you.
- **Stages, not one giant plan.** Stories → outer walls of one floor → its interior walls → openings → slabs →
  the next floor → stairs → roof → views. One `run_ops` per stage, a check (`plan_text` or `look`) after each.
  Reasoning models: think briefly per stage — a long plan of the whole house in your head runs out of tokens.
- **Your context is small; the project is not.** The in-app panel compacts old turns into a digest when the
  conversation nears its budget (Settings › Context budget, about half the loaded context length). The model in
  the project is the record — re-read it with `get_state` / `find`; keep facts you will need in `remember`.
- **Playbooks** (AI panel › Playbook): prepared prompts for these jobs — model from a plan photo, design from a
  brief, furnish a room, check the model, change only the selection, presentation views. Copy their steps.
- **Local models** (LM Studio, Ollama): load with Parallel / concurrent predictions = 1 (the context is split
  between slots), 32–64k context that fits in VRAM (a context spilling into system RAM crawls), Thinking = Brief.

## 1. How to connect

- **Through a browser tool (works today, any model).** Open the app, then evaluate JavaScript in
  the page: `EX3D.info()`, `EX3D.run([...])`. Any MCP server that drives a browser works
  (Claude in Chrome, Playwright MCP, Chrome DevTools MCP).
- **Start clean:** open `studio/?new` (a fresh project, no login) and pick "Just open the app",
  or load a public project with `studio/?public=farnsworth`.
- **Headless (scripts):** `node dev/build-samples.js` replays an ops file with the same API.

## 2. The three rules

1. **Millimetres everywhere.** A 4 m wall is `4000`.
2. **Plan axes: x → east, y → north.** Points are `[x, y]`. Heights (z) are measured **up from the
   floor of the element's story** — except camera eyes and targets, which are **absolute** (from
   the ground, z = 0).
3. **`EX3D.run(ops)` is all-or-nothing.** If any op is wrong, *nothing* changes and you get
   `errors` in plain words (`"op 3 (wall w2): the two ends are the same point"`). Fix and resend
   the whole batch. A successful batch is one undo step for the user.

## 3. Read before you write

```js
EX3D.info()                    // stories, assemblies (doors, windows, objects), materials, site, counts, ops
EX3D.elements({ type: 'wall', story: 'Floor' })   // compact list: ids, points, sizes
EX3D.describe('w12')           // one element in words
EX3D.bounds()                  // { x0, y0, x1, y1, z0, z1 } of everything, mm
EX3D.plan({ story: 'Floor' })  // a small SVG of the plan (1 unit = 10 mm, north up) — cheap to read
EX3D.views()                   // the boards: plans, 3D views, sheets
await EX3D.screenshot({ view: '3D View', w: 960, h: 600 })   // a JPEG data URL of a 3D view — LOOK at it
EX3D.info().sections           // the steel section catalogue (W8x48, IPE 300, C15x33.9, SHS 100x6 …)
```

## 4. The ops

Give an op an `id` of your own (letters, digits, `_`, `-`) and later ops in the same batch — and
later batches — can refer to it. Stories and materials can be named by id **or** name.

| op | fields | notes |
|---|---|---|
| `name` | `name` | the project's name |
| `site` | `lat, lon, utc (hours from UTC; omitted with lat/lon = lon/15, so `time` is the place's local time), date 'YYYY-MM-DD', time 'HH:MM', north, sky, clouds, fog, weather, night` | sun position, sky. `sky: 'atmosphere'` = physical sky. `clouds: { on, type: 'cumulus'\|'overcast'\|'cirrus', coverage 0–1 }`. `fog: { on, visibility m, height m, base m, albedo 0–1, g, tint }` or `{ on, preset: 'haze'\|'forest'\|'mist'\|'fog'\|'dense'\|'smog' }` = ground fog. `weather: 'clear'\|'fair'\|'hazy'\|'overcast'\|'damp'\|'mist'\|'fog'` sets air + clouds + fog at once |
| `story` | `id, name, elevation, height` | a level. With an existing `id` it edits that story. A new project has one story, id `story-0` |
| `material` | `from, id, name, color '#rrggbb', look, roughness 0–1, metalness 0–1, opacity 0–1, clearcoat, sheen, anisotropy, subsurface, bevel, antiTile 0–1, macroVar 0–1, cut` | `look` = one word for the physical layers: `matte`, `plastic`, `lacquered`, `car paint`, `metal`, `brushed`, `glass`, `velvet` (fabric, bouclé), `skin / wax`, `soap film` — e.g. `{op:'material', name:'Green velvet', color:'#2f4a2c', look:'velvet'}`; fields after it override (`clearcoat 0–1` + `clearcoatRoughness`, `sheen` + `sheenRoughness`, `sheenColor`, `anisotropy`, `iridescence`, `subsurface`, `transmission` + `ior`, `bevel` mm rounded edges, `specularIntensity`, `emissiveIntensity`). A textured material from scratch (wood, stone, fabric, rug, steel): the `texgraph` op with a preset + `bake:true`. Adds or edits. `antiTile` breaks visible texture repeats (hex-tile blending), `macroVar` adds large-scale colour variation — both 0 = off, good on lawns, concrete, stone, gravel. `cut` = plan cut pattern: `solid`, `none`, `concrete`, `brick`, `steel`, `wood`, `insulation`. Built in: `Concrete`, `Brick masonry`, `Drywall`, `Plaster`, `Insulation`, `Glass` (`mat-vidrio`) `from`: copy one of the EX3D materials with its textures (travertine-pavers, primavera-veneer, oak-chevron, marble-bianco-lassa, steel-brushed, leather-tan, silk-shantung, concrete-formwork, brick-capuccino … — `info().library` lists all 37; real sizes, colour / normal / roughness maps); name / cut / … still apply on top |
| `wall` | `story, a [x,y], b [x,y], thickness, height, base, material, refline, roof` | the line a→b is the wall's **centre** (`refline: 'center'`). `height` null = the story height. `roof: 'extend'` = its top follows the underside of a roof of its story (gable ends); `'trim'` = cut where it rises above it |
| `slab` | `story, poly [[x,y]…], thickness, top, material, finish, underside, fascia { section, material }, holes [[[x,y]…]…], subtract [ids]` | `top` = the slab's top above the story floor; it hangs `thickness` below that. Floors: `top: 0`. A roof: `top: story height + thickness`. `fascia` = a steel channel round the whole edge, web outside, flush with top and bottom (`section` a channel, e.g. `C15x33.9`, `UPN 300`) `finish` = the top face (the floor you walk on), `underside` = the ceiling below; default: the slab's own material (the plan shows the finish) **holes / subtract** cut outlines out of the slab (a pool in the terrace, a stair well): `holes: [[[x,y]…]]` in mm, or `subtract: ["<id>"]` = another element's outline (a **stair**'s run + 60 mm = its stair well, slab, zone, lawn, roof, a drawn polygon or box); edit later with `edit {set:{holes:[…]}}` (`[]` clears) or `{set:{subtract:[ids]}}`. |
| `column` | `story, at [x,y], w, d, height, base, angle, material, section \| profile, tw, tf` | a rectangle `w` (along x) × `d` (along y), centred on `at`. `section: 'W8x48'` makes a real steel section (its sizes from the catalogue, `info().sections`); or `profile: 'I'\|'C'\|'round'\|'tube'\|'pipe'` with your own `w, d, tw` (web / wall) `, tf` (flange). An I's web runs along y; turn it with `angle` |
| `beam` | `story, a [x,y], b [x,y], top, section \| profile + w, d, tw, tf, roll, material` | a steel member from a to b; `top` = its top above the story floor (default: the story height). `roll` turns the section about its axis (degrees) |
| `stair` | `story, a [x,y], b [x,y], wide, rise, base, risers, kind, tread, nosing, material, stringer` | a straight flight walking **up from a to b** (the run, on the stair's centre line); `wide` across. `rise` = total height, from `base` above the story floor. `risers` defaults to rise / ~175. `kind: 'solid'` (a stepped mass), `'floating'` (slabs `tread` thick), `'stringers'` (floating treads + two steel plates, `stringer` = their material). The top tread is one riser below the landing: the landing itself is the last step |
| `glazing` | `story, a [x,y], b [x,y], height, base, panel \| panels, mullionW, mullionD, head, sill, transoms [h…], glassT, material, glass` | a curtain wall: glass on the line a→b, mullions every ~`panel` mm (the length is shared evenly) or `panels` bays, frame bars `head` / `sill` high (0 = none), horizontal `transoms` at those heights. `material` = the frame, `glass` = the glass material (default `mat-vidrio`). `height` null = the story height |
| `curtain` | `story, a [x,y], b [x,y], open, split, top, drop, fullness, pleat, track, material` | pleated fabric on a track a→b. `open` 0 (drawn shut) … 1 (pushed open); `split: 'center'` stacks at both ends, `'left'` at a, `'right'` at b. `top` = the track height (default: the ceiling), `drop` = fabric height (default: to the floor). Built-in fabric `mat-cortina` (a sheer) |
| `cabinet` | `story, a [x,y], b [x,y], kind, modules, depth, height, elev, plinth, handle, worktop, flip, material, front, top, handles` | a run of cabinets whose BACK is the line a→b; they stand on its **right** (draw along the wall as you face it, left to right; `flip: true` = the other side). `kind: 'base'` (worktop) `\| 'wall'` (hangs at 1450) `\| 'tall' \| 'island' \| 'wardrobe'`. `modules: '600 drawers, 900 sink, dishwasher, hob'` — a width is optional (none = they share the rest); fronts: `doors, door, drawers, drawers2, drawers4, open, sink, hob, oven, dishwasher, fridge, blank`. `handle: 'bar' \| 'knob' \| 'push'`. Materials: `material` = carcass, `front`, `top` (worktop), `handles` |
| `tree` | `story, at [x,y], species, height, seed, season, density, prune, fullness, z, bark, leaves` | a procedural tree: `species: 'maple' \| 'oak' \| 'ash' \| 'birch' \| 'beech' \| 'poplar' (Lombardy, columnar) \| 'willow' (weeping) \| 'pine' \| 'scotspine' (bare trunk, high crown) \| 'spruce' \| 'fir' \| 'larch' \| 'shrub'`; `height` mm (null = the species' own); `seed` = which tree (the same seed, the same tree — vary it for a group); `season: 'spring' \| 'summer' \| 'autumn' \| 'winter'` (bare; conifers keep their needles); `prune` 0.03…0.85 = where the crown starts up the trunk (low = branches near the ground; null = the species' own); `fullness` 0.3…2.5 (1 = the species) = more branches and leaves |
| `insects` | `at [x,y], kind, count, size [w,d,h], base, span, speed, seed, z` | a small flying swarm, very low poly, animated in the live views (finals show it at its start): `kind: 'butterfly' \| 'bee' \| 'mosquito' \| 'fly'`; they fly INSIDE a box volume centred on `at`: `size` mm (along x, y, up), `base` mm = its floor above the ground; `count` 1…200, `span` mm = one insect's size (larger reads better from far), `speed` × the kind's own; omitted = the kind's own (butterflies 6 in 6 × 6 × 1.8 m, bees 8 in 2.8 × 2.8 × 1.1 m, mosquitoes 24 in a 0.9 m cube 1 m up) |
| `scatter` | `story, poly [[x,y]…], species [..], density, spacing, height, vary, seed, season, edge, prune, fullness, holes [[[x,y]…]…], subtract [ids]` | a wood, a hedge, a planting: plants of the listed species inside the outline, `density` per 100 m² (at most 400), at least `spacing` mm apart, sizes ± `vary`; `edge` 0…1 crowds them toward the outline (a woodland edge); `prune` / `fullness` as for `tree`, for every plant **holes / subtract** keep the plants out (a pool, the house); a `water` element does it by itself. |
| `lawn` (= `terrain`) | `story, poly [[x,y(,z)]…], lattice, latticeZ, look, z, subdiv, stripes, stripeW, stripeAngle, grass, bladeH, tufts, dry, dryScale, leaves, weeds, dandelions, flowers, flowerColor, bumps, clump, clover, seed, material, stripe, holes [[[x,y]…]…], subtract [ids]` | a grass surface. `look: 'manicured' \| 'natural' \| 'meadow' \| 'wild' \| 'none'` sets all the rest at once (then override any; `'none'` = nothing scattered: no blades, weeds, flowers or leaves — the ground, relief and strata stay). `dry` 0…1 = dry patches (`dryScale` mm), `leaves` = fallen leaves (heaped under trees), `weeds` / `dandelions` per m², `flowers` = wildflowers in patches (`flowerColor` '#rrggbb'); `bumps` mm = a gently uneven ground under the blades (the turf follows them), `subdiv` 0–4 = a finer, smoother terrain (×4 triangles a step; smooths sculpted relief too), poly points `[x, y, z]` = ANCHORS: the ground tilts / warps through their heights (a slope: `[[0,0,0],[20000,0,0],[20000,10000,1500],[0,10000,1500]]`), `lattice` 3–5 + `latticeZ` [n×n mm, row by row from min x / min y] = an FFD plane of control heights over the terrain's box (a smooth hill: lattice 3, latticeZ `[0,0,0,0,2000,0,0,0,0]`), `clump` 0…1 = tufts growing in clumps of varied height, `clover` 0…1 = clover patches; mowing stripes `stripeW` mm toward `stripeAngle`°; `z` = its top above the story floor **The grass surrounds the house**: `subtract: ["<the house slab / zone id>"]` or `holes: [[[x,y]…]]` cut the building (a terrace, a path) out of the lawn — mowing stripes, blades and flowers keep out of the holes; a `water` pool / pond cuts itself out of the lawn and slabs under it. |
| `earthwork` | `poly, mode, level, slope` | CUT or FILL a terrain by an outline (the terrain's boolean): `mode: 'cut'` digs the ground inside `poly` down to `level` (mm over the story floor: a basement dig `-3000`), `'fill'` builds it up to it (a platform, an embankment); `slope` = the batter of its sides, across per height (1 = 45°, 2 = 1:2, 0 = vertical); `soil: 'dirt' \| 'gravel' \| 'sand' \| 'mud' \| 'grass'` = the moved ground's surface. The terrain itself is not changed (delete the earthwork and it is back); returns `{ id, cut, fill }` in m³. `{op:'earthwork', poly:[[0,0],[12000,0],[12000,8000],[0,8000]], mode:'cut', level:-3000, slope:1}` |
| `water` | `story, poly [[x,y]…] or rect [x0,y0,x1,y1], look 'pool'\|'pond'\|'lake'\|'sea'\|'still', depth, z, rim, basinT, color '#rrggbb', absorb, waveH, waveL, waveSpeed, waveChop, waveDir, sparkle, rough, crest, foam, caustics, causticScale, carve, material, basin` | a **swimming pool, pond, lake or fountain basin**: the water's edge as `poly` (or a `rect`), `depth` (mm, default 1500) = the basin below the surface, `z` = the surface above the story floor (default -150: a pool sits a little under its deck), `rim` = the wall above the water. It builds the basin (tile floor and walls) and the water. **Absorption**: `absorb` (per metre: 0 = glass, 0.9 = a pool, 2+ = a murky pond) and `color` (what deep water tends to): the deeper, the more of that colour, red first. **Waves**: `waveH` (mm, 0 = a mirror), `waveL` (m, the longest wave), `waveSpeed` (0 = still), `waveChop` (0…1), `waveDir` (deg). `crest` (0…1) tints troughs deeper and crests lighter, `foam` (0…1) = whitecaps on the steepest crests (lakes, sea). `caustics` (0…2, 0 = off) = the sun's moving net of light on the basin floor and walls, `causticScale` its size in m. `sparkle` = the sun's glitter (HDR: Post › Glare / Bloom make it shine). It **cuts itself out of the lawns and slabs of its story** (`carve:false` to stop), so grass and terrace surround it with no extra op. Live views animate it; path tracer / SSGI see glass of index 1.33. A deck around a pool: a `slab` with a hole, or just a slab under it |
| `object` (Mies pieces) | `assembly: 'fam-barcelona-chair' \| 'fam-barcelona-stool' \| 'fam-barcelona-couch' \| 'fam-barcelona-table' \| 'fam-brno-chair' \| 'fam-mies-table' \| 'fam-bed' \| 'fam-rug'`, `params { W, D, H … }` | parametric furniture with plan symbols; a seat faces +y (turn it with `angle`) |
| `rooms` | `story, units ('ft' \| 'in' \| 'm' \| 'cm' \| 'mm'), rooms [{ name, at [x,y], w, d, category, walls }], outer (300), inner (120), height, zones, walls, replace` | a FLOOR from a room list — the fastest way to model what you read on a drawing. `at` = each room's south-west corner, `w` along x (east), `d` along y (north), measured to the wall centre lines. Work in the drawing's units: `units: 'ft'` with `at: [7.667, 0]`, or strings like `"21'-6\""`; without `units` the app works them out (numbers under 200 cannot be mm) and says what it assumed. The app makes one `zone` per room (category guessed from the name) and the walls: every room edge, shared edges once, outer (one room beside it) `outer` thick, inner `inner` thick; porches / decks / patios / terraces get no walls of their own. `replace: true` rebuilds that story's rooms and walls from the new list (doors stay). The answer lists the wall ids for doors and windows |
| `zone` | `story, poly [[x,y]…], name, number, category 'living'\|'sleeping'\|'wet'\|'kitchen'\|'circulation'\|'service'\|'outdoor', showArea, holes [[[x,y]…]…], subtract [ids]` | a room: coloured on the plan with a stamp (name, number, net area). `poly` = the inside faces of its walls. Numbers itself (01, 02 …) per story when `number` is left out **holes / subtract** make a void in the room (a stair well, a courtyard): the plan fill and the net area follow. |
| `roof` | `story, poly [[x,y]…], kind 'hip'\|'gable'\|'shed'\|'flat', pitch (°, 30), overhang (500), thickness (200), base (null = story height), eave (edge index; null = longest), gableWalls (true), material` | `poly` = the pivot line (the wall centre lines); the overhang is added outside. Gable: the edges parallel to `eave` slope, the others are gables (filled up to the roof when `gableWalls`); shed: only `eave` slopes |
| `opening` | `wall, assembly, at [x,y] or t, params, flip` | a door / window **in a wall**. `t` = mm from the wall's start `a`; or give a point `at` near the wall. Doors: `fam-puerta` (swing), `fam-door-double`, `fam-door-glazed`, `fam-door-sliding`, `fam-door-pocket`, `fam-door-bypass`, `fam-door-bifold`, `fam-door-sidelight` (`DW` door width), `fam-door-garage`. Windows: `fam-ventana` (sliding), `fam-win-casement`, `fam-win-french`, `fam-win-fixed`, `fam-win-awning`, `fam-win-double-hung`, `fam-win-louvre`, `fam-win-ribbon`. All take `W, H, SILL` |
| `object` | `story, assembly, at [x,y], z, angle, params` | furniture and other object assemblies (see `catalog assemblies`). Fixtures (back = −y against the wall, `Z` = mounting height): `fam-wc`, `fam-washbasin`, `fam-shower-tray` (`SH` screen, 0 = none), `fam-bathtub`, `fam-kitchen-sink`, `fam-urinal`, `fam-floor-drain`, `fam-water-heater`, `fam-socket`, `fam-switch`, `fam-data-outlet`, `fam-panel-board`, `fam-smoke-detector`, `fam-ac-split`, `fam-radiator` |
| `light` | `story, at [x,y], z, kind, power, color, target [x,y,z]` | `kind: 'point'\|'spot'\|'rect'\|…`, `power` in lumens |
| `view` | `kind 'plan'\|'3d'\|'sheet'\|'elevation'\|'section', name, story, eye [x,y,z], target [x,y,z], fov, side 'south'\|'east'\|'north'\|'west', a [x,y], b [x,y], depth` | adds a board. An **elevation / facade / section** (`kind 'elevation'`, `side` = round the whole model, or `a`,`b` in mm — it looks to the LEFT of a→b) puts its marker on the plan and makes a sheet of its own with the drawing; it needs the model to exist (views run after the other ops of a batch), and a sheet shows it with an item `{ type: 'modelview', at, view: '<its name>', ratio: 100, crop, poche }` (make the elevation BEFORE the sheet). Plans need `story`. 3D eyes/targets are **absolute** heights. A sheet takes `size [w,h]` (px), `paper`, `first: true` (the project opens on it) and `items: [{ type: 'text', at, text, width, size, weight, color, lineHeight } · { type: 'image', at, w, h, src } · { type: 'rect', at, w, h, fill } · { type: 'schedule', at, kind: 'doors'\|'windows'\|'rooms', size, title } · { type: 'planview', at, source, ratio, crop } · { type: 'modelview', at, view, ratio }]` in sheet px, y down. A schedule lists the model as it is at every draw |
| `edit` | `id, set { field: value }` | change any fields: `a, b, at, poly, thickness, height, material, story, top, base…`; `materials: { all \| <slot>: material }` = per part (an object's slots, a mesh's slots 1, 2…, an imported model's file materials — on its file, so every copy follows) |
| `clone` | `from, by [dx,dy], story, id` | a copy of one element, moved and / or onto another story (heights stay story-relative); a wall brings its doors and windows |
| `mesh` · `morph` | `story, shape, size [w,d,h], at [x,y], segs, angle, base, material, smooth`, slots (or `poly`/`rect` + `height, taper, twist`) | a free-form MESH you model yourself (a worktop, a bespoke lamp): `shape: 'box' \| 'cylinder' \| 'sphere' \| 'plane'` makes an editable mesh at once, `segs` = subdivisions (box: n or [nx,ny,nz]); `smooth` = smoothing angle (0 faceted, 30 default, 180 all smooth). Then shape it with `poly` / `mesh_edit`. With `poly`/`rect` + `height` it is an extrusion recipe (`taper` top size ratio, `twist` degrees). For a box, cylinder, sphere … whose sizes stay editable use `create_object` |
| `poly` | `id, do, faces, edges, verts, loop, ring, grow, outer` + the op's numbers | mesh editing, one step. `do`: `extrude {h, mode 'group'\|'local'\|'polygon'}`, `bevel {h, outline}`, `inset {d}`, `outline`, `chamfer {d}`, `connect {segments}` (edges) or 2 verts, `slice {point, normal}`, `bridge` (2 faces or 2 open borders), `cap`, `weld {tol}`, `remove`, `removeEdges`, `removeVerts`, `flip`, `symmetry {axis, flip, at}`, `move {by [dx,dy,dz]}`, `shade {how 'hard'\|'soft'\|'auto'}`, `crease {weight}`, `material {slot}`, `attach {other | others [ids], keep_stack, weld}` (MERGE: the other meshes join this one AS THEY LOOK — their modifier stacks' end result, materials as slots, UVs kept; `keep_stack:false` = their bare base; `weld` mm = join touching vertices), `loopcut {at}` (a new edge loop across the ring of quads through the first picked edge, `at` 0…1 along it), `knife {points [{edge [a,b], t} \| {vert} \| {face, at [x,y,z]}…]}` (cuts each face consecutive points share; points inside a face run from rim to rim), `relax {amount 0…1, iterations}` (evens out the picked verts, none = all; open borders stay), `flatten {axis 'normal'\|'x'\|'y'\|'z'}` (the pick onto one plane), `repair {cap}` (welds doubled vertices, drops collapsed faces, one winding, closed pieces outward; `info.fixed` says what), `quadify {angle}` (flat triangle pairs → quads), `info` (+ `issues`: what repair would fix). Picks: `faces: 'last'` / `edges: 'last'` = what the previous `poly` made, `faces: 'top'\|'bottom'\|'+x'\|'-x'\|'+y'\|'-y'\|'all'` (+ `outer: true`), `edges: 'sharp' (angle)\|'border'\|'outline'\|'of'\|[[a,b]]`, `verts: 'of'\|[i]`; `loop/ring: true`. Returns `info {faces, verts, made, closed}`. A recessed top: `inset faces:'top' d:40` then `extrude faces:'last' h:-20`. Several steps at once: `mesh_edit` |
| `modifier` | `id, add \| set \| remove \| share \| unique \| clear, at, with` + the modifier's fields | the MODIFIER STACK of a mesh (bottom first; the base mesh is never changed, `on:false` switches one off). `add`: `smooth {iterations 0–4, creaseHard}` (soft upholstery; crease edges first with `poly do:'crease'`), `chamfer {amount mm, angle}`, `shell {inner, outer mm}`, `push {amount}` (puff a cushion), `ffd {dims [3,3,3], points {'i,j,k':[dx,dy,dz]}}`, `bend {angle, toward, axis, lower, upper}` (axis = the spine that curves — `z` for an upright part; `toward` = where its top goes: `back` (+y) \| `front` \| `left` \| `right` \| `up` \| `down`; `lower` mm = bend only above that height: a backrest leaning back 15° = `{op:'modifier', id:'back', add:'bend', angle:15, toward:'back'}`), `taper {amount, curve, axis}`, `twist {angle, axis}`, `symmetry {axis, flip}` (mirror across a plane through its gizmo), any of bend / taper / twist / symmetry / uvmap takes `pivot [x, y(, z)]` = its gizmo ANCHORED at that world point (a Symmetry on a column's axis: `pivot:[cx, cy]`) and `gz {x, y, z, rz}` = moved from there (default: the base centre of the mesh coming in) and turned (° about Z), `editmesh {moves {'i':[dx,dy,dz]}, pick {faces}}` (vertex edits ABOVE a primitive, which keeps its parameters; `pick` = its polygon selection, passed up: a bend / taper / twist / push / ffd above with no selection of its own acts only there), `uvmap {kind 'box'\|'planar'\|'cylindrical'\|'spherical'\|'face', axis, angle, rotate, tile [u,v], offset [u,v], faces}` (real-world mapping in metres; put it UNDER smooth). `set: <index or type>` changes fields (`at` moves it), `remove: <index or type>`. SHARED (instanced) modifiers: `share: <index or type>, with: [ids]` puts that ONE modifier on the other meshes too — change it on any of them and all follow (four chair legs, one bend); `unique: <index or type>` stops this mesh sharing it. Returns `info {stack, faces, uv}` |
| `nurbs` | `kind, profile, path, sections, angle, segments, vsegments, cap, scale [a,b], twist, at [x,y], rotate, base, material, smoothing` (or `id, set {…}`) | a smooth surface from curves, as a mesh with real-world UVs. A curve = `[[x,y(,z)]…]` (a smooth curve THROUGH the points — it bulges past sharp corners) or `{pts, degree:1}` (straight segments: trays, plinths, mouldings with corners) or `{pts, through, closed, degree}`. Modelling furniture: do it on the `workbench` tool (alone, at the origin, 4-view look). `kind:'revolve'`: `profile` = `[radius, height]` points, turned round (`angle` 360) — vases, lamp shades, bowls, round table legs, a pendant. `kind:'loft'`: `sections` = closed curves at heights (`[[x,y,z]…]`) skinned smoothly — an armchair shell, a sculpted base. `kind:'sweep'`: `profile` 2D `[x,y]` carried along a 3D `path` (`scale [start,end]`, `twist`) — a handle, a bent tube frame, a moulding. `id, set:{segments:48}` rebuilds it where it stands. Then `modifier` / `poly` as for any mesh (poly edits make it a plain mesh) |
| `asset` | `id, name, slots, standin, when` | saves a mesh to the Library as an object ASSEMBLY (its end result: stack evaluated, one part per material slot, real-world UVs; stretched by W / D / H) and returns its id — place copies with `object {assembly: <id>}`. Saving the same mesh again updates it (every copy follows). `slots: ['Walnut', {name:'Legs', material:'Steel'}]` = material slots 1, 2… (slot 0 = the mesh's material); pick faces with `poly do:'material' faces:… slot:1`. `standin: '<assembly id or name>'` replaces a simple one (the bed placed in the plan) — `when: 'render'` (default) or `'always'` |
| `create_object` | `type, name, params, pos [x,y,z], pos_mode, material` + the class's parameters | an OBJECT of a class — its parameters stay editable (`set_object_property`) until its mesh is edited. Classes (`object_classes` lists them with parameters, plus the project's plugins): `box {width length height widthSegs lengthSegs heightSegs}`, `roundedbox {width length height fillet filletSegs}` (the upholstery / cabinet block: rounded edges, all quads), `cylinder {radius height sides}`, `roundedcylinder {radius height fillet}`, `cone {radius1 radius2 height}`, `sphere {radius segments}`, `geosphere`, `capsule`, `tube {radius1 radius2 height}`, `torus {radius1 radius2}`, `pyramid`, `plane {width length}`. SHAPES (lines): `rectangle {width length cornerRadius}`, `circle {radius}`, `ellipse {width length}`, `arc {radius from to pie}`, `ngon {radius nsides}`, `star {radius1 radius2 points}`, `donut {radius1 radius2}` + `plane: 'xy'` (floor) \| `'xz'` (front) \| `'yz'` (side) — a shape is a line until `add_modifier extrude / lathe / sweep` makes it a surface. width = x, length = y, height = z, mm; `params` = an object or `"width:600 length:400"`; `pos` = the bottom centre (`pos_mode:'center'` = the middle). The guide topic `modelling` is the workflow |
| `group` | `ids, name` · or `ungroup` | an ASSEMBLY from elements: the meshes, shapes, lights and placed objects become ONE type with ONE placement where they stood: `{op:'group', ids:['seat','leg1','lamp'], name:'Reading chair'}` → `{placement, assembly}`. Place more with `object {assembly}` — every placement shares the type; `workbench {do:'open', from:'<placement>'}` edits the type and every placement follows. `{op:'group', ungroup:'<placement>'}` gives the parts back |
| `assembly` | `id, unique, deep, name, lightsOff, group, overrides, state` | an assembly PLACEMENT's sharing and switches: `unique:true` = its own type (a fork; the meshes stay shared until it is edited; `deep:true` copies them now); `lightsOff:true` = its lights off (a pendant, a wardrobe's LEDs); `group:'<light group>'` = its control group — switching that group off in the Lighting panel switches this placement off (room by room); `overrides:{'<node id>':{on:false}}` = one light node of THIS placement. Placements copied as an INSTANCE (a link set) share all of this. `state:'open'` applies a named state of the type (its preset parameters: the wardrobe's `closed` / `ajar` / `open` turn its doors on their hinges). |
| `object` (parametric types) | `assembly, at, angle, params` | A3 parametric types: an assembly param may be `scope:'type'` (the same for every placement — refused in `params`, edit the type) or DERIVED (`formula`, shown, never set); `kind` bool (0 / 1), enum (`options`), integer. Parts may `repeat` ('N', with `i`) and show `when` a condition holds; formulas take `if(c,a,b)`, `and / or / not`, comparisons, `mod`, `clamp`, `floor / ceil` and `lookup(table, key, column)` (catalogue rows: the type's `tables`). Placing returns `warnings` when the type's asserts fail (a door too narrow …). A5: a type may carry `cutters` (volumes the slabs they pass through subtract — a downlight's housing opens its ceiling), `host:'ceiling'` (placed, it hangs from the slab above: CEIL is set for you), `planReps` (its plan drawing by sheet scale) and a `tagRule` (tag text like `DL Ø{DIA}`, shown up to a scale). Reference types: `fam-asm-wardrobe` (W → doors 1/N, alternating hinges, HANDLE 1 bar / 2 knob / 3 none, SH shelves, LED strips per bay) and `fam-asm-downlight` (SIZE 1–4 from its catalogue: diameter, cut-out, lumens; KELVIN). |
| `draw_spline` | `action, name, points, closed, knot_type, knots, spline_index, knot_index, segment, param, thickness, sides, samples` | a SHAPE from points (world mm, z above the floor): `{op:'draw_spline', action:'create', name:'Profile', points:[[0,0,0], {pos:[120,0,0], type:'corner'}, [45,0,40], [35,0,300]], knot_type:'smooth', closed:false}`. Knots: `corner`, `smooth` (automatic curve), `bezier` / `bezierCorner` (with `in_vec` / `out_vec`). A lathe profile is drawn in the FRONT plane (y = 0, x = radius, z = height). Actions: `add_spline` (a hole or a second outline), `get`, `set_knots [{spline, knot, pos, type, in_vec, out_vec}]`, `insert_knot {segment, param}`, `delete_knot`, `delete_spline`, `close` / `open`, `set_render {thickness, sides}` (a renderable rod). Modifiers above the shape follow every edit |
| `inspect_assembly` | `id` (a placement) or `type`, `graph:true` (its wiring) | READ: a placement and its type in the ONE stored structure — every object, door, window and imported model is an ASSEMBLY placement (`role` object / opening / import, `typeId`); its type's properties (`*` = per placement), nodes (`id:kind<parent`: box, mesh, shape, light, cutter, assembly, model …), states, plan representations. Use it to see what a type is made of before `assembly` / `workbench`. |
| `edit_type` | `type` (or `id` of a placement), `create {name, category, from, empty}`, `duplicate`, `name, category, host, tag, tagPrefix, sku`, `properties [{key, label, group, kind, scope, value \| formula, min, max, options, ifc} \| {key, remove}]`, `nodes [{kind:'box'\|'cylinder'\|'cone'\|'sphere', box:[x,y,z,w,d,h], material, when} \| {id, …patch} \| {id, remove}]`, `states {name: {KEY: v} \| null}`, `transition`, `asserts [{expr, message}]`, `slots [{key, label, material}]`, `bind [{from, to, port}]`, `unbind [{to, port}]`, `tables {name: [rows] \| null}`, `handles [{id, label, axis, at, count, drive, anchor, on} \| {id, remove}]`, `widgets [{id, label, at, param \| states, show} \| {id, remove}]`, `vsets [{part, name, verts \| box, x, y, z} \| {part, name, remove}]` | EDIT A TYPE (assembly) as its assembly — the Assembly editor's calls: every change validated (a bad formula, a missing property, a removed property still used is refused with the reason), every placement follows. `create` makes a new type (from a built-in of its category, or `from` another type; `empty:true` = no parts), `duplicate` forks one. scope `instance` = each placement sets its own (object `params`), `type` = one value for all; a `formula` derives it (if, lookup, min, max…). Geometry sizes may be expressions over the properties ('W', 'D-40'). Modelled types (meshes, lights, nested types): their parts are compiled — use `workbench`. `bind` wires a property into a nested type's property (`{from:'OPEN', to:'Left body', port:'OPEN'}`), a part field (x y z w d h rot repeat when) or a light field (`on`, `power`, `kelvin`); `tables` are lookup catalogues (rows) read by `lookup(table, KEY, COLUMN)`. Inside a repeated item `i` / `N` are the copy and the COUNT — name a type property something else (NP) if you need it there. `inspect_assembly {type, graph:true}` lists the wires. HANDLES (the modeller-style controllers): a handle is a named position along x / y / z — `{id:'WR', axis:'x', at:'W/2', drive:'W', anchor:'-W/2'}` is FREE (dragging it in 3D changes W; the left edge stays put), `{id:'G', count:'NB+1', at:'-W/2+W*k/NB'}` is a WIRED array G0…Gn (locked, follows W). Parts wire to them by name: `x:'G(i)+GAP/2'`, `w:'G(i+1)-G(i)-GAP'`, a bar `x:'G(i+1)-40'`. Types without handles get W / D / H handles. WIDGETS are the in-view controls: a switch (`param:'LED'`) or a state cycle (`states:['closed','open']`); `show:'always'` keeps one on every placement in the view, selected or not; `style:{shape:'pill'|'rounded'|'square'|'circle', size:'s'|'m'|'l', bg, color, border:'#rrggbb', icon:'💡', text:false}` sets its look. VERTEX SETS (vertex link) on a MESH part: `{part:'Door', name:'handle', box:[x0,y0,z0,x1,y1,z1] (mm in the part at its modelled size), x:'w-40'}` — those vertices keep their modelled size and their centre goes where x / y / z say (w, d, h = the part's box now); the rest of the mesh stretches. CONTROLS: a property's `control:{type, step, min, max, swatches, label}` picks what the Properties panel shows — number · slider · stepper · dial · toggle · dropdown · segmented · swatch · color · text · handle (a free 3D handle drives it: axis / at / anchor / on) · hidden. COLOUR: a property of kind `color` ('#rrggbb', empty = none) wired to a part's `color` field paints it (a nested type: bind it once, every instance follows). |
| `make_assembly` | `id` (an imported model placed) or `model` (a model of the project), `name` | an imported model becomes an ASSEMBLY: a type whose one part is that model stretched to W × D × H (W / D / H properties → 3D handles, the Properties panel, the node editor, its own materials kept); with `id` the placement turns into it in place. Then `edit_type` adds properties, handles, controls. A library type is saved as your own with `edit_type {type, duplicate:'New name'}`. |
| `align` | `id`, `from` pivot\|min\|max\|center\|bottom\|top, `to` {id, at} or [x,y,z], `axes` 'xyz'\|'xy'\|'z'… | SNAP one element onto another (the people's 3D snaps, by name): moves `id` so its `from` point meets `to` — a lamp's bottom on a table's top `{id:'lamp', from:'bottom', to:{id:'table', at:'top'}, axes:'z'}`, a cabinet's min corner on a wall's. Only the listed axes move. |
| `object_classes` | `filter` | READ: every OBJECT CLASS — the built-in ones (Box, Sphere, Geodesic sphere, Cylinder, Tube, Torus, Cone, Pyramid, Plane, Rounded box, Rounded cylinder, Capsule, Text) and the project's plugins — with its parameters (name:type=default ≥min ≤max) and its creation steps. `create_object {type:<id>, …parameters, pos}` makes one; its parameters stay live (`set_object_property {name, property, value}`) until its mesh is edited. |
| `define_object` | `source`, `name` | A PLUGIN: JS calling `EX3D.define({ type:'object', id, name, category, params: { k: { type: length\|number\|integer\|angle\|bool\|list\|color, default, min, max } }, build(p) → { v:[[x,y,z]…], f:[[i,j,k…]…] } (z up, base on z = 0) or { profile: { outline:[[x,y]…], holes:[…] }, height }, create: { points, steps:[{ x:'sx', y:'sy', … }, { width:'abs(dx)', … }, { height:'lift' }] } })`. It runs in a SANDBOX (no page, network or storage) and is saved with the project. Steps are expressions over sx sy (the press), dx dy dist (the drag), lift (the height move) and the parameters. |
| `inspect_mesh` | `name, level vertex\|edge\|face, selection, limit` | the base cage of a mesh with 1-based ids, centres (world mm), face normals and a `mesh_token`. `selection` filters intersect: `indices [1…]`, `all`, `current`, `bbox [x0,y0,z0,x1,y1,z1]`, `near [x,y,z] + radius`, `normal [x,y,z] + angle`, `boundary:true`, `sharp: 30`. Use selectors, not ids — ids change after every topology edit |
| `mesh_edit` | `name, operations [{op, level, selection, …}], expected_mesh` | MESH EDITING as ONE batch (a failed step changes nothing): `select`, `move {offset}`, `scale {factors, pivot}`, `extrude {amount, mode group\|local\|polygon}` (negative pushes in), `inset {amount, mode}`, `bevel {amount, outline, mode}`, `chamfer {amount, segments}` (edges; 2–3 = rounded), `connect {segments}`, `bridge {segments}`, `delete`, `cap`, `relax {amount, iterations}`, `set_color {color \| null}` (vertex colours). Each step leaves what it made selected: `[{op:'inset', level:'face', selection:{normal:[0,0,1]}, amount:30}, {op:'extrude', level:'face', selection:{current:true}, amount:-15}]` = a recessed top. Modifiers stay on top |
| `geometry_qa` | `name` (none = every part on the open workbench) | checks the evaluated mesh: open borders, non-manifold edges, flipped / degenerate faces, pieces, tris / quads / n-gons — and HINTS to act on: plain 6-face boxes (the cartoon look), sharp edges with no Smooth / Chamfer, n-gons under Smooth, too many faces. Run it before `workbench save` |
| `add_modifier` | `name \| names, modifier, params, selection` | a modifier by class name (`names: [..]` = ONE modifier shared by all of them: set it on one, every one follows): `Smooth "iterations:2"`, `Shell "innerAmount:10 outerAmount:0"`, `Chamfer "amount:6 segments:3"`, `Push`, `FFD_3x3x3`, `Bend "BendAngle:30 BendAxis:2"` (0 x, 1 y, 2 z), `Taper`, `Twist`, `UVmap "maptype:4"` (4 box, 0 planar, 1 cylindrical, 2 spherical), `Symmetry "axis:0"`, `Relax`; on SHAPES: `Extrude "amount:30"` (a closed spline inside another = a hole), `Lathe "degrees:360 segs:24 axis:2"`, `Sweep "section:circle radius:12"` (circle, pipe, rectangle, bar, angle, channel, or `customShape`). A `selection` (mesh_edit selectors) makes a deformer LOCAL: only those polygons move. The `modifier` op does the same with plain fields | · `PathArray "path:<shape> count:12"` (copies of this mesh along a shape: `mode count|spacing, spacing, start, end, follow, axis x|y, up world|path, rotate, alternate` (° roll every other copy = a chain), `pivot base|centre`) · `Scatter "mode:volume target:<mesh> count:300 seed:1"` (copies at random IN a closed mesh, `mode surface` ON it (`align`), `mode path` ALONG a shape (`jitter` mm); `spacing, scaleMin, scaleMax, turn`) · a name with spaces may be quoted or not (`path:"tray path" count:12` = `path:tray path count:12`) · Sweep `profile:<shape>` (another shape's first spline is the section, live; `align centre|bottom|top|left|right|corner, mirror`; an open profile makes a surface)
| `set_object_property` | `name, property, value` | a class parameter of an object (`width`, `radius`, `segments` … — `object_classes`), or `wirecolor` (`'#rrggbb'` or `[r,g,b]`: its colour in the views), `name`, `material`, `pos [x,y,z]` (the bottom centre, mm) |
| `set_modifier_property` | `name \| names, modifier_class \| modifier_index, property_name, property_value` | one property of a modifier (`modifier_index` 1 = the TOP of the stack) |
| `remove_modifier` | `name, modifier` | removes the top-most modifier of that class. |
| `collapse_modifier_stack` | `name` | bakes the stack into the plain mesh |
| `texgraph` | `material, preset, size [W,H], res, seed, depth, nodes, set, connect, disconnect, remove, outputs, layers, layer, bake` | a PROCEDURAL material (a node graph) that tiles at its real size: `preset: 'oak' \| 'oak-veneer' \| 'travertine' \| 'boucle' \| 'rug' \| 'steel'` starts one (a new `material` name makes the material). `size` = one tile in mm, `depth` = relief mm (→ normal), `bake: true` makes the maps on the material (then apply it like any material). Edit: `set: {'grain.lines': 60}` · `nodes: [{id, type, params, inputs: {port: 'node' \| 'node.out'}}]` · `connect: [['planks.id', 'grain.id']]` · `outputs: {color, roughness, metalness, height}`. Nodes (inputs; params): noise(scale [x,y] cells, octaves, persistence, seed) · cells(scale, jitter)→out/edges/id · planks(width, minLength, maxLength, gap, bevel mm)→height/id/mask/u/v · tiles(size [w,h] mm, stagger, gap, bevel)→height/id/mask · grain(id; lines per m, warp, fibres, knots) · weave(threadMm, twill, fuzz) · gradient(dir) · uniform(value) · color(color) · levels(in; inLow, inHigh, gamma, outLow, outHigh) · invert · threshold(in; at, soft) · blur(in; radius mm) · warp(in, by; amount mm, angle) · tile(in; x, y) · rotate(in; turns) · blend(a, b, mask; mode normal\|multiply\|screen\|overlay\|soft-light\|add\|subtract\|max\|min, opacity) · colorize(in; ramp [[0,'#hex'],[1,'#hex']]) · variation(in, id; value, hue) · normal(height; depth) · cavity(height; radius, strength) · ao(height). LAYERS on top (fill + mask): `layer: {add: {name, color '#hex', roughness, metalness, height, opacity, blend, mask: {type 'full'\|'noise'\|'worley'\|'gradient'\|'cavity' (dirt in joints)\|'edges' (wear)\|'height'\|'node', scale, invert, range [lo,hi]}}}`, `{set: i, …}`, `{remove: i}`. See it with the `material_view` tool |
| `sheet_texture` | `sheet, live` | a SHEET drawn with the 2D tools as a TEXTURE: a new material wearing it (returns its id); `live` (default true) = it follows the sheet (redrawn when the sheet changes), false = a copy. Put it on with `paint` / `edit materials`, place it with a `UV map` modifier |
| `set_parent` | `name` (or `names [..]`), `parent` (null = unlink) | a HIERARCHY: the child follows its parent when that one moves, turns or scales; `group` / ★ Save keep the tree as the assembly's node parents (screws under the body, plates under the conveyor). A loop is refused |
| `shape_edit` | `name, do, knots, segments, spline, radius, distance, count, at, end` | DRAFTING on a shape (0-based; knots [[spline, knot]…], segments [[spline, segment]…]): `fillet {knots, radius}` (an arc at each corner) · `chamfer {knots, distance}` · `connect {knots: [a, b]}` (two open ends → joined / closed; else a new line) · `weld {tolerance}` (open ends that touch → one) · `trim {segments: [[s, k]], at}` (the part of that segment at `at` (0…1) between its nearest crossings goes) · `extend {spline, end 'start'\|'end'}` (straight on to the next line) · `outline {spline, distance}` (offset; an open line → a closed band) · `divide {segments, count}` |
| `copy` | `where \| ids, by [dx,dy], count` | an ARRAY: `count` copies of the matching elements, each `by` further — fins, columns, a repeated bay (`where` = the same rules as find) |
| `paint` | `where \| ids, material, part` | ONE material on every match — select by `where` (category, name `"FU*"`, material, sameMaterialAs `"selection"`, type, story…): slabs get it as the floor `finish` (`part: 'underside' \| 'body' \| 'all'`), objects / meshes / imported models on every slot (`part`: one slot), the rest as `material`. A library id (catalog library) is copied in first. "All floors in chevron oak" = `{op:'paint', where:{type:'slab'}, material:'oak-chevron'}` |
| `proxy` | `where, mode` | the matches draw as a PROXY in the live views — `mode: 'points'` (a point cloud of the object, in its colours; default) · `'box'` · `'off'` (the object again). Frees the viewport's memory for heavy imported models, scans, dense meshes: a file whose placements are all proxies is not even read until a final render, which always uses the full objects. `{op:'proxy', where:{type:'import'}, mode:'points'}` |
| `replace` | `where \| ids, assembly \| asset \| with {op…}, params` | swap objects / openings for another assembly, imports for another file — or, with `with: {op:'tree', species:'oak', height:4000}`, each match for a NEW element at its centre on its story (CAD plants → native trees) |
| `stack` | `from, count, height, name, types` | repeat a FLOOR upward: `count` new stories above `from` (its height unless `height`), every element of `from` copied onto each — a tower of typical floors in one op |
| `remove` | `id` | removing a wall removes its doors and windows |

Check a batch without applying it: `EX3D.run(ops, { dry: true })`.

## 5. The loop that works

1. `EX3D.info()` — learn the stories, assemblies, materials.
2. Plan the batch on paper: list every point. Build **from the ground up**: site → stories →
   materials → slabs → columns / walls → openings → objects → lights → views.
3. `EX3D.run(batch)` — if `ok` is false, read `errors`, fix *those ops*, resend the whole batch.
4. **Verify in plan first** — an architect's abstraction, as clear for a model as for a person: `EX3D.plan({ story })` for positions,
   `EX3D.bounds()` for extents, a plan or elevation view for the picture; 3D (`EX3D.screenshot({ view })`) only as a last look —
   the Work view style (flat colours) is never too dark to read, a lit render at night is. Compare with what you intended.
5. Correct with `edit` / `remove` ops, small batches.

## 6. Recipes

**A room 4 × 3 m with a door**
```js
EX3D.run([
  { op: 'slab', id: 'floor', poly: [[0,0],[4000,0],[4000,3000],[0,3000]], thickness: 200 },
  { op: 'wall', id: 'ws', a: [0,0], b: [4000,0], thickness: 200 },
  { op: 'wall', a: [4000,0], b: [4000,3000], thickness: 200 },
  { op: 'wall', a: [4000,3000], b: [0,3000], thickness: 200 },
  { op: 'wall', a: [0,3000], b: [0,0], thickness: 200 },
  { op: 'opening', wall: 'ws', assembly: 'fam-puerta', t: 1000 },
  { op: 'view', kind: '3d', name: 'Outside', eye: [-4000,-6000,1600], target: [2000,1500,1200], fov: 50 },
]);
```

**A raised glass pavilion** (the Farnsworth House idea): a story whose floor is in the air, a floor
slab and a roof slab with steel fascias, steel columns welded to the fascias, glazing between the
slabs, floating stairs — see the worked example `llm/examples/farnsworth.ops.json`.
```js
EX3D.run([
  { op: 'story', id: 'fl', name: 'Floor', elevation: 1600, height: 2896 },
  { op: 'slab', story: 'fl', poly: [[0,0],[12000,0],[12000,6000],[0,6000]], thickness: 381, top: 0,    fascia: { section: 'C15x33.9' } },
  { op: 'slab', story: 'fl', poly: [[0,0],[12000,0],[12000,6000],[0,6000]], thickness: 381, top: 3277, fascia: { section: 'C15x33.9' } },
  // a W8x48 is 216 deep: its centre 10 (the channel web) + 108 outside the slab edge touches the fascia
  { op: 'column', story: 'story-0', at: [1500, -118], section: 'W8x48', height: 1600 },
  { op: 'column', story: 'fl',      at: [1500, -118], section: 'W8x48', height: 3277 },
  { op: 'glazing', story: 'fl', a: [0,60], b: [12000,60], panel: 1676, mullionW: 40, mullionD: 90 },
  { op: 'stair', story: 'story-0', a: [3000,-1400], b: [3000,0], wide: 2400, rise: 1600, kind: 'floating', tread: 60 },
]);
```

**A steel frame:** columns with `section: 'HEB 200'` on a grid, `beam` ops between their centres
with `top` at the floor above (`top: story height`), a slab on top.

**A kitchen:** base cabinets along the back wall, wall cabinets above them on the same line,
a tall unit for the fridge:
```js
EX3D.run([
  { op: 'cabinet', a: [0, 3000], b: [3000, 3000], flip: true, kind: 'base', modules: '600 drawers, 900 sink, 600 dishwasher, 900 hob' },
  { op: 'cabinet', a: [0, 3000], b: [3000, 3000], flip: true, kind: 'wall', modules: '600, 900, 600, 900' },
  { op: 'cabinet', a: [3000, 3000], b: [3600, 3000], flip: true, kind: 'tall', modules: 'fridge' },
  { op: 'curtain', a: [100, 150], b: [2900, 150], open: 0.5 },
]);
```

**A garden:** a lawn round the house, a big tree, a group of birches (different seeds), shrubs:
```js
EX3D.run([
  { op: 'lawn', poly: [[-20000,-20000],[30000,-20000],[30000,20000],[-20000,20000]], stripeW: 1200 },
  { op: 'tree', at: [18000, -8000], species: 'maple', height: 20000, seed: 11 },
  { op: 'tree', at: [-9000, 9000], species: 'birch', seed: 1 },
  { op: 'tree', at: [-7500, 11000], species: 'birch', seed: 2 },
  { op: 'tree', at: [2000, -3000], species: 'shrub', height: 1500, seed: 5 },
]);
```

**A shopfront:** `glazing` with `panels: 3, transoms: [2400], sill: 0` between two walls.

## 7. Pitfalls (each one happened while building the sample)

- **Camera heights are absolute; element heights are story-relative.** An eye at the floor of a
  story at +1600 looking at 1.5 m is `z: 3100`, not 1500.
- **A wall's line is its centre.** A 200 mm wall on `y: 0` spans y −100…+100. To keep glass inside a
  slab edge, move its line in by half its thickness (or more).
- **Slab `top` is the TOP.** A 381 mm slab with `top: 0` occupies −381…0 under the story floor.
- **Columns start at their story's floor.** A column that must reach a roof on another story needs
  `height` = the distance from its own floor to the roof's top.
- **A plan shows only its own story.** A column running from the ground to the roof is invisible on
  the upper plan: model one column per story (same `at`, heights meeting at the floor).
- **Cabinets stand on the RIGHT of a→b.** On a north wall (y = 3000) drawn west → east that is
  south… of the line, i.e. into the room only if the room is south of it; otherwise `flip: true`.
  Check with `EX3D.plan()` — the worktop outline must be inside the room.
- **Trees are tall.** A mature maple is 14–25 m, a birch 10–15 m, a shrub 1–2 m: `height` is in mm.
  Leave room: a 20 m maple's crown is ~12 m across. Lawns and trees go on the ground story.
- **A stair's `a` is its bottom, `b` its top**, both on the centre line. `a → b` is the run, not the
  width — `wide` is across.
- **An I column's web runs along y.** Columns on a south or north edge welded to a fascia are right
  as they are; on an east or west edge give them `angle: 90`.
- **Glazing and walls on the same line fight.** Glass goes on its own line inside the slab edge
  (the fascia is outside it); leave walls for opaque parts.
- **`screenshot` is async** in a live browser: `await` it. A view that has just been created may need
  a moment before it can draw.
- **Ids are unique for good.** Reusing an id (even one removed long ago in the same batch) is refused.
- **Doors and windows need a wall** and an assembly of category `door` / `window` (`catalog assemblies`).
- **One batch, one story's worth of intent.** Very long batches are fine but harder to debug; group
  by building part.

## 8. What is coming (and will be added here)

Doors in glazing, furniture as GLB models, image planes / backdrops, terrain and water — each as a new op. A dedicated MCP server with typed tools will follow for
smaller models.


## 9. Modelling: objects, meshes, shapes (guide topic: modelling)
Model furniture on the `workbench` (alone, at the origin). Objects come from OBJECT CLASSES (`object_classes`; `create_object`), keep their
parameters until their mesh is edited, then are plain meshes; modifiers (`modifier` / `add_modifier`) stack on top without changing the mesh.

**A good asset:** a few cohesive, closed meshes with clean quads that smooth well — NOT a pile of boxes. Details (grooves, panels, recesses,
tufting) are cut INTO the surface with inset / extrude / chamfer. Stripes, wood grain and prints are materials (texgraph), never geometry.
Every real edge is a little round.

**Choosing the start**
- upholstered block, cushion, mattress, cabinet body, tabletop → `roundedbox` (fillet 10–60, filletSegs 3–4): already round, all quads.
- legs, rods, poles → `cylinder` / `roundedcylinder` (sides 12–24); tube frames → `tube`, rings → `torus`, knobs → `sphere`, `capsule`; lettering, signs, house numbers → `text` (`text`, `height` of the capitals mm, `depth` mm, `font` sans / serif / mono, `bold`, `align`; it stands up along x).
- a form with several details (a shell chair, a headboard with channels) → `box` with segments, then `mesh_edit`, then Smooth.
- turned and swept forms (bowls, lamp bases, bent tubes) → a shape + Lathe / Sweep, or the `nurbs` op.

**The subdivision workflow**
1. Low cage: `create_object box {widthSegs …}` — only the cuts the form needs.
2. Shape it: `mesh_edit` move / scale with `bbox` / `normal` selectors, `extrude`, `inset`, `bridge`, `connect` (a loop where the form turns).
3. Hold the edges that must stay crisp: `chamfer {amount 3–8, segments 1}` (support loops), or a `connect` loop close to the edge.
4. `modifier add:'smooth' iterations:2` (1 for big flat parts). Half-symmetric objects: delete one half, `symmetry`.
5. `geometry_qa` → fix every hint → `workbench look` → `workbench save`.

**Shapes (lines)**
- Profiles and paths are SHAPES: `create_object rectangle / circle / arc / …` or `draw_spline` with corner / smooth / bezier knots.
- `Extrude` a plan outline (a tabletop, a shelf with a cut-out), `Lathe` a profile drawn in the front plane (vases, lamp bases, bowls, knobs),
  `Sweep` a section along a path (handles, tube frames, rails, piping, mouldings). Then Smooth, Shell, or `collapse_modifier_stack`.

**Recipes**
- Turned lamp base: `draw_spline {points:[[0,0,0],{pos:[110,0,0],type:'corner'},{pos:[110,0,15],type:'corner'},[40,0,45],[30,0,300],{pos:[50,0,330],type:'corner'},{pos:[0,0,330],type:'corner'}]}` → `Lathe "segs:32"`.
- Bent tube handle: `create_object arc {radius:150, from:0, to:180, plane:'xz'}` → `Sweep "section:circle radius:10"`.
- Channel-tufted headboard: `box {width:1600 height:1000 length:80 widthSegs:8}` → `mesh_edit [{op:'chamfer', level:'edge', selection:{sharp:30}, amount:6}, {op:'select', level:'face', selection:{normal:[0,-1,0], angle:5}}, {op:'inset', level:'face', selection:{current:true}, amount:10, mode:'polygon'}, {op:'extrude', level:'face', selection:{current:true}, amount:35}, {op:'chamfer', level:'edge', selection:{sharp:60}, amount:4}]` → Smooth 2. The chamfers are the support loops.
- Recessed drawer front: `roundedbox` → `mesh_edit [{op:'inset', level:'face', selection:{normal:[0,-1,0]}, amount:20}, {op:'extrude', level:'face', selection:{current:true}, amount:-8}]`.
- Pillow: `roundedbox {fillet: big, filletSegs:4}` → `ffd` / `push` for the puff.

**Pitfalls**
- Ids from `inspect_mesh` are stale after any topology op — chain with `selection:{current:true}` or geometric selectors.
- extrude / inset / bevel need `level:'face'`; chamfer / connect / cap need `level:'edge'`.
- Under Smooth, a box with no support loops turns into a blob; n-gons pinch: `connect` them into quads first.
- `pos` is the bottom centre; `width` is x, `length` is y (depth), `height` is z.

## Sheets that link to views

Any sheet item (`text`, `image`, `rect`) can carry `link`: a board's name (`'Living room'`, `'Plan - floor'`)
or an `https://` address. In Showcase a click or tap opens it (the board slides in, a Back chip returns);
while editing, Ctrl+click. Make buttons from a `rect` (`fill`, `stroke`, `radius`) and a `text` on it,
both with the same link. Names are turned into board ids when the run finishes.

3D views take `fx` for the camera's look: `{ autoEv: true, eye: true }` (measured exposure),
`autoWb: true` (auto white balance), `ev`, `temperature`, `tint`, `contrast`, `saturation`, `vignette`, `bloom`.

## Dressing furniture

`object` takes `materials: { slot: material }` — the assembly's part slots (`catalog assemblies`: e.g. a
Barcelona couch has `frame`, `legs`, `cushion`). `material` takes `tint: '#rrggbb'` to grade a textured
material (`from`) — one leather texture gives cognac, brown, navy and cream.

## Layout sheets with a plan view (classic)

A floor plan can be placed on a layout sheet as a **reference**: its own scale, window, plan type and layers, never
touching the original plan. `view` with `kind: 'layout'` makes the whole sheet — frame, overall dimensions, the title
block (2D elements) and one plan view:

```js
EX3D.run([
  { op: 'view', kind: 'plan', name: 'Venue plan', story: 'story-0' },
  { op: 'view', kind: 'layout', name: 'Venue 1 · layout', source: 'Venue plan',
    crop: [-14600, -12700, 15300, 9500],      // the window, model mm: x0, y0, x1, y1 (a venue)
    ratio: 100,                               // 1:100 (omit = the largest standard scale that fits an A3 sheet)
    paper: 'A3', show: 'plan',                // 'plan' floor plan (no ceiling lights) | 'ceiling' | 'all' (everything)
    layersOff: [],                            // project layer ids hidden in THIS plan view only
    titleBlock: { project: 'EVENTO EN LISBOA', client: 'CLIENTE PRIVADO', drawing: 'PLANO DIAGRAMACIÓN EVENTO',
                  designer: 'APPLETREE', architect: 'Pablo Ferro Serrano', number: 'A-01', scale: '1:100', date: '07/10/2026' } },
]);
```
On any sheet, `items: [{ type: 'planview', at: [x, y], source: 'Venue plan', ratio: 200, crop: [x0, y0, x1, y1], show: 'all', layersOff: [] }]`
puts a plan view; the Properties panel edits scale, plan type, window and layers per reference.

`view` ops take `group: 'Venue 1'` — sheets and views with the same group are listed together under a folding heading in the Sheets panel.
Floor plans draw what hangs above the cut at head height (a mezzanine, its parapet, a soffit) as dotted ghosts; ceilings stay out, and ceiling lights show only in the 'ceiling' and 'all' plan types.
