live kitbash: the frame kit's nine parts placed, a truss re-parameterised in place, a box_beam seated on a mechanical bracket
Blender 5.3.0 background, private user dirs: kitbash 91 checks, kitbash_assembly 118, kitbash_pose 46, kitbash_ribs 49, kitbash_shell 82, kitbash_faceted 34, all ok; only kitbash's result file changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
2d990bf2ea
commit
5bf992ab70
2 changed files with 176 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
"""Live proof, in a background Blender, that the brokkr_kitbash rows are admitted by Brokkr as host actions and that
|
||||
the mechanical kit goes through run_intent: describe, place_part for all eleven parts, setObjectTransform,
|
||||
assignMaterial, set_params, report, the refusals, and exportGltf. Not part of the unittest run: it needs Blender.
|
||||
assignMaterial, set_params, report, the refusals, the frame kit's nine parts (placed, a truss re-parameterised, a beam
|
||||
seated on a mechanical bracket), and exportGltf. Not part of the unittest run: it needs Blender.
|
||||
|
||||
blender --background --factory-startup --python-exit-code 1 --python surfaces/blender/tests/live/kitbash.py -- <out>
|
||||
|
||||
|
|
@ -253,6 +254,46 @@ try:
|
|||
receipt, whole = send("brokkr_kitbash.report")
|
||||
check("with scale back at 1 every part reports again", receipt["status"] == "accepted" and whole and len(whole["parts"]) == 11, receipt["message"])
|
||||
|
||||
# --- the frame kit: every shell an extrude, a section swept along a path --------------------------------------------------
|
||||
frame = core.load_kit("frame")
|
||||
receipt, described = send("brokkr_kitbash.describe", kit="frame")
|
||||
check("describe of the frame kit lists its nine parts, whole", receipt["status"] == "accepted" and described
|
||||
and [p["name"] for p in described["parts"]] == list(frame["parts"]) and len(described["parts"]) == 9 and "[truncated]" not in receipt["hostResult"],
|
||||
[receipt["message"], len(receipt.get("hostResult") or "")])
|
||||
R["frame"] = {}
|
||||
for name, part in frame["parts"].items():
|
||||
receipt, report = send("brokkr_kitbash.place_part", kit="frame", part=name, object_name=f"F_{name}")
|
||||
obj = bpy.data.objects.get(f"F_{name}")
|
||||
reference = core.build(part)
|
||||
faces = len(obj.data.polygons) if obj else -1
|
||||
flat = np.zeros(max(faces, 0), dtype=bool)
|
||||
if obj:
|
||||
obj.data.attributes["sharp_face"].data.foreach_get("value", flat)
|
||||
check(f"place_part frame {name}: core's faces, shells and vertices, a valid mesh, every face flat, no Bevel, sockets in the part frame",
|
||||
receipt["status"] == "accepted" and report and obj is not None and faces == len(reference.counts) == report["faces"]
|
||||
and report["shells"] == reference.shell_count and not obj.data.validate(verbose=False) and bool(flat.all())
|
||||
and np.allclose(np.array([v.co[:] for v in obj.data.vertices]), reference.V, atol=1e-6) and obj.modifiers.get("Kit Bevel") is None
|
||||
and (obj["kit_kit"], obj["kit_part"]) == ("frame", name) and report["sockets"] == core.socket_rows(reference.sockets),
|
||||
[receipt["message"], faces, len(reference.counts)])
|
||||
R["frame"][name] = {"faces": faces, "shells": reference.shell_count, "sockets": [s["name"] for s in reference.sockets]}
|
||||
truss = bpy.data.objects["F_truss"]
|
||||
truss_mesh = truss.data.name
|
||||
receipt, report = send("brokkr_kitbash.set_params", object_name="F_truss", params="pairs=6")
|
||||
reference = core.build(frame["parts"]["truss"], {"pairs": 6})
|
||||
check("set_params pairs=6 rebuilds the truss in place: 27 shells of core's faces on the same object and mesh", receipt["status"] == "accepted" and report
|
||||
and report["shells"] == reference.shell_count == 27 and len(truss.data.polygons) == len(reference.counts) == report["faces"]
|
||||
and bpy.data.objects.get("F_truss") == truss and truss.data.name == truss_mesh and report["params"]["pairs"] == 6
|
||||
and np.allclose(np.array([v.co[:] for v in truss.data.vertices]), reference.V, atol=1e-6), [receipt["message"], report])
|
||||
receipt, report = send("brokkr_kitbash.attach", object_name="F_box_beam", socket="end_a", parent_name="P_bracket", parent_socket="mount")
|
||||
beam, bracket = bpy.data.objects["F_box_beam"], bpy.data.objects["P_bracket"]
|
||||
seat = np.array(bracket.matrix_world) @ np.array(core.build(kit["parts"]["bracket"], json.loads(bracket["kit_params"])).sockets[0]["matrix"])
|
||||
end = np.array(beam.matrix_world) @ np.array(core.build(frame["parts"]["box_beam"]).sockets[0]["matrix"])
|
||||
# the connection holds within HELD, 1e-5 m, the rule attach and close share (tests/live/kitbash_assembly.py)
|
||||
check("a frame box_beam's end_a seats on a mechanical bracket's mount across the two kits, and holds", receipt["status"] == "accepted" and report
|
||||
and beam.parent == bracket and report["connection"]["holds"] is True and report["connection"]["residual"] <= 1e-5
|
||||
and float(np.abs(seat[:3, 3] - end[:3, 3]).max()) < 1e-5 and float(np.abs(seat[:3, 2] + end[:3, 2]).max()) < 1e-5,
|
||||
[receipt["message"], report and report.get("connection")])
|
||||
|
||||
# --- export ---------------------------------------------------------------------------------------------------------------
|
||||
receipt, _ = send("exportGltf", filepath="kit.glb", extras=False, yUp=True, applyModifiers=True, selection=[f"P_{n}" for n in names])
|
||||
glb = WORK / "kit.glb"
|
||||
|
|
|
|||
|
|
@ -391,6 +391,66 @@
|
|||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "describe of the frame kit lists its nine parts, whole",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "place_part frame beam_i: core's faces, shells and vertices, a valid mesh, every face flat, no Bevel, sockets in the part frame",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "place_part frame channel: core's faces, shells and vertices, a valid mesh, every face flat, no Bevel, sockets in the part frame",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "place_part frame tee: core's faces, shells and vertices, a valid mesh, every face flat, no Bevel, sockets in the part frame",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "place_part frame angle: core's faces, shells and vertices, a valid mesh, every face flat, no Bevel, sockets in the part frame",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "place_part frame box_beam: core's faces, shells and vertices, a valid mesh, every face flat, no Bevel, sockets in the part frame",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "place_part frame truss: core's faces, shells and vertices, a valid mesh, every face flat, no Bevel, sockets in the part frame",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "place_part frame portal: core's faces, shells and vertices, a valid mesh, every face flat, no Bevel, sockets in the part frame",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "place_part frame gusset: core's faces, shells and vertices, a valid mesh, every face flat, no Bevel, sockets in the part frame",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "place_part frame wedge: core's faces, shells and vertices, a valid mesh, every face flat, no Bevel, sockets in the part frame",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "set_params pairs=6 rebuilds the truss in place: 27 shells of core's faces on the same object and mesh",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a frame box_beam's end_a seats on a mechanical bracket's mount across the two kits, and holds",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "exportGltf of all eleven parts succeeds",
|
||||
"ok": true,
|
||||
|
|
@ -423,6 +483,80 @@
|
|||
"brokkr_kitbash.ribs",
|
||||
"brokkr_kitbash.shell"
|
||||
],
|
||||
"frame": {
|
||||
"beam_i": {
|
||||
"faces": 14,
|
||||
"shells": 1,
|
||||
"sockets": [
|
||||
"end_a",
|
||||
"end_b"
|
||||
]
|
||||
},
|
||||
"channel": {
|
||||
"faces": 10,
|
||||
"shells": 1,
|
||||
"sockets": [
|
||||
"end_a",
|
||||
"end_b"
|
||||
]
|
||||
},
|
||||
"tee": {
|
||||
"faces": 10,
|
||||
"shells": 1,
|
||||
"sockets": [
|
||||
"end_a",
|
||||
"end_b"
|
||||
]
|
||||
},
|
||||
"angle": {
|
||||
"faces": 8,
|
||||
"shells": 1,
|
||||
"sockets": [
|
||||
"end_a",
|
||||
"end_b"
|
||||
]
|
||||
},
|
||||
"box_beam": {
|
||||
"faces": 6,
|
||||
"shells": 1,
|
||||
"sockets": [
|
||||
"end_a",
|
||||
"end_b"
|
||||
]
|
||||
},
|
||||
"truss": {
|
||||
"faces": 114,
|
||||
"shells": 19,
|
||||
"sockets": [
|
||||
"end_a",
|
||||
"end_b"
|
||||
]
|
||||
},
|
||||
"portal": {
|
||||
"faces": 38,
|
||||
"shells": 1,
|
||||
"sockets": [
|
||||
"foot_a",
|
||||
"foot_b"
|
||||
]
|
||||
},
|
||||
"gusset": {
|
||||
"faces": 7,
|
||||
"shells": 1,
|
||||
"sockets": [
|
||||
"leg_a",
|
||||
"leg_b"
|
||||
]
|
||||
},
|
||||
"wedge": {
|
||||
"faces": 6,
|
||||
"shells": 1,
|
||||
"sockets": [
|
||||
"base",
|
||||
"back"
|
||||
]
|
||||
}
|
||||
},
|
||||
"placed": {
|
||||
"nozzle": {
|
||||
"faces": 994,
|
||||
|
|
|
|||
Loading…
Reference in a new issue