docs/kitbash.md: Anchors and fits, and the fittings kit (cut plate-fittings-kit)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-12-03 17:37:41 +01:00
commit 9dd543f71d

View file

@ -973,7 +973,7 @@ plates somewhere owns that matrix. The table alone decides the result. A table h
| one solid form | `faces`, `slab`, `sections` or `points` (below) |
| `clad` | `null` or the detail plating (below) |
| `face` | `{at, normal, up, right}`: the face anchors stand on, for a row that is not a slab |
| `fits` | anchors (below) |
| `fits` | anchors and fittings (below) |
`mirror` and `sides` are independent. A two-sided row with one seed, or with no clad, is drawn once, at side +1,
and its `.L` is the mirror of its `.R`: the same facets in the same order, the same cuts and lifts, every face
@ -1058,25 +1058,56 @@ Blender fills a face that crosses itself by where its loop starts, so the same v
from another builder's mesh. Two of the 104 fixture panels do it (bastion's `Hull.Cheek.R` and paladin's
`Thigh.Outer`), and the test names them.
### Anchors
### Anchors and fits
A fit is a frame on the face, at `[a, b]` in the face's (a, b), standing on the face's top: the face, plus
`lifts[0]` where a panel stands on it. Two kinds:
A fit stands on the row's face (a slab's outer face, or the `face` another row names), at `[a, b]` in the face's
(a, b). The face's top is the face, plus `lifts[0]` where a panel stands on it. Up to 64 a row; any other kind is
refused.
Two kinds are anchors, a frame and no geometry:
- `{kind: "mark", id, at, height}`: z is the face's normal and y the table's +z projected off it, so a numeral
stands upright whatever the plate's lean.
- `{kind: "hose_port", name, at, lift}`: z out of the face, y the face's up, `lift` (default 0) further out.
stands upright whatever the plate's lean. On the face's top.
- `{kind: "hose_port", name, at, lift}`: z out of the face, y the face's up, `lift` (default 0) over the top.
`build` returns each as `{kind, name, matrix, mirrored}` (and `height` for a mark). At side -1 the position, normal
and up are mirrored and the frame is made right-handed again (x = y cross z); `mirrored` says so. What stands on
an anchor is its owner's business; the fittings the mech tracks draw on a face (bolt rows, slots, vents, ports,
handles, eyes, louvres, steps) are not fits of this table yet, and any other kind is refused.
an anchor is its owner's business.
Three kinds are fittings, geometry `build` makes:
- `{kind: "part", part, at, roll, lift, params, mat}`: a part of the fittings kit (below) built by `core.build` at
`params` (`"k=v; ..."`, default the part's defaults) and placed by the fit's frame: z the face's normal, y the
face's up, turned `roll` degrees about the normal (default 0, -360 to 360), its origin `lift` (default 0, -1 to
1) over the face's top.
- `{kind: "bolts", inset, spacing, lift, params, mat}`: the kit's `bolt` along a slab's outline. The outline as
drawn (in by the slab's `gap`) is moved in by `inset` + the slab's `taper` (0 to 10; a sharp corner moves at
most that / 0.3); each edge of that ring takes `max(1, int(length / spacing))` bolts, bolt j at
`(j + 0.5) / count` along it. `params` are the bolt's. A rim bolt fastens the plate, not its cladding: the row
stands on the bare face, `lift` (default 0) over it, whatever panel the face carries. Refused on a row that is
no slab, and where the inset leaves nothing of the outline.
- `{kind: "step", outline, at, lift, mat, bolt_mat}`: a raised panel on `outline` (3 to 64 `[a, b]` points, either
winding, about `at`) on the face's top: the clad's panel with inset 0, from 0.02 under the top to `lift` (0 to
1) over it, its far rim chamfered 0.02, a hexagonal bolt of radius 0.028 inside each corner in `bolt_mat`
(default `gunmetal`). Refused under 0.02 m2.
`mat` is the fitting's material, 1 to 63 characters. A part is one material: a fitting of two is two rows at one
place (a slot or a vents row and the `pit` under it; an `access_port` and its `port_bolts`).
At side -1 a fitting's place, normal and up are mirrored, its frame made right-handed and its roll negated, so a
part that is the same across its own x stands as the mirror of side +1's. On a two-sided row drawn once (one seed,
or no clad) the `.L` fittings are the `.R`'s mirrored across x = 0, as its panels are.
Refused, naming the path: a part the kit does not have (its parts are listed); params the part does not have or
outside its bounds, and what the part's shapes refuse at those params (`core`'s message); a `mat` over 63
characters.
### What build returns
One entry per plate built, in the table's order: `name`, `row` (its index), `mat`, `bevel`, `side`,
`solid: (V, faces)`, `facets` (each face's `normal`, `area`, `centre`), `panels: (V, faces)`, `bolts: (V, faces)`,
`anchors`, and `report: {corners, facets, panels, bolts}`. `V` is an (N, 3) float64 array; faces are lists of
`fits: {mat: (V, faces)}` (the row's fittings, merged by material in row order), `anchors`, and
`report: {corners, facets, panels, bolts, fits}`, `fits` the count that stand (a bolts row counts each bolt). `V` is an (N, 3) float64 array; faces are lists of
vertex indices wound outward. `check` returns the table with every default written in. Both are pure functions.
Building the three mech fixtures takes 0.5 to 0.9 s each (23 to 50 plates, medians of 5 on Starfire, Python
@ -1090,7 +1121,8 @@ or two; a name built twice; a number that is not finite; an outline under 3 poin
itself, repeats a point or has zero area; `thick`, `taper`, `back` or `gap` outside 0.001 to 2, 0 to 0.5, 0.1 to
1.5 and 0 to 0.5; a `taper` of half the outline's least width or more; corners that are not a plate; faces that
bound nothing; points in one plane; a pair of seeds on a one-sided row, or no seed; an `up` along the normal; a
fit on a row with no face; an unknown fit kind; two anchors of one name in a row.
fit on a row with no face; an unknown fit kind; two anchors of one name in a row; and what Anchors and fits lists
for a fitting.
### Against the mech tracks' builders
@ -1130,9 +1162,12 @@ Per built entry, N = `prefix` + its name:
host its world matrix is `frame`. A Kit Bevel of the row's `bevel`, angle 12 degrees. ID properties
`plate_kind` = `"hard"` and `kit_plate`: the checked row with `side` and `prefix`, as JSON. `kit_plate` is a
record: its presence admits a rebuild and nothing reads it to decide geometry.
- `N.fit.<clad mat>` holds the panels and `N.fit.<clad bolt_mat>` the bolts: a child mesh per material (one
child when the two are the same material), identity basis, made only when its mesh is not empty. A child that
holds panels carries a Kit Bevel of `clad.bevel`, angle 20 degrees, one segment.
- `N.fit.<clad mat>` holds the panels, `N.fit.<clad bolt_mat>` the bolts and `N.fit.<mat>` each fitting of that
`mat` (a step's corner bolts under its `bolt_mat`): a child mesh per material, the panels, then the bolts,
then the fittings in row order where they share one; identity basis, made only when its mesh is not empty. A
child that holds panels carries a Kit Bevel of `clad.bevel`, angle 20 degrees, one segment, and a fitting of
the panels' material is bevelled with them; any other child carries none. Every material a fit names must be
in the file.
- One empty per anchor, a child of N at the anchor's matrix: `N.mark.<id>` with `kit_anchor`
`{kind, id, height}`, `N.port.<name>` with `kit_anchor` `{kind, name}` (JSON). A port empty is an end
`brokkr_kitbash.hose` takes by name: the hose leaves along its z, out of the face.
@ -1599,7 +1634,7 @@ under such load (five runs), and reading a 336-face part takes 27 to 37 ms.
| `brokkr_kitbash.ribs` | `object_name` (the cage), `ribs_name`, `planes` (a JSON array of 1 to 64 `{origin, normal}`, up to 16000 characters), `standoff`, `depth`, `thickness`, `step`, `holes`, `posts`, `post_r`, `bridge`, `clearance`, `longerons` (a JSON array of 0 to 16 `{origin, axis, toward}`, up to 8000 characters), `longeron`, `longeron_w`, `longeron_h`, `longeron_t` | Derives ribs, lightening holes, posts and longerons from the cage as it is cut, as one mesh object under it. Refuses before it writes anything, naming the plane or longeron. Reports `object`, `ribs`, `thickness`, `sections: [{plane, chains, pieces, length, open}]`, `posts`, `holes`, `longerons: [{index, stations}]` (trimmed to a receipt, with `longeronsOmitted`), `faces`, `volume` and `nonManifoldEdges`. |
| `brokkr_kitbash.shell` | `object_name`, `sheet` (a JSON object `{rings, closed, mirror, creases, rim, flip}`, up to 32000 characters), `thickness`, `offset`, `levels`, `bevel`, `count_folds` | Makes a faceted, hollow armor shell from a loft of rings with crease runs, or rebuilds a shell's cage in place under its cutters and ribs. Refuses before it writes anything, naming the field and index. Reports `object`, `rebuilt`, `rings`, `points`, `cageFaces`, `creases`, `folded` (with `count_folds`, the number of the evaluated wall's inner faces that fold; else null), `corners`, `subdividedFaces`, `facing`, `thickness`, `offset`, `levels` and `children`. |
| `brokkr_kitbash.hose` | `object_name`, `start`, `end`, `count`, `radius`, `spread`, `clearance`, `bend`, `step`, `sag`, `clamps` (a JSON array of up to 8 `{socket}`), `joint` (empty, or a JSON object `{socket, standoff}`) | Routes a bundle of hoses between two sockets around every other mesh, over clamps and through a pin's axis across its roll range; on a hose's name, rebuilds it in place. Reports `length`, `lengthChange`, `clearance`, `radii`, `sag`, `voxels`, `seed`, `rolls`, `worstRoll`, `faces`, `nonManifoldEdges`. |
| `brokkr_kitbash.plates` | `table` (a `brokkr.plates.v0` document, JSON), `host`, `frame` (empty, or a JSON 4x4 of rows), `side`, `prefix` | Writes hard plates: each a mesh on its host with `<plate>.fit.<material>` children for panels and bolts and an empty per anchor; a plate it made is rebuilt in place. Reports `plates` (`name`, `rebuilt`, `corners`, `facets`, `panels`, `bolts`, `anchors`), `host`, `side`. |
| `brokkr_kitbash.plates` | `table` (a `brokkr.plates.v0` document, JSON), `host`, `frame` (empty, or a JSON 4x4 of rows), `side`, `prefix` | Writes hard plates: each a mesh on its host with `<plate>.fit.<material>` children for panels, bolts and fittings and an empty per anchor; a plate it made is rebuilt in place. Reports `plates` (`name`, `rebuilt`, `corners`, `facets`, `panels`, `bolts`, `anchors`), `host`, `side`. |
`params` is `name=value; name=value`; a param left out takes the part's default (`place_part`) or keeps its stored
value (`set_params`). A value outside its bounds is refused with the bounds in the message.
@ -1643,6 +1678,31 @@ The tank's port is 0.4 of its radius across (0.12 m here), so the tee and the no
`pipe_r` and `throat_r`. `set_params` on the tank carries the tee and the nozzle out with its port. The receipts
file holds each report in `hostResult`. `tools/turntable_recipe.py` renders the saved `.blend`.
## The fittings kit
`kits/fittings.v0.json`: nine parts that stand on a hard plate's face, placed by `brokkr_kitbash.plate`'s fit rows
(Hard plates, Anchors and fits). Each stands on +z from z = 0 in its own frame: the origin is the fit's place, z the
face's normal, y the face's up. One material a part and no sockets. The defaults are the mech tracks' sizes.
| part | params | what it is |
| --- | --- | --- |
| `bolt` | `r` | a hex head (r to its corners, 0.7 r tall) on a washer 1.55 r; the bolt of a `bolts` row |
| `slot` | `w`, `h` | the rim of a w by h slot: four bars 0.032 wide, 0.028 tall |
| `pit` | `w`, `h`, `depth`, `count`, `pitch` | the dark box under an opening, `count` of them `pitch` apart along y, centred. Under a slot: depth 0.012. Under vents: depth 0.01, the vents' count, pitch 2.7 h |
| `vents` | `w`, `h`, `count` | `count` louvre lips tilted 28 degrees, 2.7 h apart along y, centred |
| `access_port` | `r` | a turned ring of radius r around a sunk cover with a raised boss, 28 segments |
| `port_bolts` | `r` | the port's eight hex heads on a circle 0.91 r, standing from the ring's shoulder at z 0.035 |
| `handle` | `length`, `lift`, `r` | a bar along y on two posts, bent over at `lift`, a washer and a hex foot under each post. `roll` 90 lays it along the face's a |
| `eye` | `size` | a lifting eye: a pad with two bolts, a neck, and a ring standing in the plane of y and z |
| `louvres` | `w`, `h`, `n`, `depth`, `frame`, `slant` | a framed bank of n slats tilted `slant` degrees about x; `frame` is under w and h |
Each part's points are the tracks' own (`surface.py`'s bolt row, grab handle and lifting eye, `hardplate.py`'s
slot, vents and port, `hardpoint.py`'s louvres) within 2e-8 m, float32 against float64, with two differences the
kit format sets: the handle's bar is a square section of side 2 r, mitred at its bends, where the tracks swept an
octagon; and the eye's pad is a plain box where the tracks' was a rounded outline with a chamfered rim. A handle
whose bar is thick against its bend (`r` over about a quarter of `min(0.4 lift, 0.2 length)`) may fold on the
inside of a turn, and is refused.
## The mechanical kit
`kits/mechanical.v0.json`: thirteen parts, each along +z, with socket types `flange` (equal), `mount` (fits),