brokkr_kitbash.plate: a vanished bolt ring stands no bolts, crossed both ways included (cut plate-fittings-kit, Soul s1)
Ruling plate-bolts-follow-edge-event: no refusal. The guard is every edge running the way its drawn edge runs, so a square turned half round is caught too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9dd543f71d
commit
12022a423d
3 changed files with 31 additions and 8 deletions
|
|
@ -829,13 +829,22 @@ def _slab_ring(slab: dict, face) -> np.ndarray:
|
|||
return inset2d(ring, slab["gap"]) if slab["gap"] else ring
|
||||
|
||||
|
||||
def _stands(ring: np.ndarray, drawn: np.ndarray) -> bool:
|
||||
"""Whether an outline moved in still stands: every edge runs the way its own edge of the drawn outline does. Moved
|
||||
in past half the outline's width an edge runs backwards; past it both ways a rectangle turns half round, crossed,
|
||||
and its area is positive still."""
|
||||
n = len(drawn)
|
||||
return all(float((ring[(k + 1) % n] - ring[k]) @ (drawn[(k + 1) % n] - drawn[k])) > 0 for k in range(n))
|
||||
|
||||
|
||||
def fit_meshes(row: dict, face, top: float, side: int, kit: dict, path: str):
|
||||
"""({mat: (V, faces)}, count): the fittings of one checked row at `side`, merged by material in row order, and
|
||||
how many stand. A part's frame is the face's at the fit's place: z the normal, y the face's b, turned by roll; at
|
||||
side -1 the place, normal and b are mirrored, the frame made right-handed and the roll negated. A part row and
|
||||
a step stand on the face's top (the face plus `top`, the clad's lift there); a bolts row fastens the plate
|
||||
itself and stands on the bare face. Raises PlateError for what the kit refuses at these params and for a row
|
||||
that makes nothing."""
|
||||
itself and stands on the bare face; where the outline moved in by its inset and the taper leaves no ring it
|
||||
stands no bolts. Raises PlateError for what the kit refuses at these params and for a step too small for a
|
||||
panel."""
|
||||
held: dict[str, _Mesh] = {}
|
||||
count = 0
|
||||
if face is None:
|
||||
|
|
@ -862,9 +871,10 @@ def fit_meshes(row: dict, face, top: float, side: int, kit: dict, path: str):
|
|||
count += 1
|
||||
elif fit["kind"] == "bolts":
|
||||
slab = row["slab"]
|
||||
ring = inset2d(_slab_ring(slab, face), fit["inset"] + slab["taper"])
|
||||
if not _area2(ring) > 0:
|
||||
raise PlateError(f"{at}.inset: {fit['inset']} and the slab's taper leave nothing of the outline")
|
||||
drawn = _slab_ring(slab, face)
|
||||
ring = inset2d(drawn, fit["inset"] + slab["taper"])
|
||||
if not _stands(ring, drawn): # a vanished ring stands no bolts (plate-bolts-follow-edge-event)
|
||||
continue
|
||||
bolt = part("bolt", fit["params"], at)
|
||||
for k in range(len(ring)):
|
||||
p, q = ring[k], ring[(k + 1) % len(ring)]
|
||||
|
|
|
|||
|
|
@ -1084,8 +1084,9 @@ Three kinds are fittings, geometry `build` makes:
|
|||
drawn (in by the slab's `gap`) is moved in by `inset` + the slab's `taper` (0 to 10; a sharp corner moves at
|
||||
most that / 0.3); each edge of that ring takes `max(1, int(length / spacing))` bolts, bolt j at
|
||||
`(j + 0.5) / count` along it. `params` are the bolt's. A rim bolt fastens the plate, not its cladding: the row
|
||||
stands on the bare face, `lift` (default 0) over it, whatever panel the face carries. Refused on a row that is
|
||||
no slab, and where the inset leaves nothing of the outline.
|
||||
stands on the bare face, `lift` (default 0) over it, whatever panel the face carries. Where the inset leaves no
|
||||
ring (an edge would run backwards, or the ring turn half round) the row stands no bolts: the ruling
|
||||
plate-bolts-follow-edge-event. Refused on a row that is no slab.
|
||||
- `{kind: "step", outline, at, lift, mat, bolt_mat}`: a raised panel on `outline` (3 to 64 `[a, b]` points, either
|
||||
winding, about `at`) on the face's top: the clad's panel with inset 0, from 0.02 under the top to `lift` (0 to
|
||||
1) over it, its far rim chamfered 0.02, a hexagonal bolt of radius 0.028 inside each corner in `bolt_mat`
|
||||
|
|
|
|||
|
|
@ -558,6 +558,19 @@ class FitTests(unittest.TestCase):
|
|||
self.assertEqual(got, [[-0.37, 0.0], [0.0, -0.17], [0.0, 0.17], [0.37, 0.0]])
|
||||
self.assertGreater(volume(made["fits"]["gunmetal"]), 0)
|
||||
|
||||
def test_a_vanished_ring_stands_no_bolts(self):
|
||||
"""Ruling plate-bolts-follow-edge-event: a bolts row whose outline, moved in by its inset and the taper, leaves
|
||||
no ring stands no bolts, and the table checks and builds. Thin: 0.1 wide, in 0.06 + 0.04 across it. Both ways:
|
||||
a 0.2 square in 0.07 + 0.04 and 0.12 + 0.04 turns half round with its area positive. Mutant: the guard a sign
|
||||
of the area, the shipped state at 9dd543f (the square stands 4 crossed bolts)."""
|
||||
bolts = {"kind": "bolts", "inset": 0.06, "spacing": 5.0, "mat": "gunmetal"}
|
||||
for outline, inset, count in (([0.1, 0.6], 0.06, 0), ([0.2, 0.2], 0.07, 0), ([0.2, 0.2], 0.12, 0), ([0.2, 0.2], 0.05, 4), ([0.1, 0.6], 0.005, 4)):
|
||||
table = doc(row(slab=dict(RIM, outline={"w": outline[0], "h": outline[1], "clip": 0.0}), fits=[dict(bolts, inset=inset), PIT]))
|
||||
plate.check(table)
|
||||
made = plate.build(table)[0]
|
||||
self.assertEqual((made["report"]["fits"], "gunmetal" in made["fits"]), (count + 1, count > 0), (outline, inset))
|
||||
self.assertLess(apart(made["fits"]["pit"][0], placed("pit", PIT["params"], self.frame(PIT["at"], 0.01, 30))), self.HELD)
|
||||
|
||||
def test_a_step_is_a_panel_on_its_outline(self):
|
||||
made = plate.build(doc(row(slab=RIM, fits=[STEP])))[0]
|
||||
a, b, n = plate.plane_basis(RIM["normal"], (0, 0, 1), RIM["right"])
|
||||
|
|
@ -625,7 +638,6 @@ class FitTests(unittest.TestCase):
|
|||
self.refused(dict(bolts, mat="m" * 64), "plates[0].fits[0].mat")
|
||||
self.refused(dict(bolts, spacing=0), "plates[0].fits[0].spacing")
|
||||
self.refused(dict(bolts, params="r=1"), "plates[0].fits[0].params: kit 'fittings' part 'bolt' param 'r'")
|
||||
self.refused(dict(bolts, inset=0.3), "plates[0].fits[0].inset: 0.3 and the slab's taper leave nothing of the outline")
|
||||
self.refused(dict(STEP, mat="m" * 64), "plates[0].fits[0].mat")
|
||||
self.refused(dict(STEP, bolt_mat=""), "plates[0].fits[0].bolt_mat")
|
||||
self.refused(dict(STEP, outline=STEP["outline"][:2]), "plates[0].fits[0].outline: wants 3 to 64 entries")
|
||||
|
|
|
|||
Loading…
Reference in a new issue