docs/kitbash.md: Making a shell

The sheet format with a worked pauldron, the winding rule, crease runs and
rim, what a rebuild keeps, outlines by through cuts, ribs on a shell, the
refusals and the measured costs. The operator count is sixteen.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-12-02 11:37:49 +01:00
commit 09f2ea6a97

View file

@ -1,12 +1,12 @@
# Kitbash parts: machinery from kits
`surfaces/blender/brokkr_kitbash` is a Blender add-on that places parametric machine parts from a **kit**, mates
them **socket** to socket, cuts them with booleans and bakes them. It is the machinery vocabulary of a ship's fixed chassis: the frame, tanks,
them **socket** to socket, cuts them with booleans and bakes them, and makes the faceted armor **shell** they sit under. It is the machinery vocabulary of a ship's fixed chassis: the frame, tanks,
actuators, housings and plumbing an agent assembles offline under a hand-fit armor cage, baked once. It is a host
add-on in Brokkr's sense (`install.md`, "Host add-on actions"), a sibling of `brokkr_mesh_polish` and `brokkr_rig`:
it imports the polish package's operator base, `Refused` and `mesh_object`, and nothing from `brokkr_bridge`.
Enable `brokkr_mesh_polish` first; `brokkr_kitbash` refuses to register without it. `brokkr_actions.json` beside
its `__init__.py` lists the fourteen operators agents may run. Every action writes a JSON report to
its `__init__.py` lists the sixteen operators agents may run. Every action writes a JSON report to
`brokkr_mesh_polish_result`, returned in the receipt's `hostResult`.
Who owns what:
@ -306,9 +306,80 @@ so what is attached to it stays attached and new parts can attach to it, and it
`set_params` refuses it, since the params no longer make the mesh. `exportGltf` with `applyModifiers` already
exports the evaluated mesh; `apply` is for a baked `.blend`.
## Making a shell
`shell` makes an armor plate the way one is modelled by hand: fit a sparse subdivision cage, crease the edges that
are facets' borders, give it a wall, then cut into it. The cage is a **loft**: rings of points with equal counts,
quads between neighbouring rings. The description is a JSON object, `sheet`:
| key | default | what it says |
| --- | --- | --- |
| `rings` | required | 2 to 64 rings of 2 to 64 `[x, y, z]` points in the shell's own frame, equal counts |
| `closed` | `false` | each ring joins back to its first point (a sleeve); not with `mirror` |
| `mirror` | `false` | each ring is authored from its point 0 on x = 0 toward +x and mirrored across x: 2C - 1 points |
| `creases` | `[]` | runs: `{"ring": i, "from": a, "to": b, "weight": w}`, `{"column": j, "from": a, "to": b, "weight": w}`, `{"point": [i, j], "weight": w}` |
| `rim` | `1` | the weight of every boundary edge no run names |
| `flip` | `false` | reverse every face |
**Winding.** Quad (i, j) is `P[i][j], P[i][j+1], P[i+1][j+1], P[i+1][j]`: the surface faces out where, seen from
outside, a ring's points run left to right and the rings run upward. If the report's `facing` (the cage's mean
normal) points into the machine, set `flip` or author the rings the other way. Outward matters: the wall grows
inward from the designed surface (`offset` -1), `cut` rays must meet the outer face, and `ribs` stands on the
side the normals face away from.
**Creases.** A ring run creases ring `i`'s edges from point `from` to point `to`; a column run creases column
`j`'s edges from ring `from` to ring `to`; a point is one vertex. A weight of 1 is a hard facet edge, and lower
weights are semi-sharp: on the pauldron below, 1.0 holds 52 degrees across the shoulder line and 0.6 holds 35,
while every edge that carries no crease stays under 6. Runs are partial on purpose: a facet edge that dies out
halfway along a plate is a run that stops there. An edge has one weight; two runs that give it different ones are
refused, naming both. On a mirrored sheet a run names authored indices and lands on both halves, and a ring run
from point 0 joins across the middle. `rim` 1 keeps the outline as drawn, corners included; with `rim` 0 the
outline rounds between the corners, which stay (the Subdivision preserves them).
```json
{"action": "brokkr_kitbash.shell", "object_name": "Pauldron", "thickness": 0.06, "bevel": 0.004,
"sheet": "{\"flip\": true, \"creases\": [{\"column\": 3, \"from\": 0, \"to\": 5, \"weight\": 1.0}], \"rings\": [[[0.47, -1.35, 1.02], [-0.17, -1.35, 1.28], [-0.77, -1.35, 1.15], [-1.15, -1.35, 0.85], [-1.32, -1.35, 0.26], [-1.4, -1.35, -0.3]], ...]}"}
```
Six rings of six points run aft to fore; each goes over the crown from inboard and down the outer face, and
column 3, the shoulder line, is creased, so the crown and the steep outer face are two facets of one plate. Ring 2
dips: the plate is concave there, which no convex hull can be.
The object carries the cage, `crease_edge` and `crease_vert`, and the modifiers `Kit Subsurf` (`levels`, creases
used) then `Kit Solidify` (`thickness`, `offset`, even, rim filled), then any Booleans `cut` adds, then the `Kit
Bevel` when `bevel` is over 0. `kit_shell` on it is the request, and it owns the cage as `kit_params` owns a
part's mesh: an edit of the cage by hand is lost at the next `shell` call. `shell` reports `object`, `rebuilt`,
`rings`, `points`, `cageFaces`, `creases` (edges with a weight over 0), `corners`, `subdividedFaces`, `facing`,
`thickness`, `offset`, `levels` and `children`, all facts of the cage: it reads no evaluated mesh.
**Rebuilding.** `shell` on a name that is already a shell rewrites its cage in place. The object, its mesh
datablock, its material slots, its cutters, its ribs and its Booleans stay, so a plate can be reshaped after it is
cut. Cutters stay at their frames in the shell's frame: where the surface moved away from a cutter the cut is
shallower or floats, so raise the cutter's `lift` or `depth` (`set_params`), or cut again. Ribs are a bake: after a
rebuild, delete them and run `ribs` again. A name that is some other object is refused, as are a scaled shell and
one that shares its mesh.
**Outlines.** A loft's outline is its first and last rings and its end columns. Notches and tabs in it are
through cuts at the rim: a `box` or `slot` cutter deeper than the wall, placed across the edge, takes a bite out of
the outline, and the plate left between two bites is a tab.
**With ribs.** `ribs` reads the plate's thickness from `Kit Solidify` and follows a crease, clipping a rib inside
it; a rib deeper than the room a tight crease leaves is refused with the size to lower.
Refused, each before anything is written and naming the field and index: a missing or unknown key; a non-finite
number; fewer than 2 or more than 64 rings or points; rings of unequal counts; a quad under 1e-8 m2 (a collapsed
corner); a mirrored ring that does not start on x = 0 or has a point behind it; `mirror` with `closed`; a run out
of range or with `from` not under `to`; a weight outside 0 to 1; more than 262144 subdivided faces (cage quads
times 4 to the `levels`).
On the pauldron (25 cage quads, 1600 subdivided faces, 3360 with the wall), `shell` took 3.5 ms a call with
Blender's own update after it, and one whole evaluation of the Subdivision and Solidify 1.7 ms. With six cutters
(four panel lines, two insets) and ribs under it, a rebuild took 0.92 s, which is its one Boolean evaluation.
Medians of 3, interleaved, Blender 5.3 on Starfire (`tests/live/kitbash_faceted.py`, `costs`).
## Cutting a shell
An armor plate is not a kit part: it is any mesh, usually a subdivided cage with a Solidify. `cut` cuts it, or a
An armor plate is not a kit part: it is any mesh, usually one made by `shell`. `cut` cuts it, or a
kit part, where a ray meets it, and what it places is itself a kit part, of the kit `cutters`:
| part | params (besides `depth`, `lift`) | socket |
@ -498,6 +569,7 @@ vertices overflow.
| `brokkr_kitbash.cut_many` | `object_name` (any mesh), `cuts` (a JSON array of 1 to 64 cutters) | `cut` for several cutters in one action: all placed or none, one evaluation of the target afterwards. Reports `object`, `cutters` (names) and `booleans` (with `booleansOmitted`, as `boolean`). |
| `brokkr_kitbash.apply` | `object_name` | Bakes the evaluated mesh into the kit part and clears its modifiers and the collections its Booleans held. Refuses a part with no modifiers, a mesh another object shares and a part Blender does not evaluate. Reports the part, `faces`, `volume`, `nonManifoldEdges` and the `cutters` it no longer refers to. |
| `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` | 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`, `corners`, `subdividedFaces`, `facing`, `thickness`, `offset`, `levels` and `children`. |
`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.