From 822562cbdd680f03a5e63229d15a1da300641063 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 10 Oct 2026 02:29:43 +0000 Subject: [PATCH 1/8] Corner pockets at small pitches open all the way, with the socket's rim cut out of them Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- src/core.js | 82 +++++++++++++++++++++++++++++++++++++++++++++ test/plate-audit.js | 54 ++++++++++++++++++++++++----- 2 files changed, 128 insertions(+), 8 deletions(-) diff --git a/src/core.js b/src/core.js index 94dae66..a00fc3c 100644 --- a/src/core.js +++ b/src/core.js @@ -3508,6 +3508,7 @@ function buildPiece(cfg, layout, piece, onStatus) { return polys; }; let done = 0; + const rims = new Map(); // a whole cell's shell, by its column and row, for the corner bosses' pockets for (let ix = 0; ix < xs.length-1; ix++) { for (let iy = 0; iy < ys.length-1; iy++) { let x0 = Math.max(0, xs[ix] - BLOAT), x1 = Math.min(W, xs[ix+1] + BLOAT); @@ -3823,6 +3824,7 @@ function buildPiece(cfg, layout, piece, onStatus) { jointCells.push(cell); } if (cellFastener) region = settle(cell, region); + if (!halfX && !halfY) rims.set(ci + ',' + cj, shells.length); shells.push(region); done++; if (onStatus && done % 8 === 0) onStatus(`cells ${done}`); @@ -4042,6 +4044,86 @@ function buildPiece(cfg, layout, piece, onStatus) { shells.push(boss); } } + /* The socket's rim, cut away under a boss whose pocket it stands in (#83). With nothing + under the sockets a cell is its rim alone, from the bed up: 2.85 mm in from the + cell's edges at the bed, 2.15 from 0.7 mm up, and further in at the socket's rounded + corner, which is the way every pocket faces. The pockets sit holeOffset from the + cell's centre whatever the pitch, so at small pitches they run in under the rim, and + a boss's pocket was cut from the boss alone: the rim, a shell of its own, stood in + it. A 6 mm magnet from beneath at 34.5 mm had 14.6 mm³ of rim in each pocket, in 41% + of its columns, and 1.8 mm³ at 36.13 mm, all with Download on; a solid floor's + pockets are cut into the floor under the rim and had none. + * + So where a boss's pocket runs more than MOUNT_SEAM into its cell's rim, the rim is + cut away under the boss: a box from under the bed to a height under the boss's top, + two BLOATs in from the cell's edges and from the boss's inner sides. The boss stands + round and over all of it, so the plate is the same solid but for the pocket, which + is then the boss's own as a solid floor's is the floor's. A box, and not the pocket + again: cut along the pocket's own walls and roof, the rim came out split on the same + lines as the boss where both stand on the piece's edge, edges used four times (six + more at 34.5 mm), and a box's faces stand off every face of the boss's. Up to under + the boss's top rather than the pocket's roof, so the rim's foot, below 0.7 mm, where + it stands furthest in, goes from under a hole open on the boss's top as well; over + the foot mountLimits holds such a hole clear of the rim, since there no boss stands + round it and cutting it would cut into the socket's wall. The height is the middle + of the widest gap between the planes it could meet, the rim's own rings, the pocket's + floors and roofs and a joint's cuts and housings, so it is level with none of them: + two cuts level with each other went bad wherever #64 tried them. + * + Every whole cell's rim is the same ring, so a corner is cut in every cell or in none. + A pocket the rim does not reach leaves it as it was, and the plate is built as + before. */ + const ringZ = prof.zs.slice(1, 5), ringD = prof.ds.slice(1, 5); + // the rim's ring at height z, as directCellRegion makes it; between two rings, where + // their corners have got to, since they move in step + const ringAt = (z) => { + z = Math.max(ringZ[0], Math.min(ringZ[ringZ.length - 1], z)); + let k = 0; + while (k < ringZ.length - 2 && z > ringZ[k + 1]) k++; + const d = ringD[k] + (z - ringZ[k]) / (ringZ[k + 1] - ringZ[k]) * (ringD[k + 1] - ringD[k]); + return roundedRectRing(0, 0, half - d, half - d, prof.rTop - (d - ringD[ringD.length - 1]), cfg.arcSegs || 6); + }; + // how far the pocket at the corner (sx, sy) runs into the rim, each of its corners + // against the ring at its own height, which the walls straight up from it stand inside + const into = (sx, sy) => { + let most = -Infinity; + for (const p of bossFastener) for (const v of p.verts) { + const ring = ringAt(v[2]), x = v[0] + sx*off, y = v[1] + sy*off; + ring.forEach((a, i) => { + const b = ring[(i + 1) % ring.length], ex = b[0] - a[0], ey = b[1] - a[1]; + most = Math.max(most, (ey * (x - a[0]) - ex * (y - a[1])) / Math.hypot(ex, ey)); + }); + } + return most; + }; + const under = [[-1, -1], [-1, 1], [1, -1], [1, 1]].filter(([sx, sy]) => into(sx, sy) > MOUNT_SEAM); + if (under.length) { + const flats = (polys) => polys.filter((p) => Math.abs(p.plane.n[2]) > 0.999).map((p) => p.verts[0][2]); + // over the foot, and over every pocket's roof under the boss's top + const lo = Math.max(ringZ[1], ...bossFastener.filter((p) => p.plane.n[2] > 0.999 && p.verts[0][2] < bossH) + .map((p) => p.verts[0][2])); + const planes = [...ringZ, ...flats(bossFastener), ...fromBelow.flatMap(flats)]; + const bo = keyKind === 'recess' ? null : keyed.find((b) => !(plan.junction && offJunction(b, pitch, piece))); + if (bo) { + const op = keySiteOps(keyKind, keyShape, keyPrm, keyClr, bo.edge, bo.e, bo.s, H); + planes.push(...flats(op.cut), ...flats(op.add)); + } + const stops = [lo, bossH, ...planes.filter((z) => z > lo && z < bossH)].sort((a, b) => a - b); + let rimTop = lo, gap = -1; + for (let n = 1; n < stops.length; n++) + if (stops[n] - stops[n - 1] > gap) { gap = stops[n] - stops[n - 1]; rimTop = (stops[n] + stops[n - 1]) / 2; } + for (let i = 0; i < piece.nx; i++) for (let j = 0; j < piece.ny; j++) { + const k = rims.get(i + ',' + j); + if (k === undefined) continue; + const cut = [].concat(...under.map(([sx, sy]) => { + const cxr = gx0 + i*pitch + half + sx*half, cyr = gy0 + j*pitch + half + sy*half; // the cell's corner + const x0 = cxr - sx*2*BLOAT, x1 = cxr - sx*(bossW - 2*BLOAT); + const y0 = cyr - sy*2*BLOAT, y1 = cyr - sy*(bossW - 2*BLOAT); + return extrudePoly([[x0, y0], [x1, y0], [x1, y1], [x0, y1]], -0.5, rimTop); + })); + shells[k] = cutAgain(shells[k], cut, csgSubtract(shells[k], cut)); + } + } } // ---- puzzle male tabs (protrude at floor level) ---- diff --git a/test/plate-audit.js b/test/plate-audit.js index 711e609..99afd13 100644 --- a/test/plate-audit.js +++ b/test/plate-audit.js @@ -2403,21 +2403,25 @@ console.log('\ncorner bosses beside a joint cut from beneath:'); these is asked at the size that met it, which has to be refused for the housing, and built at the size the field takes, where every pocket has to be as open as in the same plate with no joint, read on vertical lines 0.1 mm apart every 0.05 mm up its - depth. With no joint, not the pocket's whole volume: at these pitches the socket's - rim stands in part of a 6 mm pocket already, joint or not. And a pocket the cup does - not reach, at 42 mm, has to be taken as before. */ + depth. With no joint, which is the pocket's whole volume since #83 (below): before + it the socket's rim stood in part of a 6 mm pocket at these pitches, joint or not. + And a pocket the cup does not reach, at 42 mm, has to be taken as before. */ { const h = 0.1, dz = 0.05; - // the open room in each pocket of a design, in mm³, mouth to floor - const room = (r) => { + /* the open room in each pocket of a design, in mm³, mouth to floor; or, `whole`, all + of it, open or not. A screw's head and shank are cut with their corners on the + size, 14 and 12 sides, so they are read inside their flats; a magnet's pocket + has its flats on the magnet (fastenerCutter). */ + const room = (r, whole) => { const cfg = r.cfg, out = []; const top = Math.min(2.6, Math.max(cfg.magnets ? cfg.magnetH + 0.8 : 0, cfg.screws ? cfg.screwHeadDepth + 1 : 0)); const spans = []; if (cfg.magnets) spans.push(cfg.magnetSide === 'top' ? [cfg.magnetD / 2, top - cfg.magnetH, top] : [cfg.magnetD / 2, 0, cfg.magnetH]); - if (cfg.screws) spans.push([cfg.screwHeadD / 2, 0, cfg.screwHeadDepth], [cfg.screwHoleD / 2, 0, top]); + if (cfg.screws) spans.push([cfg.screwHeadD / 2 * Math.cos(Math.PI / 14), 0, cfg.screwHeadDepth], + [cfg.screwHoleD / 2 * Math.cos(Math.PI / 12), 0, top]); r.pieces.forEach((polys, pi) => { - const pc = r.L.pieces[pi], A = columns(polys); + const pc = r.L.pieces[pi], A = whole ? null : columns(polys); for (let i = 0; i < pc.nx; i++) for (let k = 0; k < pc.ny; k++) for (const sx of [-1, 1]) for (const sy of [-1, 1]) { const px = pc.mL + (i + 0.5) * cfg.pitch + sx * cfg.holeOffset; @@ -2426,7 +2430,7 @@ console.log('\ncorner bosses beside a joint cut from beneath:'); for (const [rad, z0, z1] of spans) for (let x = -rad; x <= rad; x += h) for (let y = -rad; y <= rad; y += h) { if (Math.hypot(x, y) > rad - 0.02) continue; - const col = A(px + x + 0.000731, py + y + 0.000419); + const col = whole ? () => 0 : A(px + x + 0.000731, py + y + 0.000419); for (let z = z0 + dz / 2; z < z1; z += dz) if (col(z) < 1) v += h * h * dz; } out.push(v); @@ -2478,6 +2482,40 @@ console.log('\ncorner bosses beside a joint cut from beneath:'); `${good ? '' : ` FAIL${refused === 'housing' ? '' : ': has to be refused for the housing'}`}`); if (!good) bad++; } + /* And the socket's rim, with no joint at all (#83). With nothing under the sockets a + cell is its rim alone, and at small pitches a boss's pocket runs in under it; the + pocket was cut from the boss and not from the rim, which stood in it: a 6 mm magnet + from beneath at 34.5 mm had 14.6 mm³ of rim in each pocket, and 1.8 mm³ at 36.13 + mm, a 7.9 mm one there 20.2, and the default screw's head 13.2 at 34.5 mm, all + taken with Download on. The rim is cut away under a boss whose pocket it reaches + now. So each of these has to be taken, and every pocket has to be open through its + whole volume, mouth to floor. And at 42 mm, where the rim reaches no pocket, they + have to be taken and open as before. */ + console.log('\ncorner pockets under the socket\'s rim:'); + const Q = (p) => ({ pitch: p, drawerW: 4 * p, drawerD: 2 * p, bedW: 2 * p + 16, bedD: 400, baseMode: 'bosses', + connector: 'none' }); + for (const [name, over, f, d, why] of [ + ['34.5 mm, 6 mm magnet', { ...Q(34.5), magnets: true }, 'magnetD', 6, false], + ['36.13 mm, 6 mm magnet', { ...Q(36.13), magnets: true }, 'magnetD', 6, false], + ['36.13 mm, 7.9 mm magnet', { ...Q(36.13), magnets: true }, 'magnetD', 7.9, false], + ['34.5 mm, screws', { ...Q(34.5), screws: true }, 'screwHoleD', 3, false], + ['42 mm, 6 mm magnet', { ...Q(42), magnets: true }, 'magnetD', 6, false], + ['42 mm, 6 mm magnet above', { ...Q(42), magnets: true, magnetSide: 'top' }, 'magnetD', 6, false], + ['42 mm, screws', { ...Q(42), screws: true }, 'screwHoleD', 3, false]]) { + const asked = designCfg({ ...over, [f]: d }); + const lims = G.mountLimits(asked, G.computeLayout(asked)); + const refused = d > lims[f] + 1e-9 && 'its cap'; + const size = Math.min(d, lims[f]); + const r = buildAll({ ...over, [f]: size }); + const got = room(r), all = room(r, true); + const short = got.map((v, k) => all[k] - v).filter((v) => v > 0.005); + const good = refused === why && !short.length && !r.open; + console.log(` ${name.padEnd(38)} ${refused ? `refused (${refused}), built at ${size}` : 'taken'}; ` + + (short.length ? `${short.length} of ${got.length} pockets SHORT of their whole room, ` + + `${short.reduce((s, v) => s + v, 0).toFixed(2)} mm³ solid` : `${got.length} pockets open through`) + + `; ${leakText(r)}${good ? '' : ` FAIL${refused === why ? '' : why ? `: has to be refused for the ${why}` : ': has to be taken'}`}`); + if (!good) bad++; + } } } From 764781849dc37a8fdb222b8a1044d858bfd960ac Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 10 Oct 2026 02:29:53 +0000 Subject: [PATCH 2/8] A magnet put in from above or a screw in a corner pocket is held clear of the socket's rim over its boss, and Checks says so Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- src/core.js | 28 +++++++++++++++++++++-- src/ui.js | 6 ++++- test/plate-audit.js | 37 ++++++++++++++++++------------- test/ui/plates-robustness.spec.js | 9 ++++++++ 4 files changed, 62 insertions(+), 18 deletions(-) diff --git a/src/core.js b/src/core.js index a00fc3c..88036b8 100644 --- a/src/core.js +++ b/src/core.js @@ -2464,7 +2464,8 @@ function boreReach(sides, segs, x, y) { * floor, or it crosses the floor's chamfer cone — see ENGINE.md §2; * - under the floor (a magnet from below, the counterbore): it must stay in its cell; * - in a corner boss: it must stay in the boss, which is shorter than the solid floor - * and does not grow with the pocket, so it also caps the depth. + * and does not grow with the pocket, so it also caps the depth; and one that opens on + * the boss's top must clear the socket's rim over it (#83). * * And whichever way it opens, it must stay out of a joint's cut in the floor beside it: * a key's recess, or the notch a tab fits into, where a dovetail's lets a pocket from @@ -2496,8 +2497,28 @@ function mountLimits(cfg, layout, known) { const inCell = half - off - MOUNT_WALL; const s = half - off; // the site's distance in from the cell's edges const inBoss = Math.min(roomIn(BOSS_W, BOSS_R, s), s) - MOUNT_WALL; + /* A corner boss's hole that opens on its top, a magnet put in from above or a screw's + shank, has the socket's rim to pass on the way in or out, as one in a solid floor has + the edge of the socket floor; and over the boss the rim is the socket's wall, which + is not cut (buildPiece cuts the rim away under a boss, up to just under its top; + #83). From 0.7 mm up it stands 2.15 mm in from the cell's edges, and further in at + the socket's rounded corner, which is the way each site faces. Measured on the ring + buildPiece's profile makes (directCellRegion), polygon and all, from each of the four + sites, since its corners are not mirror images of one another, and MOUNT_SEAM short. + The boss alone took a 6 mm magnet from above at 36.13 mm with the rim 0.26 mm over + its pocket, and the default 3 mm screw at 33 mm with the rim 0.53 mm over its hole, + with Download on. */ + const dMid = 2.15 + tol; + const rim = roundedRectRing(0, 0, half - dMid, half - dMid, cfg.socketRadius - (dMid - cfg.topCutoff), + cfg.arcSegs || 6); + let onRim = Infinity; + for (const [x, y] of [[off, off], [-off, off], [-off, -off], [off, -off]]) + rim.forEach((a, i) => { + const b = rim[(i + 1) % rim.length], ex = b[0] - a[0], ey = b[1] - a[1]; + onRim = Math.min(onRim, (ex * (y - a[1]) - ey * (x - a[0])) / Math.hypot(ex, ey) - MOUNT_SEAM); + }); const bosses = cornerBosses(cfg); - const top = bosses ? inBoss : onFloor, under = bosses ? inBoss : inCell; + const top = bosses ? Math.min(inBoss, onRim) : onFloor, under = bosses ? inBoss : inCell; const r10 = (x) => Math.floor(x * 10 + 1e-9) / 10; // a cap is given in tenths, rounded down /* A cell's four sites are 2 × holeOffset apart, 26 mm, so past a pitch of about 50 mm the room above lets a cut reach the one beside it before it reaches anything else: @@ -2772,6 +2793,9 @@ function mountLimits(cfg, layout, known) { beside: { magnetD: own.magnetD === beside && !joint.magnetD, screwHoleD: own.screwHoleD === beside && !joint.screwHoleD, screwHeadD: own.screwHeadD === beside && !joint.screwHeadD }, + // which the socket's rim over a corner boss stops (#83) + rim: { magnetD: bosses && cfg.magnetSide === 'top' && own.magnetD === onRim && !joint.magnetD, + screwHoleD: bosses && own.screwHoleD === onRim && !joint.screwHoleD }, // and which a joint's cut stops, before any of those, and how (jointFor) joint, // sizes under the largest refused all the same, as [from, to] with both ends taken diff --git a/src/ui.js b/src/ui.js index 72985d7..22dae09 100644 --- a/src/ui.js +++ b/src/ui.js @@ -102,7 +102,9 @@ const cutsNamed = () => `${['dovetail', 'puzzle'].includes(state.connector) ? 'n `joint` names: a pocket from beneath as deep as a dovetail's notch, a magnet or screw that would reach the tab in one, a pocket any wider coming too near the notch's edge, a hole that would meet the housing of a key put in from above ('housing'), - or any other hole breaking into the cut. The hint about keys put in from above is not + or any other hole breaking into the cut. With no joint in the way, a hole that opens on + a corner boss's top, a magnet put in from above or a screw's shank, can stop at the + socket's rim over the boss (`rim`, #83). The hint about keys put in from above is not given with corner pockets: there is no solid floor under them, and such a key's cup reaches a boss's pocket (#75). Nor where the bosses are buried in the floor a joint needs (cornerBosses): a key put in from above, in the walls, needs none, so @@ -125,6 +127,8 @@ const mountWhy = (opens, field) => { : `; put in from beneath, the ${CONNECTOR_NAMES[state.connector]} leave more room`) : joint ? `a hole has to stay out of the ${cuts}` : mount().beside[field] ? 'a cell\'s four holes have to stay clear of each other' + : mount().rim[field] ? `${field === 'magnetD' ? 'a magnet put in from above' : 'a screw'} has to ` + + 'clear the socket\'s rim over its corner boss' : cornerBosses(state) ? 'a pocket has to stay inside its corner boss' : opens ? 'a cut open to the socket has to stay on the socket floor' : 'a pocket under the floor has to stay inside its cell') + diff --git a/test/plate-audit.js b/test/plate-audit.js index 99afd13..5401f49 100644 --- a/test/plate-audit.js +++ b/test/plate-audit.js @@ -2465,21 +2465,23 @@ console.log('\ncorner bosses beside a joint cut from beneath:'); does not see: an H-clip from above at 34 mm took a 4 mm magnet from above with 4 edges open in A1, where the cavity meets the pocket's wall, and a wall bowtie at 36.13 mm a 7.9 mm magnet 1.45 mm deep, level with the cavity's floor, with 13 open - a piece, both with Download on. The H-clip's pocket has no less room than with no - joint, since the rim's corner stands where the cup does (#83), and it is refused - all the same. Each has to be refused for the housing, and built at the size the - field takes with no edge open. */ - for (const [name, over, d] of [ - ['H-clip at 34 mm, 4 mm magnet above', { ...P(34), connector: 'hclip', magnets: true, magnetSide: 'top' }, 4], - ['wall bowtie at 36.13 mm, 7.9 x 1.45', { ...P(36.13), magnets: true, magnetH: 1.45 }, 7.9]]) { + a piece, both with Download on. Each has to be refused, and built at the size the + field takes with no edge open: the bowtie's for the housing, and the H-clip's for + the socket's rim. The H-clip's cup stands inside the rim's corner, and a pocket + from above has to clear the rim over its boss since #83 (below), which it meets + first: from 30 to 42 mm no pocket from above reaches an H-clip's or a snap clip's + cup that the rim does not stop sooner. */ + for (const [name, over, d, why] of [ + ['H-clip at 34 mm, 4 mm magnet above', { ...P(34), connector: 'hclip', magnets: true, magnetSide: 'top' }, 4, 'rim'], + ['wall bowtie at 36.13 mm, 7.9 x 1.45', { ...P(36.13), magnets: true, magnetH: 1.45 }, 7.9, 'housing']]) { const asked = designCfg({ ...over, magnetD: d }); const lims = G.mountLimits(asked, G.computeLayout(asked)); - const refused = d > lims.magnetD + 1e-9 && lims.joint.magnetD; + const refused = d > lims.magnetD + 1e-9 && (lims.rim.magnetD ? 'rim' : lims.joint.magnetD); const size = Math.min(d, lims.magnetD); const r = buildAll({ ...over, magnetD: size }); - const good = refused === 'housing' && !r.open; + const good = refused === why && !r.open; console.log(` ${name.padEnd(38)} ${refused ? `refused (${refused}), built at ${size}` : 'TAKEN'}; ${leakText(r)}` + - `${good ? '' : ` FAIL${refused === 'housing' ? '' : ': has to be refused for the housing'}`}`); + `${good ? '' : ` FAIL${refused === why ? '' : `: has to be refused for the ${why}`}`}`); if (!good) bad++; } /* And the socket's rim, with no joint at all (#83). With nothing under the sockets a @@ -2487,10 +2489,13 @@ console.log('\ncorner bosses beside a joint cut from beneath:'); pocket was cut from the boss and not from the rim, which stood in it: a 6 mm magnet from beneath at 34.5 mm had 14.6 mm³ of rim in each pocket, and 1.8 mm³ at 36.13 mm, a 7.9 mm one there 20.2, and the default screw's head 13.2 at 34.5 mm, all - taken with Download on. The rim is cut away under a boss whose pocket it reaches - now. So each of these has to be taken, and every pocket has to be open through its - whole volume, mouth to floor. And at 42 mm, where the rim reaches no pocket, they - have to be taken and open as before. */ + taken with Download on. A pocket from above, and a shank, that the rim stood over + were taken too. The rim is cut away under a boss whose pocket it reaches now, and a + hole that opens on the boss's top is held clear of the rim over it (mountLimits' + `rim`). So each of these, asked at the size that met the rim, has to be taken or + refused for the rim as listed, and built at the size the field takes, where every + pocket has to be open through its whole volume, mouth to floor. And at 42 mm, where + the rim reaches no pocket, they have to be taken and open as before. */ console.log('\ncorner pockets under the socket\'s rim:'); const Q = (p) => ({ pitch: p, drawerW: 4 * p, drawerD: 2 * p, bedW: 2 * p + 16, bedD: 400, baseMode: 'bosses', connector: 'none' }); @@ -2499,12 +2504,14 @@ console.log('\ncorner bosses beside a joint cut from beneath:'); ['36.13 mm, 6 mm magnet', { ...Q(36.13), magnets: true }, 'magnetD', 6, false], ['36.13 mm, 7.9 mm magnet', { ...Q(36.13), magnets: true }, 'magnetD', 7.9, false], ['34.5 mm, screws', { ...Q(34.5), screws: true }, 'screwHoleD', 3, false], + ['36.13 mm, 6 mm magnet above', { ...Q(36.13), magnets: true, magnetSide: 'top' }, 'magnetD', 6, 'rim'], + ['34.5 mm, 4.5 mm screw hole', { ...Q(34.5), screws: true }, 'screwHoleD', 4.5, 'rim'], ['42 mm, 6 mm magnet', { ...Q(42), magnets: true }, 'magnetD', 6, false], ['42 mm, 6 mm magnet above', { ...Q(42), magnets: true, magnetSide: 'top' }, 'magnetD', 6, false], ['42 mm, screws', { ...Q(42), screws: true }, 'screwHoleD', 3, false]]) { const asked = designCfg({ ...over, [f]: d }); const lims = G.mountLimits(asked, G.computeLayout(asked)); - const refused = d > lims[f] + 1e-9 && 'its cap'; + const refused = d > lims[f] + 1e-9 && (lims.rim[f] ? 'rim' : 'another cap'); const size = Math.min(d, lims[f]); const r = buildAll({ ...over, [f]: size }); const got = room(r), all = room(r, true); diff --git a/test/ui/plates-robustness.spec.js b/test/ui/plates-robustness.spec.js index 9dff088..7acb0ac 100644 --- a/test/ui/plates-robustness.spec.js +++ b/test/ui/plates-robustness.spec.js @@ -143,6 +143,15 @@ test.describe('ranges on the geometry fields', () => { ['#pi=36.13&w=144.52&d=72.26&mm=custom&ml=0&mr=0&mf=0&mb=0&bw=88.26&bd=400&cn=bowtie&km=wall&ki=bottom' + '&bm=bosses&mg=1&md=7.9', 'errMagnet', /Magnet Ø must be 6\.1 mm or less at a 36\.13 mm pitch — .* the recesses the bowtie keys fit into/], + /* #83: with corner pockets a cell is its socket's rim alone, and over a boss the rim + is the socket's wall, so a hole that opens on the boss's top has to clear it. A + 6 mm magnet from above at 36.13 mm stood 0.26 mm under the rim, and a 4.5 mm screw + hole at 34.5 mm under it too, both with Download on. */ + ['#pi=36.13&w=144.52&d=72.26&mm=custom&ml=0&mr=0&mf=0&mb=0&bw=88.26&bd=400&cn=none&bm=bosses&mg=1&ms=top', + 'errMagnet', + /Magnet Ø must be 5\.4 mm or less at a 36\.13 mm pitch — mounting holes sit 13 mm from each cell centre, where the Gridfinity spec puts them, and a magnet put in from above has to clear the socket's rim over its corner boss\./], + ['#pi=34.5&w=138&d=69&mm=custom&ml=0&mr=0&mf=0&mb=0&bw=85&bd=400&cn=none&bm=bosses&sc=1&sh=4.5', 'errScrew', + /Screw hole Ø must be 4 mm or less at a 34\.5 mm pitch — .* a screw has to clear the socket's rim over its corner boss\./], ]; for (const [hash, errId, msg] of CASES) { test(`${hash} is refused at the field`, async ({ page }) => { From bdc68b1e8c8792b83023072e84533454758e1b0d Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 10 Oct 2026 02:29:53 +0000 Subject: [PATCH 3/8] Say in ENGINE.md how a corner pocket clears the socket's rim Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- docs/ENGINE.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/ENGINE.md b/docs/ENGINE.md index 76fe938..38befa0 100644 --- a/docs/ENGINE.md +++ b/docs/ENGINE.md @@ -435,6 +435,28 @@ other, then both, and the first that comes out clean is kept; if none does, the stands. Each stands as far off the cell's walls as the first, and none nearer the pockets. +With nothing under the sockets a cell is its rim alone, from the bed up, and at small +pitches a boss's pocket runs in under it: the rim stands 2.85 mm in from the cell's edges +at the bed and 2.15 from 0.7 mm up, and further in at the socket's rounded corner, which +is the way every pocket faces, while the pockets sit `holeOffset` from the cell's centre +whatever the pitch. The pocket was cut from the boss alone, and the rim, a shell of its +own, stood in it: a 6 mm magnet from beneath at 34.5 mm had 14.6 mm³ of rim in each +pocket, in 41% of its columns, 1.8 mm³ at 36.13 mm, and the default screw's head 13.2 +mm³ at 34.5, all with Download on (#83). So where a pocket runs more than `MOUNT_SEAM` +into the rim, the rim is cut away under that corner's boss in every whole cell: a box +from under the bed to under the boss's top, two `BLOAT`s in from the cell's edges and +the boss's inner sides, whose faces stand off every face of the boss's. Cut along the +pocket's own walls instead, the rim split on the boss's lines where both stand on the +piece's edge: six more four-use edges at 34.5 mm. The box's top is the middle of the +widest gap between the planes it could meet (the rim's rings, the pockets' floors and +roofs, a joint's cuts and housings), level with none. Over the boss the rim is the +socket's wall, and is not cut: a hole that opens on the boss's top, a magnet from above +or a screw's shank, is held `MOUNT_SEAM` clear of it by `mountLimits` (`rim`), as a solid +floor's is held to its socket floor. That takes 2.5 mm off the cap of a magnet from above +and of a screw's hole at 34.5 mm (6.3 to 3.8, 6.5 to 4) and 2.4 at 38 (9.7 to 7.3); from +40 mm the boss is the tighter cap. A magnet from beneath and a screw's head lose nothing, +and a pocket the rim does not reach is built as it was, byte for byte. + `connector: 'puzzle'` used to be listed here as the first kind, and it is **no longer open anywhere**. It is worth reading how, because it needed two unrelated fixes and the lesson generalises: **an even count and an odd count on the same case are two separate @@ -843,11 +865,13 @@ currently installed): 38.5 and a snap clip in the wall up to 35. Of the 1,771 caps it lowers, 1,573 stop a tenth or two short of the first size that meets the housing, and no size taken meets one. Where an H-clip's or a snap clip's housing reaches a pocket, the room it takes is - inside the socket rim's corner, which stands in that pocket already with no joint at - all (a boss's pocket may run under the rim, #83), so the pocket has no less room with + inside the socket rim's corner, which stood in that pocket already with no joint at + all (a boss's pocket may run under the rim, #83), so the pocket had no less room with the joint than without it. The plate can still come out open there: an H-clip from above at 34 mm took a 4 mm magnet from above with 4 edges open where the cavity meets the pocket's wall, with Download on. So the cap is held off every housing alike. + Since #83 a pocket from above is held clear of the rim over its boss, which it meets + first: from 30 to 42 mm no pocket from above reaches an H-clip's or a snap clip's cup. - **A pocket in a corner boss counts the same way**, since the joint is cut from the boss too (#70), and from above its floor is measured from the boss's top: wall keys and the dovetail reach a boss's pocket up to about 39 mm, the H-clip up to about 34.5, From b1c296fa8bcd6a4cb5bc01a437ab2075f8cc5d63 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 10 Oct 2026 02:30:01 +0000 Subject: [PATCH 4/8] Rebuild the pages Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- bins/index.html | 110 ++++++++++++++++++++++++++++++++++++++++++++- index.html | 116 ++++++++++++++++++++++++++++++++++++++++++++++-- sw.js | 2 +- 3 files changed, 222 insertions(+), 6 deletions(-) diff --git a/bins/index.html b/bins/index.html index e80ab2e..df16285 100644 --- a/bins/index.html +++ b/bins/index.html @@ -4070,7 +4070,8 @@

Your drawers

* floor, or it crosses the floor's chamfer cone — see ENGINE.md §2; * - under the floor (a magnet from below, the counterbore): it must stay in its cell; * - in a corner boss: it must stay in the boss, which is shorter than the solid floor - * and does not grow with the pocket, so it also caps the depth. + * and does not grow with the pocket, so it also caps the depth; and one that opens on + * the boss's top must clear the socket's rim over it (#83). * * And whichever way it opens, it must stay out of a joint's cut in the floor beside it: * a key's recess, or the notch a tab fits into, where a dovetail's lets a pocket from @@ -4102,8 +4103,28 @@

Your drawers

const inCell = half - off - MOUNT_WALL; const s = half - off; // the site's distance in from the cell's edges const inBoss = Math.min(roomIn(BOSS_W, BOSS_R, s), s) - MOUNT_WALL; + /* A corner boss's hole that opens on its top, a magnet put in from above or a screw's + shank, has the socket's rim to pass on the way in or out, as one in a solid floor has + the edge of the socket floor; and over the boss the rim is the socket's wall, which + is not cut (buildPiece cuts the rim away under a boss, up to just under its top; + #83). From 0.7 mm up it stands 2.15 mm in from the cell's edges, and further in at + the socket's rounded corner, which is the way each site faces. Measured on the ring + buildPiece's profile makes (directCellRegion), polygon and all, from each of the four + sites, since its corners are not mirror images of one another, and MOUNT_SEAM short. + The boss alone took a 6 mm magnet from above at 36.13 mm with the rim 0.26 mm over + its pocket, and the default 3 mm screw at 33 mm with the rim 0.53 mm over its hole, + with Download on. */ + const dMid = 2.15 + tol; + const rim = roundedRectRing(0, 0, half - dMid, half - dMid, cfg.socketRadius - (dMid - cfg.topCutoff), + cfg.arcSegs || 6); + let onRim = Infinity; + for (const [x, y] of [[off, off], [-off, off], [-off, -off], [off, -off]]) + rim.forEach((a, i) => { + const b = rim[(i + 1) % rim.length], ex = b[0] - a[0], ey = b[1] - a[1]; + onRim = Math.min(onRim, (ex * (y - a[1]) - ey * (x - a[0])) / Math.hypot(ex, ey) - MOUNT_SEAM); + }); const bosses = cornerBosses(cfg); - const top = bosses ? inBoss : onFloor, under = bosses ? inBoss : inCell; + const top = bosses ? Math.min(inBoss, onRim) : onFloor, under = bosses ? inBoss : inCell; const r10 = (x) => Math.floor(x * 10 + 1e-9) / 10; // a cap is given in tenths, rounded down /* A cell's four sites are 2 × holeOffset apart, 26 mm, so past a pitch of about 50 mm the room above lets a cut reach the one beside it before it reaches anything else: @@ -4378,6 +4399,9 @@

Your drawers

beside: { magnetD: own.magnetD === beside && !joint.magnetD, screwHoleD: own.screwHoleD === beside && !joint.screwHoleD, screwHeadD: own.screwHeadD === beside && !joint.screwHeadD }, + // which the socket's rim over a corner boss stops (#83) + rim: { magnetD: bosses && cfg.magnetSide === 'top' && own.magnetD === onRim && !joint.magnetD, + screwHoleD: bosses && own.screwHoleD === onRim && !joint.screwHoleD }, // and which a joint's cut stops, before any of those, and how (jointFor) joint, // sizes under the largest refused all the same, as [from, to] with both ends taken @@ -5114,6 +5138,7 @@

Your drawers

return polys; }; let done = 0; + const rims = new Map(); // a whole cell's shell, by its column and row, for the corner bosses' pockets for (let ix = 0; ix < xs.length-1; ix++) { for (let iy = 0; iy < ys.length-1; iy++) { let x0 = Math.max(0, xs[ix] - BLOAT), x1 = Math.min(W, xs[ix+1] + BLOAT); @@ -5429,6 +5454,7 @@

Your drawers

jointCells.push(cell); } if (cellFastener) region = settle(cell, region); + if (!halfX && !halfY) rims.set(ci + ',' + cj, shells.length); shells.push(region); done++; if (onStatus && done % 8 === 0) onStatus(`cells ${done}`); @@ -5648,6 +5674,86 @@

Your drawers

shells.push(boss); } } + /* The socket's rim, cut away under a boss whose pocket it stands in (#83). With nothing + under the sockets a cell is its rim alone, from the bed up: 2.85 mm in from the + cell's edges at the bed, 2.15 from 0.7 mm up, and further in at the socket's rounded + corner, which is the way every pocket faces. The pockets sit holeOffset from the + cell's centre whatever the pitch, so at small pitches they run in under the rim, and + a boss's pocket was cut from the boss alone: the rim, a shell of its own, stood in + it. A 6 mm magnet from beneath at 34.5 mm had 14.6 mm³ of rim in each pocket, in 41% + of its columns, and 1.8 mm³ at 36.13 mm, all with Download on; a solid floor's + pockets are cut into the floor under the rim and had none. + * + So where a boss's pocket runs more than MOUNT_SEAM into its cell's rim, the rim is + cut away under the boss: a box from under the bed to a height under the boss's top, + two BLOATs in from the cell's edges and from the boss's inner sides. The boss stands + round and over all of it, so the plate is the same solid but for the pocket, which + is then the boss's own as a solid floor's is the floor's. A box, and not the pocket + again: cut along the pocket's own walls and roof, the rim came out split on the same + lines as the boss where both stand on the piece's edge, edges used four times (six + more at 34.5 mm), and a box's faces stand off every face of the boss's. Up to under + the boss's top rather than the pocket's roof, so the rim's foot, below 0.7 mm, where + it stands furthest in, goes from under a hole open on the boss's top as well; over + the foot mountLimits holds such a hole clear of the rim, since there no boss stands + round it and cutting it would cut into the socket's wall. The height is the middle + of the widest gap between the planes it could meet, the rim's own rings, the pocket's + floors and roofs and a joint's cuts and housings, so it is level with none of them: + two cuts level with each other went bad wherever #64 tried them. + * + Every whole cell's rim is the same ring, so a corner is cut in every cell or in none. + A pocket the rim does not reach leaves it as it was, and the plate is built as + before. */ + const ringZ = prof.zs.slice(1, 5), ringD = prof.ds.slice(1, 5); + // the rim's ring at height z, as directCellRegion makes it; between two rings, where + // their corners have got to, since they move in step + const ringAt = (z) => { + z = Math.max(ringZ[0], Math.min(ringZ[ringZ.length - 1], z)); + let k = 0; + while (k < ringZ.length - 2 && z > ringZ[k + 1]) k++; + const d = ringD[k] + (z - ringZ[k]) / (ringZ[k + 1] - ringZ[k]) * (ringD[k + 1] - ringD[k]); + return roundedRectRing(0, 0, half - d, half - d, prof.rTop - (d - ringD[ringD.length - 1]), cfg.arcSegs || 6); + }; + // how far the pocket at the corner (sx, sy) runs into the rim, each of its corners + // against the ring at its own height, which the walls straight up from it stand inside + const into = (sx, sy) => { + let most = -Infinity; + for (const p of bossFastener) for (const v of p.verts) { + const ring = ringAt(v[2]), x = v[0] + sx*off, y = v[1] + sy*off; + ring.forEach((a, i) => { + const b = ring[(i + 1) % ring.length], ex = b[0] - a[0], ey = b[1] - a[1]; + most = Math.max(most, (ey * (x - a[0]) - ex * (y - a[1])) / Math.hypot(ex, ey)); + }); + } + return most; + }; + const under = [[-1, -1], [-1, 1], [1, -1], [1, 1]].filter(([sx, sy]) => into(sx, sy) > MOUNT_SEAM); + if (under.length) { + const flats = (polys) => polys.filter((p) => Math.abs(p.plane.n[2]) > 0.999).map((p) => p.verts[0][2]); + // over the foot, and over every pocket's roof under the boss's top + const lo = Math.max(ringZ[1], ...bossFastener.filter((p) => p.plane.n[2] > 0.999 && p.verts[0][2] < bossH) + .map((p) => p.verts[0][2])); + const planes = [...ringZ, ...flats(bossFastener), ...fromBelow.flatMap(flats)]; + const bo = keyKind === 'recess' ? null : keyed.find((b) => !(plan.junction && offJunction(b, pitch, piece))); + if (bo) { + const op = keySiteOps(keyKind, keyShape, keyPrm, keyClr, bo.edge, bo.e, bo.s, H); + planes.push(...flats(op.cut), ...flats(op.add)); + } + const stops = [lo, bossH, ...planes.filter((z) => z > lo && z < bossH)].sort((a, b) => a - b); + let rimTop = lo, gap = -1; + for (let n = 1; n < stops.length; n++) + if (stops[n] - stops[n - 1] > gap) { gap = stops[n] - stops[n - 1]; rimTop = (stops[n] + stops[n - 1]) / 2; } + for (let i = 0; i < piece.nx; i++) for (let j = 0; j < piece.ny; j++) { + const k = rims.get(i + ',' + j); + if (k === undefined) continue; + const cut = [].concat(...under.map(([sx, sy]) => { + const cxr = gx0 + i*pitch + half + sx*half, cyr = gy0 + j*pitch + half + sy*half; // the cell's corner + const x0 = cxr - sx*2*BLOAT, x1 = cxr - sx*(bossW - 2*BLOAT); + const y0 = cyr - sy*2*BLOAT, y1 = cyr - sy*(bossW - 2*BLOAT); + return extrudePoly([[x0, y0], [x1, y0], [x1, y1], [x0, y1]], -0.5, rimTop); + })); + shells[k] = cutAgain(shells[k], cut, csgSubtract(shells[k], cut)); + } + } } // ---- puzzle male tabs (protrude at floor level) ---- diff --git a/index.html b/index.html index 0df01a2..3e60297 100644 --- a/index.html +++ b/index.html @@ -3857,7 +3857,8 @@

Your drawers

* floor, or it crosses the floor's chamfer cone — see ENGINE.md §2; * - under the floor (a magnet from below, the counterbore): it must stay in its cell; * - in a corner boss: it must stay in the boss, which is shorter than the solid floor - * and does not grow with the pocket, so it also caps the depth. + * and does not grow with the pocket, so it also caps the depth; and one that opens on + * the boss's top must clear the socket's rim over it (#83). * * And whichever way it opens, it must stay out of a joint's cut in the floor beside it: * a key's recess, or the notch a tab fits into, where a dovetail's lets a pocket from @@ -3889,8 +3890,28 @@

Your drawers

const inCell = half - off - MOUNT_WALL; const s = half - off; // the site's distance in from the cell's edges const inBoss = Math.min(roomIn(BOSS_W, BOSS_R, s), s) - MOUNT_WALL; + /* A corner boss's hole that opens on its top, a magnet put in from above or a screw's + shank, has the socket's rim to pass on the way in or out, as one in a solid floor has + the edge of the socket floor; and over the boss the rim is the socket's wall, which + is not cut (buildPiece cuts the rim away under a boss, up to just under its top; + #83). From 0.7 mm up it stands 2.15 mm in from the cell's edges, and further in at + the socket's rounded corner, which is the way each site faces. Measured on the ring + buildPiece's profile makes (directCellRegion), polygon and all, from each of the four + sites, since its corners are not mirror images of one another, and MOUNT_SEAM short. + The boss alone took a 6 mm magnet from above at 36.13 mm with the rim 0.26 mm over + its pocket, and the default 3 mm screw at 33 mm with the rim 0.53 mm over its hole, + with Download on. */ + const dMid = 2.15 + tol; + const rim = roundedRectRing(0, 0, half - dMid, half - dMid, cfg.socketRadius - (dMid - cfg.topCutoff), + cfg.arcSegs || 6); + let onRim = Infinity; + for (const [x, y] of [[off, off], [-off, off], [-off, -off], [off, -off]]) + rim.forEach((a, i) => { + const b = rim[(i + 1) % rim.length], ex = b[0] - a[0], ey = b[1] - a[1]; + onRim = Math.min(onRim, (ex * (y - a[1]) - ey * (x - a[0])) / Math.hypot(ex, ey) - MOUNT_SEAM); + }); const bosses = cornerBosses(cfg); - const top = bosses ? inBoss : onFloor, under = bosses ? inBoss : inCell; + const top = bosses ? Math.min(inBoss, onRim) : onFloor, under = bosses ? inBoss : inCell; const r10 = (x) => Math.floor(x * 10 + 1e-9) / 10; // a cap is given in tenths, rounded down /* A cell's four sites are 2 × holeOffset apart, 26 mm, so past a pitch of about 50 mm the room above lets a cut reach the one beside it before it reaches anything else: @@ -4165,6 +4186,9 @@

Your drawers

beside: { magnetD: own.magnetD === beside && !joint.magnetD, screwHoleD: own.screwHoleD === beside && !joint.screwHoleD, screwHeadD: own.screwHeadD === beside && !joint.screwHeadD }, + // which the socket's rim over a corner boss stops (#83) + rim: { magnetD: bosses && cfg.magnetSide === 'top' && own.magnetD === onRim && !joint.magnetD, + screwHoleD: bosses && own.screwHoleD === onRim && !joint.screwHoleD }, // and which a joint's cut stops, before any of those, and how (jointFor) joint, // sizes under the largest refused all the same, as [from, to] with both ends taken @@ -4901,6 +4925,7 @@

Your drawers

return polys; }; let done = 0; + const rims = new Map(); // a whole cell's shell, by its column and row, for the corner bosses' pockets for (let ix = 0; ix < xs.length-1; ix++) { for (let iy = 0; iy < ys.length-1; iy++) { let x0 = Math.max(0, xs[ix] - BLOAT), x1 = Math.min(W, xs[ix+1] + BLOAT); @@ -5216,6 +5241,7 @@

Your drawers

jointCells.push(cell); } if (cellFastener) region = settle(cell, region); + if (!halfX && !halfY) rims.set(ci + ',' + cj, shells.length); shells.push(region); done++; if (onStatus && done % 8 === 0) onStatus(`cells ${done}`); @@ -5435,6 +5461,86 @@

Your drawers

shells.push(boss); } } + /* The socket's rim, cut away under a boss whose pocket it stands in (#83). With nothing + under the sockets a cell is its rim alone, from the bed up: 2.85 mm in from the + cell's edges at the bed, 2.15 from 0.7 mm up, and further in at the socket's rounded + corner, which is the way every pocket faces. The pockets sit holeOffset from the + cell's centre whatever the pitch, so at small pitches they run in under the rim, and + a boss's pocket was cut from the boss alone: the rim, a shell of its own, stood in + it. A 6 mm magnet from beneath at 34.5 mm had 14.6 mm³ of rim in each pocket, in 41% + of its columns, and 1.8 mm³ at 36.13 mm, all with Download on; a solid floor's + pockets are cut into the floor under the rim and had none. + * + So where a boss's pocket runs more than MOUNT_SEAM into its cell's rim, the rim is + cut away under the boss: a box from under the bed to a height under the boss's top, + two BLOATs in from the cell's edges and from the boss's inner sides. The boss stands + round and over all of it, so the plate is the same solid but for the pocket, which + is then the boss's own as a solid floor's is the floor's. A box, and not the pocket + again: cut along the pocket's own walls and roof, the rim came out split on the same + lines as the boss where both stand on the piece's edge, edges used four times (six + more at 34.5 mm), and a box's faces stand off every face of the boss's. Up to under + the boss's top rather than the pocket's roof, so the rim's foot, below 0.7 mm, where + it stands furthest in, goes from under a hole open on the boss's top as well; over + the foot mountLimits holds such a hole clear of the rim, since there no boss stands + round it and cutting it would cut into the socket's wall. The height is the middle + of the widest gap between the planes it could meet, the rim's own rings, the pocket's + floors and roofs and a joint's cuts and housings, so it is level with none of them: + two cuts level with each other went bad wherever #64 tried them. + * + Every whole cell's rim is the same ring, so a corner is cut in every cell or in none. + A pocket the rim does not reach leaves it as it was, and the plate is built as + before. */ + const ringZ = prof.zs.slice(1, 5), ringD = prof.ds.slice(1, 5); + // the rim's ring at height z, as directCellRegion makes it; between two rings, where + // their corners have got to, since they move in step + const ringAt = (z) => { + z = Math.max(ringZ[0], Math.min(ringZ[ringZ.length - 1], z)); + let k = 0; + while (k < ringZ.length - 2 && z > ringZ[k + 1]) k++; + const d = ringD[k] + (z - ringZ[k]) / (ringZ[k + 1] - ringZ[k]) * (ringD[k + 1] - ringD[k]); + return roundedRectRing(0, 0, half - d, half - d, prof.rTop - (d - ringD[ringD.length - 1]), cfg.arcSegs || 6); + }; + // how far the pocket at the corner (sx, sy) runs into the rim, each of its corners + // against the ring at its own height, which the walls straight up from it stand inside + const into = (sx, sy) => { + let most = -Infinity; + for (const p of bossFastener) for (const v of p.verts) { + const ring = ringAt(v[2]), x = v[0] + sx*off, y = v[1] + sy*off; + ring.forEach((a, i) => { + const b = ring[(i + 1) % ring.length], ex = b[0] - a[0], ey = b[1] - a[1]; + most = Math.max(most, (ey * (x - a[0]) - ex * (y - a[1])) / Math.hypot(ex, ey)); + }); + } + return most; + }; + const under = [[-1, -1], [-1, 1], [1, -1], [1, 1]].filter(([sx, sy]) => into(sx, sy) > MOUNT_SEAM); + if (under.length) { + const flats = (polys) => polys.filter((p) => Math.abs(p.plane.n[2]) > 0.999).map((p) => p.verts[0][2]); + // over the foot, and over every pocket's roof under the boss's top + const lo = Math.max(ringZ[1], ...bossFastener.filter((p) => p.plane.n[2] > 0.999 && p.verts[0][2] < bossH) + .map((p) => p.verts[0][2])); + const planes = [...ringZ, ...flats(bossFastener), ...fromBelow.flatMap(flats)]; + const bo = keyKind === 'recess' ? null : keyed.find((b) => !(plan.junction && offJunction(b, pitch, piece))); + if (bo) { + const op = keySiteOps(keyKind, keyShape, keyPrm, keyClr, bo.edge, bo.e, bo.s, H); + planes.push(...flats(op.cut), ...flats(op.add)); + } + const stops = [lo, bossH, ...planes.filter((z) => z > lo && z < bossH)].sort((a, b) => a - b); + let rimTop = lo, gap = -1; + for (let n = 1; n < stops.length; n++) + if (stops[n] - stops[n - 1] > gap) { gap = stops[n] - stops[n - 1]; rimTop = (stops[n] + stops[n - 1]) / 2; } + for (let i = 0; i < piece.nx; i++) for (let j = 0; j < piece.ny; j++) { + const k = rims.get(i + ',' + j); + if (k === undefined) continue; + const cut = [].concat(...under.map(([sx, sy]) => { + const cxr = gx0 + i*pitch + half + sx*half, cyr = gy0 + j*pitch + half + sy*half; // the cell's corner + const x0 = cxr - sx*2*BLOAT, x1 = cxr - sx*(bossW - 2*BLOAT); + const y0 = cyr - sy*2*BLOAT, y1 = cyr - sy*(bossW - 2*BLOAT); + return extrudePoly([[x0, y0], [x1, y0], [x1, y1], [x0, y1]], -0.5, rimTop); + })); + shells[k] = cutAgain(shells[k], cut, csgSubtract(shells[k], cut)); + } + } } // ---- puzzle male tabs (protrude at floor level) ---- @@ -7906,7 +8012,9 @@

Your drawers

`joint` names: a pocket from beneath as deep as a dovetail's notch, a magnet or screw that would reach the tab in one, a pocket any wider coming too near the notch's edge, a hole that would meet the housing of a key put in from above ('housing'), - or any other hole breaking into the cut. The hint about keys put in from above is not + or any other hole breaking into the cut. With no joint in the way, a hole that opens on + a corner boss's top, a magnet put in from above or a screw's shank, can stop at the + socket's rim over the boss (`rim`, #83). The hint about keys put in from above is not given with corner pockets: there is no solid floor under them, and such a key's cup reaches a boss's pocket (#75). Nor where the bosses are buried in the floor a joint needs (cornerBosses): a key put in from above, in the walls, needs none, so @@ -7929,6 +8037,8 @@

Your drawers

: `; put in from beneath, the ${CONNECTOR_NAMES[state.connector]} leave more room`) : joint ? `a hole has to stay out of the ${cuts}` : mount().beside[field] ? 'a cell\'s four holes have to stay clear of each other' + : mount().rim[field] ? `${field === 'magnetD' ? 'a magnet put in from above' : 'a screw'} has to ` + + 'clear the socket\'s rim over its corner boss' : cornerBosses(state) ? 'a pocket has to stay inside its corner boss' : opens ? 'a cut open to the socket has to stay on the socket floor' : 'a pocket under the floor has to stay inside its cell') + diff --git a/sw.js b/sw.js index 2c0a7c0..a378842 100644 --- a/sw.js +++ b/sw.js @@ -52,7 +52,7 @@ load from this site, and the app's icons and manifest, as paths from the root. VERSION is a hash of all of those files, names and bytes, and of this script as it is served, FILES filled in and everything else but VERSION itself. */ -const VERSION = "63217bf3b668"; +const VERSION = "367a6dc44131"; const FILES = [ "./", "bins/", From 053666326801e550107248298d5e4100274c4072 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 10 Oct 2026 02:31:25 +0000 Subject: [PATCH 5/8] Move the rim's lines off the ones the screw-flats change touches, so the two merge without a conflict Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- src/core.js | 6 +++--- test/ui/plates-robustness.spec.js | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core.js b/src/core.js index 88036b8..e9ccc9c 100644 --- a/src/core.js +++ b/src/core.js @@ -2789,13 +2789,13 @@ function mountLimits(cfg, layout, known) { screwHeadD: sizes.screwHeadD, // in the solid floor the pad grows to suit, so only a boss caps the depth depth: bosses ? r10(BOSS_H - MOUNT_SKIN) : Infinity, + // which the socket's rim over a corner boss stops (#83) + rim: { magnetD: bosses && cfg.magnetSide === 'top' && own.magnetD === onRim && !joint.magnetD, + screwHoleD: bosses && own.screwHoleD === onRim && !joint.screwHoleD }, // which of the sizes the cut beside it stops, rather than the floor, cell or boss beside: { magnetD: own.magnetD === beside && !joint.magnetD, screwHoleD: own.screwHoleD === beside && !joint.screwHoleD, screwHeadD: own.screwHeadD === beside && !joint.screwHeadD }, - // which the socket's rim over a corner boss stops (#83) - rim: { magnetD: bosses && cfg.magnetSide === 'top' && own.magnetD === onRim && !joint.magnetD, - screwHoleD: bosses && own.screwHoleD === onRim && !joint.screwHoleD }, // and which a joint's cut stops, before any of those, and how (jointFor) joint, // sizes under the largest refused all the same, as [from, to] with both ends taken diff --git a/test/ui/plates-robustness.spec.js b/test/ui/plates-robustness.spec.js index 7acb0ac..a45e9bb 100644 --- a/test/ui/plates-robustness.spec.js +++ b/test/ui/plates-robustness.spec.js @@ -137,12 +137,6 @@ test.describe('ranges on the geometry fields', () => { ['#pi=36.13&w=144.52&d=72.26&mm=custom&ml=0&mr=0&mf=0&mb=0&bw=88.26&bd=400&cn=bowtie&km=wall&ki=top' + '&bm=bosses&mg=1', 'errMagnet', /Magnet Ø must be 5 mm or less at a 36\.13 mm pitch — mounting holes sit 13 mm from each cell centre, where the Gridfinity spec puts them, and a hole has to stay out of the housings the bowtie keys drop into from above; put in from beneath, the bowtie keys leave more room\./], - /* #70: the joint is cut from the corner bosses now, so a boss's pocket can reach it as - a cell's can. A bowtie key in the walls at 36.13 mm took a 7.9 mm magnet, and with - the recess cut from the bosses it would have built 19 open edges a piece. */ - ['#pi=36.13&w=144.52&d=72.26&mm=custom&ml=0&mr=0&mf=0&mb=0&bw=88.26&bd=400&cn=bowtie&km=wall&ki=bottom' + - '&bm=bosses&mg=1&md=7.9', 'errMagnet', - /Magnet Ø must be 6\.1 mm or less at a 36\.13 mm pitch — .* the recesses the bowtie keys fit into/], /* #83: with corner pockets a cell is its socket's rim alone, and over a boss the rim is the socket's wall, so a hole that opens on the boss's top has to clear it. A 6 mm magnet from above at 36.13 mm stood 0.26 mm under the rim, and a 4.5 mm screw @@ -152,6 +146,12 @@ test.describe('ranges on the geometry fields', () => { /Magnet Ø must be 5\.4 mm or less at a 36\.13 mm pitch — mounting holes sit 13 mm from each cell centre, where the Gridfinity spec puts them, and a magnet put in from above has to clear the socket's rim over its corner boss\./], ['#pi=34.5&w=138&d=69&mm=custom&ml=0&mr=0&mf=0&mb=0&bw=85&bd=400&cn=none&bm=bosses&sc=1&sh=4.5', 'errScrew', /Screw hole Ø must be 4 mm or less at a 34\.5 mm pitch — .* a screw has to clear the socket's rim over its corner boss\./], + /* #70: the joint is cut from the corner bosses now, so a boss's pocket can reach it as + a cell's can. A bowtie key in the walls at 36.13 mm took a 7.9 mm magnet, and with + the recess cut from the bosses it would have built 19 open edges a piece. */ + ['#pi=36.13&w=144.52&d=72.26&mm=custom&ml=0&mr=0&mf=0&mb=0&bw=88.26&bd=400&cn=bowtie&km=wall&ki=bottom' + + '&bm=bosses&mg=1&md=7.9', 'errMagnet', + /Magnet Ø must be 6\.1 mm or less at a 36\.13 mm pitch — .* the recesses the bowtie keys fit into/], ]; for (const [hash, errId, msg] of CASES) { test(`${hash} is refused at the field`, async ({ page }) => { From ca6dcff156e9c25aab9d32ec1a0a7b054db42ac5 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 10 Oct 2026 02:31:26 +0000 Subject: [PATCH 6/8] Rebuild the pages Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- bins/index.html | 6 +++--- index.html | 6 +++--- sw.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bins/index.html b/bins/index.html index df16285..de2d466 100644 --- a/bins/index.html +++ b/bins/index.html @@ -4395,13 +4395,13 @@

Your drawers

screwHeadD: sizes.screwHeadD, // in the solid floor the pad grows to suit, so only a boss caps the depth depth: bosses ? r10(BOSS_H - MOUNT_SKIN) : Infinity, + // which the socket's rim over a corner boss stops (#83) + rim: { magnetD: bosses && cfg.magnetSide === 'top' && own.magnetD === onRim && !joint.magnetD, + screwHoleD: bosses && own.screwHoleD === onRim && !joint.screwHoleD }, // which of the sizes the cut beside it stops, rather than the floor, cell or boss beside: { magnetD: own.magnetD === beside && !joint.magnetD, screwHoleD: own.screwHoleD === beside && !joint.screwHoleD, screwHeadD: own.screwHeadD === beside && !joint.screwHeadD }, - // which the socket's rim over a corner boss stops (#83) - rim: { magnetD: bosses && cfg.magnetSide === 'top' && own.magnetD === onRim && !joint.magnetD, - screwHoleD: bosses && own.screwHoleD === onRim && !joint.screwHoleD }, // and which a joint's cut stops, before any of those, and how (jointFor) joint, // sizes under the largest refused all the same, as [from, to] with both ends taken diff --git a/index.html b/index.html index 3e60297..3c3d924 100644 --- a/index.html +++ b/index.html @@ -4182,13 +4182,13 @@

Your drawers

screwHeadD: sizes.screwHeadD, // in the solid floor the pad grows to suit, so only a boss caps the depth depth: bosses ? r10(BOSS_H - MOUNT_SKIN) : Infinity, + // which the socket's rim over a corner boss stops (#83) + rim: { magnetD: bosses && cfg.magnetSide === 'top' && own.magnetD === onRim && !joint.magnetD, + screwHoleD: bosses && own.screwHoleD === onRim && !joint.screwHoleD }, // which of the sizes the cut beside it stops, rather than the floor, cell or boss beside: { magnetD: own.magnetD === beside && !joint.magnetD, screwHoleD: own.screwHoleD === beside && !joint.screwHoleD, screwHeadD: own.screwHeadD === beside && !joint.screwHeadD }, - // which the socket's rim over a corner boss stops (#83) - rim: { magnetD: bosses && cfg.magnetSide === 'top' && own.magnetD === onRim && !joint.magnetD, - screwHoleD: bosses && own.screwHoleD === onRim && !joint.screwHoleD }, // and which a joint's cut stops, before any of those, and how (jointFor) joint, // sizes under the largest refused all the same, as [from, to] with both ends taken diff --git a/sw.js b/sw.js index a378842..a298dd2 100644 --- a/sw.js +++ b/sw.js @@ -52,7 +52,7 @@ load from this site, and the app's icons and manifest, as paths from the root. VERSION is a hash of all of those files, names and bytes, and of this script as it is served, FILES filled in and everything else but VERSION itself. */ -const VERSION = "367a6dc44131"; +const VERSION = "698fc6a0470c"; const FILES = [ "./", "bins/", From e6b68ebbc5c31f08110e176745b711b30459c25a Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 10 Oct 2026 02:32:17 +0000 Subject: [PATCH 7/8] The page test for a screw held clear of the rim pins its reason, which stays the same when the shank's bore changes Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- test/ui/plates-robustness.spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/ui/plates-robustness.spec.js b/test/ui/plates-robustness.spec.js index a45e9bb..05a42ae 100644 --- a/test/ui/plates-robustness.spec.js +++ b/test/ui/plates-robustness.spec.js @@ -140,12 +140,13 @@ test.describe('ranges on the geometry fields', () => { /* #83: with corner pockets a cell is its socket's rim alone, and over a boss the rim is the socket's wall, so a hole that opens on the boss's top has to clear it. A 6 mm magnet from above at 36.13 mm stood 0.26 mm under the rim, and a 4.5 mm screw - hole at 34.5 mm under it too, both with Download on. */ + hole at 34.5 mm under it too, both with Download on. The screw's cap goes by how + its bore's corners stand off its size, so only the reason is pinned. */ ['#pi=36.13&w=144.52&d=72.26&mm=custom&ml=0&mr=0&mf=0&mb=0&bw=88.26&bd=400&cn=none&bm=bosses&mg=1&ms=top', 'errMagnet', /Magnet Ø must be 5\.4 mm or less at a 36\.13 mm pitch — mounting holes sit 13 mm from each cell centre, where the Gridfinity spec puts them, and a magnet put in from above has to clear the socket's rim over its corner boss\./], ['#pi=34.5&w=138&d=69&mm=custom&ml=0&mr=0&mf=0&mb=0&bw=85&bd=400&cn=none&bm=bosses&sc=1&sh=4.5', 'errScrew', - /Screw hole Ø must be 4 mm or less at a 34\.5 mm pitch — .* a screw has to clear the socket's rim over its corner boss\./], + /Screw hole Ø must be [\d.]+ mm or less at a 34\.5 mm pitch — .* a screw has to clear the socket's rim over its corner boss\./], /* #70: the joint is cut from the corner bosses now, so a boss's pocket can reach it as a cell's can. A bowtie key in the walls at 36.13 mm took a 7.9 mm magnet, and with the recess cut from the bosses it would have built 19 open edges a piece. */ From 894b6dd3209814292457755728cc61da33147637 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 10 Oct 2026 05:46:16 +0000 Subject: [PATCH 8/8] Say that the socket's rim stops a pocket from above before an H-clip's cup only up to a fit of 0.25 mm, and where a looser fit lets the cup come first Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- docs/ENGINE.md | 13 +++++++++++-- test/plate-audit.js | 10 ++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/ENGINE.md b/docs/ENGINE.md index 38befa0..05266ba 100644 --- a/docs/ENGINE.md +++ b/docs/ENGINE.md @@ -870,8 +870,17 @@ currently installed): the joint than without it. The plate can still come out open there: an H-clip from above at 34 mm took a 4 mm magnet from above with 4 edges open where the cavity meets the pocket's wall, with Download on. So the cap is held off every housing alike. - Since #83 a pocket from above is held clear of the rim over its boss, which it meets - first: from 30 to 42 mm no pocket from above reaches an H-clip's or a snap clip's cup. + Since #83 a pocket from above is held clear of the rim over its boss, and it meets the + rim first at any fit clearance up to 0.25 mm (the default is 0.2), whatever the + tolerance and rim cutoff: from 30 to 42 mm no such pocket then reaches an H-clip's or + a snap clip's cup. A snap clip's fit stops at 0.3, and the rim comes first at every + one. An H-clip's runs to 1 mm, and a looser one widens its cup until the cup comes + first, so the housing's cap holds the pocket instead: from a fit of 0.26 at loose + tolerance and rim cutoff 0.1 (0.52 at cutoff 1), from 0.42 at standard tolerance and + the default cutoff (0.33 to 0.59 as the cutoff goes from 0.1 to 1), and from 0.4 to + 0.67 at tight. At loose, cutoff 0.1 and fit 0.3 that is a magnet from above from about + 32.3 to 34 mm and a screw hole from 32.1 to 33.8: at 33 mm a 2.1 mm magnet is refused + at 2 for the housing, where the rim alone would take it. - **A pocket in a corner boss counts the same way**, since the joint is cut from the boss too (#70), and from above its floor is measured from the boss's top: wall keys and the dovetail reach a boss's pocket up to about 39 mm, the H-clip up to about 34.5, diff --git a/test/plate-audit.js b/test/plate-audit.js index 5401f49..dbd778a 100644 --- a/test/plate-audit.js +++ b/test/plate-audit.js @@ -2469,8 +2469,14 @@ console.log('\ncorner bosses beside a joint cut from beneath:'); field takes with no edge open: the bowtie's for the housing, and the H-clip's for the socket's rim. The H-clip's cup stands inside the rim's corner, and a pocket from above has to clear the rim over its boss since #83 (below), which it meets - first: from 30 to 42 mm no pocket from above reaches an H-clip's or a snap clip's - cup that the rim does not stop sooner. */ + first at any fit clearance up to 0.25 mm, this row's default 0.2 among them, + whatever the tolerance and rim cutoff: from 30 to 42 mm no pocket from above then + reaches an H-clip's or a snap clip's cup that the rim does not stop sooner. A + looser H-clip fit widens the cup until it comes first, and the housing's cap holds + the pocket, as it did here before #83: from a fit of 0.26 at loose tolerance and + rim cutoff 0.1, where a 2.1 mm magnet from above at 33 mm is refused at 2 for the + housing, and from 0.42 at standard tolerance and the default cutoff (ENGINE.md + §5). */ for (const [name, over, d, why] of [ ['H-clip at 34 mm, 4 mm magnet above', { ...P(34), connector: 'hclip', magnets: true, magnetSide: 'top' }, 4, 'rim'], ['wall bowtie at 36.13 mm, 7.9 x 1.45', { ...P(36.13), magnets: true, magnetH: 1.45 }, 7.9, 'housing']]) {