brokkr_kitbash: a closure on a deleted, unlinked, scaled or doubly held part reads broken, with a reason

Fixes the findings of verdict cut-kit-joints.s1.

closure() reads the other part as gone when the pointer is empty or the object
is in no collection: the pointer itself keeps a part deleted with the Delete
operator in the file as an orphan, and the closure read it as holding. close
refuses a part in no collection, and an orphaned closing part holds no socket.

A closure's report gains reason, null when it holds: the other part is gone
(to null); it cannot be read against (scaled by hand, not a kit part, of
another kit; to names it); another part's closure names the same socket, as a
duplicated closing part leaves, and then neither holds; or the sockets stand
apart.

set_params lists the closures its own part is an end of first, then the
broken, then the rest, and leaves rows off the end when a receipt is full. It
reads each kit file once per report: 3.9 s to 0.39 s at 150 closures, 12.8 s
to 1.16 s at 450 (the cost was linear, two kit parses a closure).

kitbash_assembly.py: close of a brace moved 3.2e-4 is refused, a receipt with
room for one row keeps the opened closure and counts the other, and the
unlink, Delete, scale and duplicate cases.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-12-01 20:15:01 +01:00
commit 13ba0d05ac
4 changed files with 215 additions and 50 deletions

View file

@ -95,9 +95,10 @@ def sync_bevel(obj, width: float) -> None:
RIGID = 1e-5 # how far a world matrix's 3x3 may stand from a rotation
def kit_part_of(obj):
def kit_part_of(obj, kits=None):
"""(part, stored params) of a placed part, read from its ID properties. Refuses a part whose world transform is
not rigid: its socket frames would not be frames, and its size would have a second owner."""
not rigid: its socket frames would not be frames, and its size would have a second owner. `kits` is a dict one
call may pass to read each kit file once while it reads many parts; nothing keeps it between calls."""
if PART not in obj:
raise Refused(f"{obj.name!r} is not a kit part (it has no {PART} property); place_part makes one.")
turn = np.array(obj.matrix_world)[:3, :3]
@ -111,12 +112,15 @@ def kit_part_of(obj):
stored = None
if not isinstance(stored, dict):
raise Refused(f"{obj.name!r} has a {PARAMS} property that is not a JSON object.")
return core.part(core.load_kit(str(obj.get(KIT, ""))), str(obj[PART])), stored
name, kits = str(obj.get(KIT, "")), {} if kits is None else kits
if name not in kits:
kits[name] = core.load_kit(name)
return core.part(kits[name], str(obj[PART])), stored
def built_part(obj):
def built_part(obj, kits=None):
"""(part, the part built at the object's stored params): where its sockets are, baked or not."""
part, stored = kit_part_of(obj)
part, stored = kit_part_of(obj, kits)
return part, core.build(part, stored)
@ -137,17 +141,27 @@ def attached(obj) -> list:
def closure(obj):
"""The closure a part states, (its socket, the other part or None, the other part's socket), or None. The
other part is a pointer: it follows a rename and reads None once the part is deleted. close, set_params,
detach and every report read it here."""
other part is a pointer: it follows a rename. It reads None once the part is gone, which is when the pointer is
empty or the object is in no collection: the pointer itself keeps a deleted object in the file as an orphan.
close, set_params, detach and every report read it here."""
if CLOSE not in obj:
return None
other = obj.get(CLOSE_TO)
return str(obj[CLOSE]), other if isinstance(other, bpy.types.Object) else None, str(obj.get(CLOSE_TO_SOCKET, ""))
return str(obj[CLOSE]), other if isinstance(other, bpy.types.Object) and other.users_collection else None, str(obj.get(CLOSE_TO_SOCKET, ""))
def closers() -> dict:
"""{(part, socket): [the parts in the scene whose closure names that socket]}, from one pass over the objects."""
found = {}
for obj in bpy.data.objects:
if CLOSE in obj and obj.users_collection and closure(obj)[1] is not None:
found.setdefault((closure(obj)[1], closure(obj)[2]), []).append(obj)
return found
def closing_on(part) -> list:
"""The parts whose closure names this one."""
return [obj for obj in bpy.data.objects if CLOSE in obj and obj.get(CLOSE_TO) == part]
return [obj for (other, _), found in closers().items() if other == part for obj in found]
def occupant(part, socket: str):
@ -161,9 +175,8 @@ def occupant(part, socket: str):
return part.parent.name if part.parent else part.name
if part.get(CLOSE) == socket:
return closure(part)[1].name if closure(part)[1] else part.name
for other in closing_on(part):
if other.get(CLOSE_TO_SOCKET) == socket:
return other.name
for other in closers().get((part, socket), []):
return other.name
return None
@ -218,46 +231,56 @@ def connection_report(obj, part, built):
return row
def closure_report(obj, part, built):
"""None for a part that states no closure, else what it states and whether it holds: the other part is a kit
part of the same kit, both sockets exist, and the two stand within HELD of meeting (core.closure_residual).
`to` is null when the other part is gone or is not a part of this kit. Derived at each report; stored nowhere."""
def closure_report(obj, part, built, held=None, kits=None):
"""None for a part that states no closure, else what it states, whether it holds and, when it does not, why
not: the other part is gone (`to` null); it is not a part this one can be read against (not a kit part, of
another kit, scaled, or without that socket); another part's closure names the same socket (a duplicated
closing part); or the two sockets stand more than HELD from meeting (core.closure_residual). Derived at each
report; stored nowhere. `held` is closers() and `kits` kit_part_of's, for a caller that reports many."""
stated = closure(obj)
if stated is None:
return None
row = {"to": None, "socket": stated[0], "toSocket": stated[2], "residual": None, "holds": False}
row = {"to": None, "socket": stated[0], "toSocket": stated[2], "residual": None, "holds": False, "reason": None}
if stated[1] is None:
row["reason"] = "the part it closed on is gone: deleted, or in no collection"
return row
row["to"] = stated[1].name
try:
if stated[1] is None:
return row
other_part, other_built = built_part(stated[1])
if other_part["kit"] != part["kit"]:
return row
row["to"] = stated[1].name
other_part, other_built = built_part(stated[1], kits)
there, here = core.joint(other_part, other_built, stated[2], part, built, stated[0])
except (Refused, core.KitError):
except (Refused, core.KitError) as error:
row["reason"] = str(error)
return row
row["residual"] = round(core.closure_residual(stated[1].matrix_world, there, obj.matrix_world, here), 9)
row["holds"] = bool(row["residual"] <= HELD)
rivals = [o.name for o in (closers() if held is None else held).get((stated[1], stated[2]), []) if o != obj]
if rivals:
row["reason"] = f"socket {stated[2]!r} of {stated[1].name!r} is also closed on by {rivals[0]!r}: one of them was copied; detach one"
elif row["residual"] > HELD:
row["reason"] = f"the two sockets stand {row['residual']:.6g} m apart"
row["holds"] = row["reason"] is None
return row
def scene_closures(context, report: dict) -> list:
"""Every closure stated in the scene as {part, to, holds}, by part name, for a set_params report: a change of
params can open a closure anywhere below the part. Rows are left out, and counted in closuresOmitted, once
the report would pass what a receipt carries."""
rows, size = [], len(json.dumps(report, separators=(",", ":"))) + 40
for obj in sorted((o for o in context.scene.objects if o.type == "MESH" and CLOSE in o), key=lambda o: o.name):
def scene_closures(context, report: dict, ends=()) -> list:
"""Every closure stated in the scene as {part, to, holds}, for a set_params report: a change of params can open
a closure anywhere below the part. The closures `ends` are parts of come first, then those that do not hold,
then the rest, each by name; rows that would take the report past what a receipt carries are left off the end
and counted in closuresOmitted."""
held, kits, rows = closers(), {}, []
for obj in (o for o in context.scene.objects if o.type == "MESH" and CLOSE in o):
try:
found = closure_report(obj, *built_part(obj))
except (Refused, core.KitError):
found = {"to": None, "holds": False}
row = {"part": obj.name, "to": found["to"], "holds": found["holds"]}
found = closure_report(obj, *built_part(obj, kits), held, kits)
except (Refused, core.KitError): # the closing part itself cannot be read (scaled)
found = {"to": closure(obj)[1].name if closure(obj)[1] else None, "holds": False}
rows.append((obj not in ends and closure(obj)[1] not in ends, found["holds"], obj.name, {"part": obj.name, "to": found["to"], "holds": found["holds"]}))
kept, size = [], len(json.dumps(report, separators=(",", ":"))) + 40
for *_, row in sorted(rows, key=lambda r: r[:3]):
size += len(json.dumps(row, separators=(",", ":"))) + 1
if size > REPORT_LIMIT:
report["closuresOmitted"] = report.get("closuresOmitted", 0) + 1
else:
rows.append(row)
return rows
report["closuresOmitted"] = len(rows) - len(kept)
break
kept.append(row)
return kept
def part_report(obj, part, built) -> dict:
@ -392,7 +415,7 @@ class BROKKR_KITBASH_OT_set_params(PolishOperator):
if seats:
context.view_layer.update()
report = part_report(obj, part, built)
report["closures"] = scene_closures(context, report)
report["closures"] = scene_closures(context, report, (obj,))
return report
@ -475,6 +498,9 @@ class BROKKR_KITBASH_OT_close(PolishOperator):
other_part, other_built = built_part(other)
if obj == other:
raise Refused(f"{obj.name!r} cannot close on itself; nothing changed.")
for gone in (obj, other):
if not gone.users_collection:
raise Refused(f"{gone.name!r} is in no collection (a deleted object something still points to): a closure is between parts in the scene; nothing changed.")
if closure(obj) is not None:
raise Refused(f"{obj.name!r} already states a closure (its socket {closure(obj)[0]!r}): a part states one, and detach clears it; nothing changed.")
there, here = mated(other, other_part, other_built, obj, part, built, (self.socket, self.other_socket, 0.0), "closing on")

View file

@ -157,14 +157,15 @@ through that tree.
**A closure** states the one thing a tree cannot: that a part's second socket also meets something. A brace
hangs from its own bracket by one pin (a connection); its other pin meets the leg's rod (a closure), and the
hull, leg and brace are then a loop. The closing part owns it, one at most, as three ID properties:
`kit_close_socket` (its own socket), `kit_close_to` (the other part, held as a pointer, so it follows a rename
and reads empty once that part is deleted) and `kit_close_to_socket`. A spanning tree plus loop-closing
`kit_close_socket` (its own socket), `kit_close_to` (the other part, held as a pointer, so it follows a rename)
and `kit_close_to_socket`. The pointer keeps a deleted part in the file as an orphan, so a part counts as gone
when the pointer is empty or the object is in no collection. A spanning tree plus loop-closing
constraints is how closed chains are usually stated (Featherstone, Rigid Body Dynamics Algorithms, ch. 8;
MuJoCo's `connect` equality on its kinematic tree).
`close` writes those three properties and nothing else. It never moves a part: it is accepted only when the two
sockets already meet, origins together and normals opposed within 1e-5, at any roll (a closure is a pin). It
refuses, changing nothing: a part that is not a kit part or is scaled, a part closing on itself, two sockets
refuses, changing nothing: a part that is not a kit part, is scaled or is in no collection, a part closing on itself, two sockets
that may not mate (the part it names counts as the parent), an occupied socket at either end, a part that
already states a closure, and two sockets that do not meet, saying how far apart they stand.
@ -183,15 +184,19 @@ read these from.
A part's report carries `closure`: `null`, or
```json
{"to": "Leg", "socket": "end_b", "toSocket": "rod_end", "residual": 3.9e-07, "holds": true}
{"to": "Leg", "socket": "end_b", "toSocket": "rod_end", "residual": 3.9e-07, "holds": true, "reason": null}
```
`residual` is the larger of the largest difference between the two origins and the largest entry of the sum of
the two normals; `holds` is true when it is at most 1e-5. `to` is `null`, and `holds` false, when the other part
is gone or is not a part of this kit. A closure is never seated. `set_params` on either end refuses a change
the two normals; `holds` is true when it is at most 1e-5 and nothing below applies. When it does not hold,
`reason` says why in a sentence: the other part is gone (`to` is then `null`); the other part cannot be read
against (not a kit part, of another kit, scaled by hand, or without that socket; `residual` is then `null`);
another part's closure names the same socket, which a duplicated closing part leaves behind and which makes
both read not held until one is detached; or the two sockets stand apart. A closure is never seated. `set_params` on either end refuses a change
after which the two sockets may no longer mate (a pin of another size), naming the closure. A change that only
moves a socket (an actuator's `extension` under a closed brace) is accepted and opens the closure: the report
of `set_params` lists every closure in the scene as `closures: [{part, to, holds}]`, so the caller sees which
of `set_params` lists every closure in the scene as `closures: [{part, to, holds}]`, those its own part is an
end of first, then those that do not hold, then the rest, so the caller sees which
ones it opened and can solve the rolls again, `detach` and `attach` the members, and find the closure holding.
`detach` clears the closing part's closure together with its connection.
@ -265,7 +270,7 @@ vertices overflow.
| --- | --- | --- |
| `brokkr_kitbash.describe` | `kit` (default `mechanical`), `part` (default: all) | Parts with their params (type, min, max, default, doc) and sockets in the part frame at default params. Changes nothing. |
| `brokkr_kitbash.place_part` | `kit`, `part`, `object_name`, `params` | A new mesh object at the origin: the part's mesh, a `Kit Bevel` modifier when the part has a bevel, and the three ID properties. Refuses a name an object already has. |
| `brokkr_kitbash.set_params` | `object_name`, `params` | Overlays `params` on the stored ones and rebuilds the mesh in the same datablock: modifiers and material slots stay, and the Bevel width follows. Per-face materials are carried by shape: each shape of the part keeps the material most of its faces had, whatever the new face count. Seats the part and the parts attached to it again; refuses a change that breaks a connection or a closure's mate, and a baked part. Reports the part and `closures`, every closure in the scene as `{part, to, holds}` (with `closuresOmitted`, a count, if they would not fit a receipt). |
| `brokkr_kitbash.set_params` | `object_name`, `params` | Overlays `params` on the stored ones and rebuilds the mesh in the same datablock: modifiers and material slots stay, and the Bevel width follows. Per-face materials are carried by shape: each shape of the part keeps the material most of its faces had, whatever the new face count. Seats the part and the parts attached to it again; refuses a change that breaks a connection or a closure's mate, and a baked part. Reports the part and `closures`, every closure in the scene as `{part, to, holds}`: its own first, then the broken, then the rest; rows that would not fit a receipt are left off the end and counted in `closuresOmitted`. Each closure in the scene adds a few milliseconds (both its parts are built again to find their sockets). |
| `brokkr_kitbash.report` | `object_name` (default: every kit part) | Each part as the scene has it: kit, part, params, faces, shells, each socket's world frame, `connection`, `closure` and `baked`. Changes nothing and evaluates no modifier. |
| `brokkr_kitbash.attach` | `object_name` (the child), `socket`, `parent_name`, `parent_socket`, `roll` (degrees, -360 to 360, default 0) | Seats the child's socket on the parent's and parents it there. Reports the child. |
| `brokkr_kitbash.detach` | `object_name` | Clears the part's connection and the closure it states; it stays where it stands. Refuses a part that has neither. |

View file

@ -26,6 +26,7 @@ from pathlib import Path
import bmesh
import bpy
import numpy as np
from mathutils import Matrix
SURFACE = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(SURFACE / "tools"))
@ -330,6 +331,16 @@ check("refused, scene unchanged: close of a brace that stands 1 degree off, nami
and named and abs(float(named.group(1)) - apart) < 1e-5 and 0.01 < apart < 0.02 and scene_state() == state, [receipt["message"], apart])
send("brokkr_kitbash.detach", object_name="Brace")
send("brokkr_kitbash.attach", object_name="Brace", socket="end_a", parent_name="Lower", parent_socket="pivot", roll=roll_to(p2, knee))
# close-tolerance: the brace moved NUDGE (3.2e-4) off its seat. close accepts up to HELD, 1e-5; least claimed mutant 5e-4 (N2, 50 times
# HELD); NUDGE is 32 times the one and 0.64 of the other, as for the connection's own check below.
seat_was = np.array(brace.matrix_basis)[:3, 3]
send("setObjectTransform", targetObjectName="Brace", location=(seat_was + np.array(lower.matrix_world)[:3, :3].T @ [0.0, 0.0, NUDGE]).tolist())
state = scene_state()
receipt, _ = send("brokkr_kitbash.close", **CLOSING)
named = re.search(r"stand (\S+) m apart", str(receipt["message"]))
check("refused, scene unchanged: close of a brace moved by NUDGE, which a report would read as not held", receipt["status"] != "accepted" and named
and abs(reading("close nudged", float(named.group(1))) - NUDGE) < 0.1 * NUDGE and scene_state() == state, receipt["message"])
send("brokkr_kitbash.set_params", object_name="Brace", params="length=1.1") # seats it again
state = scene_state()
receipt, report = send("brokkr_kitbash.close", **CLOSING)
check("close states the closure on the brace when its end_b meets the leg's rod pin, and moves nothing", receipt["status"] == "accepted"
@ -339,7 +350,7 @@ check("close states the closure on the brace when its end_b meets the leg's rod
and not [k for k in leg.keys() if k.startswith("kit_close")], [receipt["message"], dict(brace.items())])
check("close reports the part: its closure holds, and its connection still does", report and report["object"] == "Brace"
and report["closure"] == {**report["closure"], "to": "Leg", "socket": "end_b", "toSocket": "rod_end", "holds": True}
and reading("closed", report["closure"]["residual"]) <= 1e-5 and held(report) and closure_of("Brace") == report["closure"]
and reading("closed", report["closure"]["residual"]) <= 1e-5 and report["closure"]["reason"] is None and held(report) and closure_of("Brace") == report["closure"]
and closure_of("Leg") is None, report)
refused("a second closure on a part that states one", "brokkr_kitbash.close",
{"object_name": "Brace", "socket": "end_b_back", "other_name": "Leg", "other_socket": "rod_end_back"}, "'Brace' already states a closure (its socket 'end_b')")
@ -372,6 +383,51 @@ check("set_params that moves the leg's rod pin is accepted and moves no brace: t
receipt, report = send("brokkr_kitbash.set_params", object_name="Leg", params="extension=0.15")
check("and with the rod back the closure holds again: it is read from where the parts stand, not stored", receipt["status"] == "accepted"
and report["closures"] == [{"part": "Brace", "to": "Leg", "holds": True}] and closure_row("Brace").get("holds") is True, [report and report.get("closures"), closure_of("Brace")])
# closures-omitted: a second closure, named to sort first, far from the leg; then a receipt with room for one row. Mutant N5 (never
# omit) lists two rows; rows by name alone would keep Aa_Loose and drop the one this call opened.
anchor, loose = place("Aa_Anchor", "strut", "width=0.09", location=[0.0, -20.0, 0.0]), place("Aa_Loose", "strut", "width=0.09")
meet = Matrix((np.array(anchor.matrix_world) @ core.mate(next(s for s in core.build(kit["parts"]["strut"], {"width": 0.09}).sockets if s["name"] == "end_b"),
next(s for s in core.build(kit["parts"]["strut"], {"width": 0.09}).sockets if s["name"] == "end_a"), 40.0)).tolist())
send("setObjectTransform", targetObjectName="Aa_Loose", location=list(meet.translation), rotationEuler=list(meet.to_euler("XYZ")))
receipt, report = send("brokkr_kitbash.close", object_name="Aa_Loose", socket="end_a", other_name="Aa_Anchor", other_socket="end_b")
check("a loose part placed to meet a socket closes on it", receipt["status"] == "accepted" and report and report["closure"]["holds"] is True, [receipt["message"], report and report["closure"]])
receipt, report = send("brokkr_kitbash.set_params", object_name="Leg", params="extension=0.3")
ROWS = [{"part": "Brace", "to": "Leg", "holds": False}, {"part": "Aa_Loose", "to": "Aa_Anchor", "holds": True}]
check("set_params lists the closures its own part is an end of first, then the rest", receipt["status"] == "accepted" and report["closures"] == ROWS
and "closuresOmitted" not in report, report and report.get("closures"))
addon = sys.modules["brokkr_kitbash"]
limit = addon.REPORT_LIMIT
addon.REPORT_LIMIT = len(json.dumps({k: v for k, v in report.items() if k != "closures"}, separators=(",", ":"))) + 40 + len(json.dumps(ROWS[0], separators=(",", ":"))) + 1
receipt, report = send("brokkr_kitbash.set_params", object_name="Leg", params="extension=0.3")
addon.REPORT_LIMIT = limit
check("with room for one row in the receipt, set_params keeps the closure it opened and counts the other in closuresOmitted", receipt["status"] == "accepted"
and report["closures"] == ROWS[:1] and report.get("closuresOmitted") == 1 and np.array_equal(np.array(brace.matrix_world), was), report and [report.get("closures"), report.get("closuresOmitted")])
receipt, report = send("brokkr_kitbash.set_params", object_name="Aa_Anchor", params="length=0.9")
check("and a closure another part's set_params opened comes before one that holds", receipt["status"] == "accepted"
and report["closures"] == [{"part": "Aa_Loose", "to": "Aa_Anchor", "holds": False}, {"part": "Brace", "to": "Leg", "holds": False}], report and report.get("closures"))
send("brokkr_kitbash.detach", object_name="Aa_Loose")
send("brokkr_kitbash.set_params", object_name="Leg", params="extension=0.15")
leg.scale = (1.0001, 1.0, 1.0)
bpy.context.view_layer.update()
found = closure_row("Brace")
leg.scale = (1.0, 1.0, 1.0)
bpy.context.view_layer.update()
check("a closure on a part scaled by hand reads broken, naming the part and why, not gone", found.get("to") == "Leg" and found.get("holds") is False and found.get("residual") is None
and "'Leg' is scaled, mirrored or sheared" in str(found.get("reason")) and closure_row("Brace").get("holds") is True, found)
twin = brace.copy() # as Shift-D leaves it: a second part stating the same closure
twin.data = brace.data.copy()
twin.name = "Brace_twin"
bpy.context.scene.collection.objects.link(twin)
found, other = closure_row("Brace"), closure_row("Brace_twin")
check("two parts that state a closure on one socket both read not held, each naming the other", found.get("holds") is False and other.get("holds") is False
and "is also closed on by 'Brace_twin'" in str(found.get("reason")) and "is also closed on by 'Brace'" in str(other.get("reason")), [found, other])
tie["keeper"] = twin # something still points at the copy, so Delete leaves it in the file with its closure properties
with bpy.context.temp_override(selected_objects=[twin], active_object=twin):
bpy.ops.object.delete()
check("and with the copy deleted the closure holds again, though the copy is still in the file stating its own", closure_row("Brace").get("holds") is True
and bpy.data.objects.get("Brace_twin") is not None and "kit_close_to" in bpy.data.objects["Brace_twin"], closure_of("Brace"))
del tie["keeper"]
bpy.data.objects.remove(bpy.data.objects["Brace_twin"])
refused("set_params on the part a closure names, to a size its pin no longer mates", "brokkr_kitbash.set_params", {"object_name": "Leg", "params": "body_r=0.07"},
"'Brace' closing on 'Leg': socket 'end_b' (pivot, size 0.054) and parent socket 'rod_end' (pivot, size 0.063)")
refused("set_params on the closing part, to a size its pin no longer mates", "brokkr_kitbash.set_params", {"object_name": "Brace", "params": "width=0.1"},
@ -393,7 +449,24 @@ found = closure_row("Brace")
check("a closure follows its other part through a rename", found.get("to") == "Shin" and found.get("holds") is True, found)
leg.name = "Leg"
send("brokkr_kitbash.detach", object_name="Leg")
bpy.data.objects.remove(leg)
homes = list(leg.users_collection)
for home in homes:
home.objects.unlink(leg)
found = closure_row("Brace")
check("a closure on a part unlinked from every collection reads to null, holds false, with the reason", found.get("to", 0) is None and found.get("holds") is False
and "gone" in str(found.get("reason")) and "Leg" in bpy.data.objects, found)
for home in homes:
home.objects.link(leg)
check("and holds again once the part is linked back", closure_row("Brace").get("holds") is True, closure_of("Brace"))
with bpy.context.temp_override(selected_objects=[leg], active_object=leg):
bpy.ops.object.delete() # the ordinary Delete: the closure's pointer keeps the object in the file as an orphan
found = closure_row("Brace")
check("a closure on a part deleted with the Delete operator reads to null, holds false, though the object is still in the file", found.get("to", 0) is None
and found.get("holds") is False and found.get("residual", 0) is None and bpy.data.objects.get("Leg") is not None and brace.get("kit_close_to") is not None, [found, list(bpy.data.objects.keys())])
refused("close onto a deleted part that is still in the file", "brokkr_kitbash.close",
{"object_name": "Tie", "socket": "end_a", "other_name": "Leg", "other_socket": "rod_end_back"}, "'Leg' is in no collection")
if "Leg" in bpy.data.objects:
bpy.data.objects.remove(bpy.data.objects["Leg"])
found = closure_row("Brace")
receipt, report = send("brokkr_kitbash.set_params", object_name="Brace", params="length=1.0")
check("a closure whose other part is gone reads to null and holds false, and set_params on the closing part still works", found and found == {**found, "to": None, "residual": None, "holds": False}

View file

@ -151,6 +151,11 @@
"ok": true,
"detail": null
},
{
"name": "refused, scene unchanged: close of a brace moved by NUDGE, which a report would read as not held",
"ok": true,
"detail": null
},
{
"name": "close states the closure on the brace when its end_b meets the leg's rod pin, and moves nothing",
"ok": true,
@ -231,6 +236,41 @@
"ok": true,
"detail": null
},
{
"name": "a loose part placed to meet a socket closes on it",
"ok": true,
"detail": null
},
{
"name": "set_params lists the closures its own part is an end of first, then the rest",
"ok": true,
"detail": null
},
{
"name": "with room for one row in the receipt, set_params keeps the closure it opened and counts the other in closuresOmitted",
"ok": true,
"detail": null
},
{
"name": "and a closure another part's set_params opened comes before one that holds",
"ok": true,
"detail": null
},
{
"name": "a closure on a part scaled by hand reads broken, naming the part and why, not gone",
"ok": true,
"detail": null
},
{
"name": "two parts that state a closure on one socket both read not held, each naming the other",
"ok": true,
"detail": null
},
{
"name": "and with the copy deleted the closure holds again, though the copy is still in the file stating its own",
"ok": true,
"detail": null
},
{
"name": "refused, scene unchanged: set_params on the part a closure names, to a size its pin no longer mates",
"ok": true,
@ -261,6 +301,26 @@
"ok": true,
"detail": null
},
{
"name": "a closure on a part unlinked from every collection reads to null, holds false, with the reason",
"ok": true,
"detail": null
},
{
"name": "and holds again once the part is linked back",
"ok": true,
"detail": null
},
{
"name": "a closure on a part deleted with the Delete operator reads to null, holds false, though the object is still in the file",
"ok": true,
"detail": null
},
{
"name": "refused, scene unchanged: close onto a deleted part that is still in the file",
"ok": true,
"detail": null
},
{
"name": "a closure whose other part is gone reads to null and holds false, and set_params on the closing part still works",
"ok": true,
@ -540,6 +600,7 @@
"hostErrors": [],
"readings": {
"carried": 2.6e-07,
"close nudged": 0.00032,
"closed": 3.9e-07,
"cut": 0.25,
"kept": 6e-08,