brokkr_kitbash.plate: clad carries bolt_mat and bevel (cut hard-plate-action)

check writes the defaults in (gunmetal, 0.012) and bounds them; build draws nothing from either.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-12-03 16:03:25 +01:00
commit 40232be787
3 changed files with 21 additions and 1 deletions

View file

@ -170,7 +170,7 @@ def _check_slab(slab: Any, path: str) -> dict:
def _check_clad(clad: Any, row: dict, path: str) -> dict:
_object(clad, path, ("mat", "min_area", "lifts", "inset", "gap", "split", "seed"), ("facets", "floor", "bolt_r"))
_object(clad, path, ("mat", "min_area", "lifts", "inset", "gap", "split", "seed"), ("facets", "floor", "bolt_r", "bolt_mat", "bevel"))
out = {"mat": _name(clad["mat"], f"{path}.mat", 63, None)}
facets = clad.get("facets", "outer" if "slab" in row else None)
if facets is None:
@ -217,6 +217,8 @@ def _check_clad(clad: Any, row: dict, path: str) -> dict:
raise PlateError(f"{path}.seed: wants an integer or [right, left]")
out["seed"] = seed
out["bolt_r"] = _number(clad.get("bolt_r", BOLT), f"{path}.bolt_r", 0.001, 1.0)
out["bolt_mat"] = _name(clad.get("bolt_mat", "gunmetal"), f"{path}.bolt_mat", 63, None) # carried, as row bevel is: build draws nothing from these two
out["bevel"] = _number(clad.get("bevel", 0.012), f"{path}.bevel", 0.0, 0.05)
return out

View file

@ -937,6 +937,8 @@ first.
| `split` | a facet over this area is cut in two |
| `seed` | an integer, or `[right, left]` on a row with `sides: "both"`. There is no default. One integer on a two-sided row makes a mirrored pair; a pair of seeds draws each side on its own solid, also where the two are equal. |
| `bolt_r` | a bolt's corner radius (default 0.028) |
| `bolt_mat` | the bolts' material, 1 to 63 characters (default `gunmetal`). Carried: `build` draws nothing from it; `brokkr_kitbash.plates` reads it |
| `bevel` | the width of the panels' Bevel, 0 to 0.05 (default 0.012). Carried, as the row's `bevel` is |
One `random.Random(seed)` draws, in facet order. A chosen facet over `split` is cut across its longest edge at a
share drawn from 0.36 to 0.64 of that edge, the two parts `gap` apart; edges within 1e-9 m of the longest tie and

View file

@ -101,8 +101,24 @@ class CheckTests(unittest.TestCase):
slab = table["plates"][0]["slab"]
self.assertEqual((slab["taper"], slab["back"], slab["gap"], slab["up"]), (0.04, 1.0, 0.0, [0.0, 0.0, 1.0]))
self.assertEqual((table["plates"][0]["sides"], table["plates"][0]["mirror"], table["plates"][0]["clad"]["facets"], table["plates"][0]["clad"]["bolt_r"]), ("one", False, "outer", 0.028))
self.assertEqual((table["plates"][0]["clad"]["bolt_mat"], table["plates"][0]["clad"]["bevel"]), ("gunmetal", 0.012))
self.assertEqual(plate.check(table), table)
def test_clad_carries_its_bolt_material_and_panel_bevel(self):
"""Carried and never drawn from: a table that states them builds what one that leaves them out builds."""
stated = plate.check(doc(row(slab=SLAB, clad=dict(CLAD, bolt_mat="steel", bevel=0.009))))
self.assertEqual((stated["plates"][0]["clad"]["bolt_mat"], stated["plates"][0]["clad"]["bevel"]), ("steel", 0.009))
ours, theirs = plate.build(stated)[0], plate.build(doc(row(slab=SLAB, clad=CLAD)))[0]
for key in ("solid", "panels", "bolts"):
self.assertTrue(np.array_equal(ours[key][0], theirs[key][0]) and ours[key][1] == theirs[key][1], key)
for value in (0.0, 0.05):
plate.check(doc(row(slab=SLAB, clad=dict(CLAD, bevel=value))))
plate.check(doc(row(slab=SLAB, clad=dict(CLAD, bolt_mat="m" * 63))))
for bad in (-0.001, 0.0501, "0.01", None, True):
self.refused(doc(row(slab=SLAB, clad=dict(CLAD, bevel=bad))), "plates[0].clad.bevel")
for bad in ("", "m" * 64, 3, None):
self.refused(doc(row(slab=SLAB, clad=dict(CLAD, bolt_mat=bad))), "plates[0].clad.bolt_mat")
def test_schema(self):
self.refused({"schema": "brokkr.plates.v1", "plates": [row()]}, "document.schema")