brokkr_kitbash: the shell-cuts Lows: evaluable, fitted receipts, slot floors at the round ends, live checks that name what died

evaluable refuses, before any write, an object the evaluated depsgraph does not hold (disabled in viewports
with nothing depending on it, or in a collection outside the view layer): boolean, cut, cut_many and apply
call it. fitted trims a report's rows to a receipt and counts the rest in <key>Omitted: scene_closures, cut,
cut_many and boolean use it, so place_cutters loses its report hook and cut_many its refusal of a long report.
The slot's floor_l and floor_r move to the centres of its round ends, sized so the three never overlap.

kitbash_shell.py runs inside one try: an uncaught error is a failed check naming its section and the result
file is always written. It pins M1, M3, M6, M7, M16, hidden and unlinked targets, and trimmed receipts.
docs: like-for-like cost (13 cutters: cut_many 6.1 s, 13 cuts 51.3 s, 105 s with hides).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-12-02 05:56:08 +01:00
commit cc98d36f4e
7 changed files with 554 additions and 322 deletions

View file

@ -315,7 +315,7 @@ kit part, where a ray meets it, and what it places is itself a kit part, of the
| --- | --- | --- |
| `box` | `width` (x), `height` (y), `count`, `pitch` | `floor` (mount, size the smaller side) |
| `cyl` | `r`, `count`, `pitch` | `floor` (mount, size `2*r`) |
| `slot` | `width` (x, end to end), `height` (across; less than `width`), `count`, `pitch` | `floor`, `floor_l`, `floor_r` (mount, size `height`) |
| `slot` | `width` (x, end to end), `height` (across; less than `width`), `count`, `pitch` | `floor`, `floor_l`, `floor_r` (mount, size the smaller of `height` and `(width-height)/2`) |
| `slab` | `gap` (x), `length` (y) | none |
A cutter's frame has its origin where the ray met the surface, `z` along the surface normal (turned to face
@ -341,8 +341,9 @@ resizes it, and deleting the cutter removes the cut. `cut` does not hide the cut
and a hidden cutter still cuts.
`box`, `cyl` and `slot` carry a socket, `floor`: on the bottom of the recess at `z = -depth`, at the frame's
centre, facing out of the recess. A `slot` carries two more on the same floor, `floor_l` and `floor_r`, a third
of its width to each side: a visor with three eyes. Machinery attaches there with the ordinary `attach` (a vent's `back`, a
centre, facing out of the recess. A `slot` carries two more on the same floor, `floor_l` and `floor_r`, at the
centres of its two round ends, `(width-height)/2` to each side: a visor with three eyes. The three are sized so
that neighbours never overlap and none passes the slot's ends. Machinery attaches there with the ordinary `attach` (a vent's `back`, a
sensor's `mount`), is a child of the cutter, and so follows the cut when the cutter moves and is seated again
when `set_params` changes its `depth`. With an even `count` and a `pitch` wider than the copies, the centre lies
between the two middle copies: use an odd count, or a cutter of its own, for a recess that carries a part. A
@ -354,11 +355,20 @@ every action, so each `cut` costs one Boolean evaluation of the target: on the s
cutter to eight. `cut_many` takes a JSON array of cutters (`name`, `part`, `origin`, `direction`, and optionally
`params`, `up`, `roll`, `axis`), checks them all and casts every ray before it writes anything, places all of
them or none, and costs one evaluation for the lot. On a pod with a Bevel under the Boolean (6500 faces once
cut; one evaluation 5.2 s), 13 cutters placed by one `cut_many` took 4.9 s, and 15 placed by 15 `cut` actions
took 113 s; the same cuts as one joined cutter, evaluated once and baked, took 4.6 s (Blender 5.3 on Starfire).
Any later action that changes the target or a cutter (hiding the cutters, attaching a part to a floor) costs an
evaluation again while the target is visible. `cut_many` reports `{object, cutters, booleans}` with the cutters
by name.
cut), the same 13 cutters took 6.1 s placed by one `cut_many` and 51.3 s placed by 13 `cut` actions, about 8
times as long (medians of 3, Blender 5.3 on Starfire); hiding each cutter after its `cut` is a second evaluation
each and brought the 13 to 105 s. Any later action that changes the target or a cutter (hiding the cutters,
attaching a part to a floor) costs an evaluation again while the target is visible. `cut_many` reports
`{object, cutters, booleans}` with the cutters by name.
`booleans` in a report of `cut`, `cut_many` or `boolean` is trimmed to what a receipt carries: on a target with
more cutters than fit (about 150 of long names), the rows left off the end are counted in `booleansOmitted`. The
scene keeps every cutter; the target's `Kit` modifier collections list them.
`cut`, `cut_many`, `boolean` and `apply` evaluate their object, and refuse one Blender does not evaluate in the
view layer: an object disabled in viewports that nothing evaluated depends on, or one whose collections no view
layer shows. A disabled object that an evaluated object needs (a parent of one, a cutter of one) is evaluated
all the same, and is cut.
## Expressions
@ -388,10 +398,10 @@ vertices overflow.
| `brokkr_kitbash.aim` | `object_name`, `axis` (`+x`, `-x`, `+y`, `-y`, `+z` or `-z`, the part's own), `direction_x`, `direction_y`, `direction_z` (world, any length) | Solves the roll that turns the axis as far toward the direction as the pin lets it, and turns the part to it. Refuses an axis or direction along the pin. Reports the part, `aimed: {roll, dot}` and `closures`. |
| `brokkr_kitbash.reach` | `object_name`, `socket` (one of the part's), `height` (metres, -1000 to 1000), `direction_x`, `direction_y`, `direction_z` (world; default 0, 0, 1) | Solves the roll that brings the socket's origin to `height` along the direction, the nearer of the two, and turns the part to it. Refuses a height out of reach, naming the range. Reports the part, `reached: {roll, residual}` and `closures`. |
| `brokkr_kitbash.close` | `object_name` (the closing part), `socket`, `other_name`, `other_socket` | States that the closing part's socket meets the other part's, closing a loop. Accepted only when they already meet; moves nothing. Reports the closing part. |
| `brokkr_kitbash.boolean` | `object_name` (any mesh), `cutter`, `operation` (`DIFFERENCE`, `UNION` or `INTERSECT`; default `DIFFERENCE`) | Adds the cutter to the collection of the target's one live Exact Boolean for the operation, above the Bevel. Refuses a cutter that is the target, is not a mesh, or already cuts it, and a scaled target. Reports the part (or `object` for a mesh that is not one), `booleans: [{cutter, operation}]` (difference, union, intersect; each in the order added) and `evaluated`. |
| `brokkr_kitbash.cut` | `object_name` (any mesh), `cutter_name`, `part` (`box`, `cyl`, `slot`, `slab`), `params`, `origin_x/y/z`, `direction_x/y/z`, `up_x/y/z` (default 0, 0, 1), `roll` (degrees, default 0), `axis_x/y/z` (default 0, 0, 0: the surface normal) | Places a `cutters` part where the ray meets the target, parented to it, and adds it to the target's difference Boolean. Refuses a ray that misses or has no direction, a name an object has, an `up` along the cutter's axis, an `axis` into the surface and a scaled target. Reports `object`, the `cutter` with its floor sockets, and `booleans`. |
| `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`. |
| `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 and a mesh another object shares. Reports the part, `faces`, `volume`, `nonManifoldEdges` and the `cutters` it no longer refers to. |
| `brokkr_kitbash.boolean` | `object_name` (any mesh), `cutter`, `operation` (`DIFFERENCE`, `UNION` or `INTERSECT`; default `DIFFERENCE`) | Adds the cutter to the collection of the target's one live Exact Boolean for the operation, above the Bevel. Refuses a cutter that is the target, is not a mesh, or already cuts it, and a scaled target. Reports the part (or `object` for a mesh that is not one), `booleans: [{cutter, operation}]` (difference, union, intersect; each in the order added; `booleansOmitted` counts rows a receipt had no room for) and `evaluated`. |
| `brokkr_kitbash.cut` | `object_name` (any mesh), `cutter_name`, `part` (`box`, `cyl`, `slot`, `slab`), `params`, `origin_x/y/z`, `direction_x/y/z`, `up_x/y/z` (default 0, 0, 1), `roll` (degrees, default 0), `axis_x/y/z` (default 0, 0, 0: the surface normal) | Places a `cutters` part where the ray meets the target, parented to it, and adds it to the target's difference Boolean. Refuses a ray that misses or has no direction, a name an object has, an `up` along the cutter's axis, an `axis` into the surface and a scaled target. Reports `object`, the `cutter` with its floor sockets, and `booleans` (with `booleansOmitted`, as `boolean`). |
| `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. |
`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.