From 8e4fe2019813c283e76d64be90d1ce9e04e60b58 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 10:27:02 +0000 Subject: [PATCH 01/16] Cut a joint's housing from the corner bosses, and keep their pockets open With Mounting base set to corner pockets, a joint cut from beneath where four cells meet (a wall key's recess, an H-clip's, a dovetail's or a puzzle's notch) was cut from the cells and not from the bosses, so the bosses stood in the whole housing and nothing could go in. And a joint housed in a floor (keys at 2.8 mm, the puzzle's lobes at 2.6) or an extra floor stood round the 2.6 mm bosses and sealed their pockets in it. Both built with Download on (#70). - cornerBosses: the bosses are built only on an open underside. Over a floor the plate is built as a solid floor builds it, its pockets cut into the floor and the floor grown to suit them. - The joint's cuts from beneath are taken out of the bosses after their pockets. A boss a housing reaches stops a BLOAT short of the piece's edge, the two either side of one housing are one solid, and the cut is moved NUDGE into its own boss, so the cut adds no edge used four times (an H-clip at 42 mm goes from 40 a piece to 31) and none used once. A boss no housing reaches is built as before, byte for byte. - mountLimits holds a boss's pocket out of a joint's cut, as #64 does a cell's: with the housing cut from the boss, wall keys and the dovetail reach a boss pocket up to about 39 mm and the H-clip to about 34.5. The audit builds each joint cut from beneath, puzzle tabs and an extra floor with corner bosses, each way a pocket is cut, and reads the housing and the pockets along vertical lines: all 18 fail on the base and pass here. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- docs/ENGINE.md | 21 ++++++- src/core.js | 141 +++++++++++++++++++++++++++++++++++++++----- test/plate-audit.js | 117 ++++++++++++++++++++++++++++++++++++ 3 files changed, 262 insertions(+), 17 deletions(-) diff --git a/docs/ENGINE.md b/docs/ENGINE.md index 0b03935..2aa979a 100644 --- a/docs/ENGINE.md +++ b/docs/ENGINE.md @@ -385,6 +385,21 @@ the cell boundary instead of overlapping by `BLOAT`, so every shared face is cou twice, and no edge is ever used once. Bloating the bosses would fix it, at the cost of changing their footprint. Far better than it was (2964 and 8332), still not fixed. +Corner bosses are built only on an open underside (`cornerBosses`). A floor under the +sockets, a key housed in the floor (2.8 mm), the puzzle's lobes (2.6) or Extra floor, +stood round the 2.6 mm bosses and sealed their pockets in it (#70); with one, the plate is +built as a solid floor builds it, pockets and the floor's growth included, and Checks says +so. A joint cut from beneath where four cells meet (a wall key's recess, an H-clip's, a +dovetail's or a puzzle's notch) is taken out of the bosses as well as the cells, after +their pockets; the bosses used to stand in the whole housing. Cut plainly, the housing's +outline went into the boss and into the cell it shares faces with, and into both of two +bosses meeting across a cell edge: an H-clip at 42 mm went from 40 edges used four times +a piece to 59 and 68. So a boss a housing reaches stops a `BLOAT` short of the piece's +edge, the two either side of one housing are built as one solid, and the cut is moved +`NUDGE` into its own boss, so its walls stand 1.7 microns from the cell's. That leaves +fewer four-use edges than before (31 a piece for that H-clip) and none used once, and a +boss no housing reaches is built byte for byte as it was. + `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 @@ -768,8 +783,10 @@ currently installed): joints, 71 pitches and five cuts, none that stopped short of the cut built a bad edge, and the first went bad 0.035 mm into it. A pocket from above meets a cut unless its floor stands a layer over the cut's ceiling. The housings a key is dropped into from - above start 1.3 mm over the socket floor and nothing reaches them, and a pocket in a - corner boss is left out: the boss is a shell of its own, and no joint is cut from it. + above start 1.3 mm over the socket floor and nothing reaches them. 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, and nothing at 42. - **A joint's cut is the same lottery, and below 16 mm it comes up often.** The socket's straight walls run only 2.5 mm either side of a cell's middle at 13.5 mm, so every housing, notch and clip pocket crosses its corner arcs and cones, at points that move diff --git a/src/core.js b/src/core.js index 36e5684..6f7abee 100644 --- a/src/core.js +++ b/src/core.js @@ -2292,6 +2292,30 @@ const MOUNT_SKIN = PRINT_LAYER; corner, its inner corner rounded, never taller than BOSS_H. Named because mountLimits has to know how much room a boss leaves around its pocket. */ const BOSS_W = 12.5, BOSS_R = 3.5, BOSS_H = 2.6; +/* How tall a corner boss is built: enough for its pocket and a layer, up to BOSS_H. */ +const bossHeight = (cfg) => Math.min(BOSS_H, Math.max( + cfg.magnets ? cfg.magnetH + 0.8 : 0, + cfg.screws ? cfg.screwHeadDepth + 1.0 : 0)); + +/* The floor a joint houses itself in: keys in the floor, and the puzzle's lobes, whose + notch runs up into it. None for the rest. */ +function jointFloor(cfg) { + const keyedConn = ['bowtie', 'snap', 'puzzlekey'].includes(cfg.connector); + if (keyedConn && cfg.keyMount !== 'wall') return cfg.key.depth + 0.8; + return cfg.connector === 'puzzle' ? 2.6 : 0; +} + +/* Whether the corner bosses are built: baseMode 'bosses', and nothing under them. A boss + stands on the bed, up to 2.6 mm, with its pocket opening below it or on top of it. A + floor under the sockets, the one a joint houses itself in (2.8 mm for keys, 2.6 for the + puzzle's lobes) or one asked for, would stand round it as tall or taller: the bosses + were buried in it and their pockets with them, sealed in solid or cut short by it, and + no magnet could go in (#70). A floor is what a solid base is, so with one the plate is + built as a solid base builds it, its pockets cut into the floor and the floor grown to + suit them; a boss would only have stood inside it. */ +function cornerBosses(cfg) { + return cfg.baseMode === 'bosses' && !(cfg.bottomPad > 0) && !(jointFloor(cfg) > 0); +} /* How thick the solid floor under the sockets is: what was asked for, raised to whatever the plate is carrying needs. A pocket cut into the floor — a magnet from either side, a @@ -2304,16 +2328,13 @@ function platePad(cfg) { /* Rounded to the micron, because 2.6 + 0.2 is 2.8000000000000003 and that is not a reason to move every face of a plate that was 2.8 before. */ const under = (depth) => Math.round((depth + MOUNT_SKIN) * 1e6) / 1e6; - if ((cfg.magnets || cfg.screws) && cfg.baseMode !== 'bosses') { + if ((cfg.magnets || cfg.screws) && !cornerBosses(cfg)) { pad = Math.max(pad, cfg.magnetBase || 2.8); if (cfg.magnets) pad = Math.max(pad, under(cfg.magnetH)); if (cfg.screws && cfg.screwHeadD > cfg.screwHoleD) pad = Math.max(pad, under(cfg.screwHeadDepth)); } - const keyedConn = ['bowtie', 'snap', 'puzzlekey'].includes(cfg.connector); - if (keyedConn && cfg.keyMount !== 'wall') pad = Math.max(pad, cfg.key.depth + 0.8); - if (cfg.connector === 'puzzle') pad = Math.max(pad, 2.6); - return pad; + return Math.max(pad, jointFloor(cfg)); } /* Plastic left round a mounting cut, to whatever holds it. 1 mm rather than a token @@ -2360,7 +2381,7 @@ function mountLimits(cfg, layout) { 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; - const bosses = cfg.baseMode === 'bosses'; + const bosses = cornerBosses(cfg); const top = bosses ? inBoss : onFloor, under = bosses ? inBoss : inCell; const r10 = (x) => Math.floor(x * 10 + 1e-9) / 10; // the fields step in tenths /* A cell's four sites are 2 × holeOffset apart, 26 mm, so past a pitch of about 50 mm @@ -2382,8 +2403,10 @@ function mountLimits(cfg, layout) { Measured off the solids buildPiece cuts, at the sites it cuts pockets at: whole cells only, so a housing beside a half cell or a margin is measured from the whole cell on - the other side of it, which is the only one with pockets. A corner boss is left out: - its pocket is cut in the boss, a shell of its own that no joint is cut from. + the other side of it, which is the only one with pockets. A corner boss's pocket is at + the same site, and the joint is cut out of the boss too (#70), so it counts the same + way; a pocket from above in a boss has its floor the pocket's depth under the boss's + top rather than the floor's. Issue #64: a bowtie in the floor at 42 mm, with magnets from beneath, built 12 bad edges at 7.9 mm and 19 at 10, with Download on; puzzle tabs at 36 to 40 mm built 26 @@ -2407,7 +2430,7 @@ function mountLimits(cfg, layout) { plate the page will build has at most 900 cells; at 30 × 30 with puzzle tabs this is a few milliseconds, on every redraw. */ const reach = Math.max(fit(top), fit(under)); - if (layout && !bosses && cfg.connector !== 'none' && reach > 0) { + if (layout && cfg.connector !== 'none' && reach > 0) { const plan = keyPlan(cfg), pad = platePad(cfg), H = pad + cfg.plateHeight; /* A cut's footprint, as the segments its walls stand on, its extent and its ceiling, for each seam it can be cut from. Every cut from one seam is the same solid moved @@ -2476,7 +2499,7 @@ function mountLimits(cfg, layout) { c.top + MOUNT_SKIN > z + 1e-6 ? Math.min(m, c.room) : m, Infinity); const below = jointRoom(-Infinity); // a magnet from beneath, a counterbore, a shank const magnetJoint = cfg.magnetSide === 'top' && jointCuts.length - ? jointRoom(platePad(cfg) - cfg.magnetH) : below; + ? jointRoom((bosses ? bossHeight(cfg) : platePad(cfg)) - cfg.magnetH) : below; const own = fit(cfg.magnetSide === 'top' ? top : under); const room = Math.min(own, magnetJoint); return { @@ -2663,7 +2686,7 @@ function jointsThatFit(cfg, layout) { and bloated 0.05mm so shells overlap; slicers union overlapping shells. */ function buildPiece(cfg, layout, piece, onStatus) { const pitch = cfg.pitch, half = pitch/2; - const solidBase = cfg.baseMode !== 'bosses'; + const solidBase = !cornerBosses(cfg); // with a floor under them, bosses are a solid base const pad = platePad(cfg); const isHclip = cfg.connector === 'hclip'; const topInsert = cfg.keyInsert === 'top'; @@ -3538,15 +3561,69 @@ function buildPiece(cfg, layout, piece, onStatus) { const bossW = BOSS_W, rIn = BOSS_R; // never more than BOSS_H, so a pocket deeper than BOSS_H − MOUNT_SKIN would come out // through the top: mountLimits refuses one rather than this growing past it - const bossH = Math.min(BOSS_H, Math.max( - cfg.magnets ? cfg.magnetH + 0.8 : 0, - cfg.screws ? cfg.screwHeadDepth + 1.0 : 0)); + const bossH = bossHeight(cfg); const bossFastener = fastenerCutter(cfg, bossH - cfg.magnetH, bossH + 0.5, bossH + 0.5); + /* The joint's cuts from beneath are taken out of the bosses as well, after their + pockets: the same solids the cells are cut with. A wall key's recess, an H-clip's + and a dovetail's notch sit where four cells meet, which is where four bosses meet, + and they were cut from the cells only. The bosses stood in every one of them, the + whole housing, and the key, the clip or the other piece's tab could not go in (#70). + * + Cut as they are, a boss and the cell under it share faces, and the cut put the same + edges in both: the housing's outline on the bed, where both stand, and on the + piece's edge, where both end; and two bosses that meet on a cell's edge, as they all + do (quarantined in test/plate-audit.js), shared the housing's outline across it too. + An H-clip at 42 mm went from 40 edges used four times a piece to 59 and 68. So a + boss a housing reaches stops a BLOAT short of the piece's edge, where the cell's + rim stands in for it; the two that meet on either side of the same housing are one + solid, the pair's outline drawn whole; and the cut is moved NUDGE (1.7 microns) one + way along each axis, so its walls stand in the boss a hair from where they stand in + the cell. None of that touches a boss no housing reaches, which is built as it was. */ + const fromBelow = [...notches, ...pnotches].map((nb) => tabNotch(cfg, nb, pad)); + if (keyKind === 'recess') + for (const bo of keyed) + if (!(plan.junction && offJunction(bo, pitch, piece))) + fromBelow.push(keySiteOps(keyKind, keyShape, keyPrm, keyClr, bo.edge, bo.e, bo.s, H).cut); + const flatBox = (polys) => { + const b = [Infinity, Infinity, -Infinity, -Infinity]; + for (const p of polys) for (const v of p.verts) { + b[0] = Math.min(b[0], v[0]); b[1] = Math.min(b[1], v[1]); + b[2] = Math.max(b[2], v[0]); b[3] = Math.max(b[3], v[1]); + } + return b; + }; + const cutBoxes = fromBelow.map(flatBox); + const meets = (a, b) => a[0] < b[2] && b[0] < a[2] && a[1] < b[3] && b[1] < a[3]; // whole cells only: a half cell has no mounting sites (see the fastener cut above) + const all = []; for (let i = 0; i < piece.nx; i++) for (let j = 0; j < piece.ny; j++) { const ccx = gx0 + i*pitch + half, ccy = gy0 + j*pitch + half; for (const sx of [-1, 1]) for (const sy of [-1, 1]) { const cxr = ccx + sx*half, cyr = ccy + sy*half; // cell corner + const box = [Math.min(cxr, cxr - sx*bossW), Math.min(cyr, cyr - sy*bossW), + Math.max(cxr, cxr - sx*bossW), Math.max(cyr, cyr - sy*bossW)]; + all.push({ ccx, ccy, sx, sy, cxr, cyr, cuts: cutBoxes.flatMap((a, k) => meets(a, box) ? [k] : []) }); + } + } + // the bosses either side of one housing, as one + const group = all.map((_, n) => n); + const root = (n) => { while (group[n] !== n) n = group[n] = group[group[n]]; return n; }; + fromBelow.forEach((_, k) => { + const reached = all.flatMap((bs, n) => bs.cuts.includes(k) ? [n] : []); + for (const n of reached.slice(1)) group[root(n)] = root(reached[0]); + }); + const arc = []; + for (let k = 1; k <= 6; k++) { + const a = k * (Math.PI/2) / 6; + arc.push([bossW - rIn + rIn*Math.cos(a), bossW - rIn + rIn*Math.sin(a)]); + } + const onEdge = (x, lim) => Math.abs(x) < 1e-6 || Math.abs(x - lim) < 1e-6; + for (let n = 0; n < all.length; n++) { + if (root(n) !== n) continue; + const { ccx, ccy, sx, sy, cxr, cyr } = all[n]; + const members = all.filter((_, m) => root(m) === n); + const ks = [...new Set(members.flatMap((bs) => bs.cuts))]; + if (!ks.length) { // quarter boss with rounded inner corner, oriented into the cell const pts = []; pts.push([0, 0], [bossW, 0], [bossW, bossW - rIn]); @@ -3560,6 +3637,40 @@ function buildPiece(cfg, layout, piece, onStatus) { if (bossFastener) boss = csgSubtract(boss, movePolys(bossFastener, ccx + sx*off, ccy + sy*off)); shells.push(boss); + continue; + } + /* In the boss's own frame u runs into the cell along x from its corner and v along + y, and a side on the piece's edge starts a BLOAT in. Two that meet on the cell + edge through their corner are mirror images across it: the pair's outline is the + one quarter's run back mirrored, without the edge between them. */ + const u0 = onEdge(cxr, W) ? BLOAT : 0, v0 = onEdge(cyr, D) ? BLOAT : 0; + const other = members.length === 2 ? members.find((bs) => bs !== all[n]) : null; + const pair = other && Math.abs(other.cxr - cxr) < 1e-6 && Math.abs(other.cyr - cyr) < 1e-6 && + (other.sx === sx) !== (other.sy === sy) ? (other.sx === sx ? 'v' : 'u') : null; + const solids = []; + if (pair) { + const lo = pair === 'v' ? u0 : v0; + const run = [[lo, -bossW], ...arc.slice().reverse().map(([p, q]) => [p, -q]), + [bossW, -(bossW - rIn)], [bossW, bossW - rIn], ...arc, [lo, bossW]]; + const pts = pair === 'v' ? run : run.map(([p, q]) => [q, p]); + solids.push({ outline: pts.map(([u, v]) => [cxr - sx*u, cyr - sy*v]), sites: members }); + } else { + for (const bs of members) { + const a0 = onEdge(bs.cxr, W) ? BLOAT : 0, b0 = onEdge(bs.cyr, D) ? BLOAT : 0; + const pts = [[a0, b0], [bossW, b0], [bossW, bossW - rIn], ...arc, [a0, bossW]]; + solids.push({ outline: pts.map(([u, v]) => [bs.cxr - bs.sx*u, bs.cyr - bs.sy*v]), sites: [bs] }); + } + } + for (const { outline, sites } of solids) { + let boss = extrudePoly(outline, 0, bossH); + if (bossFastener) + boss = csgSubtract(boss, [].concat(...sites.map((bs) => + movePolys(bossFastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off)))); + const b = flatBox(boss), cut = []; + for (const k of ks) + if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -sx*NUDGE, -sy*NUDGE)); + if (cut.length) boss = cutAgain(boss, cut, csgSubtract(boss, cut)); + shells.push(boss); } } } @@ -4231,7 +4342,7 @@ const DEFAULTS = { if (typeof module !== 'undefined') { module.exports = { computeLayout, gridCells, halfStrips, pieceConnectors, keysMeet, jointsThatFit, buildPiece, buildTestTile, buildFitSample, jointKind, keyOutline, buildKey, puzzleShape, keyHalf, hclipPrm, snapTopClip, snapTopParts, snapTopPrm, keySiteOps, topPocketCup, snapTopPocket, build3mfXML, packPlates, optimizeForPlates, transformPolys, stlBinary, checkManifold, DEFAULTS, csgSubtract, csgUnion, extrudePoly, socketCutter, polysToTriangles, - platePad, mountLimits, pieceColumn, compositions, PLATE_RANGES, PLATE_MAX_CELLS, MOUNT_SKIN, + platePad, cornerBosses, mountLimits, pieceColumn, compositions, PLATE_RANGES, PLATE_MAX_CELLS, MOUNT_SKIN, connClrCeiling, fitClearances, PRINT_LAYER, // shared mesh primitives — also used by the bins tool makePoly, triangulateRing, earTriangulate, roundedSquareRing, roundedRectRing, clampZ, profilePrism, diff --git a/test/plate-audit.js b/test/plate-audit.js index 18eb9bb..3e563fd 100644 --- a/test/plate-audit.js +++ b/test/plate-audit.js @@ -2095,6 +2095,123 @@ console.log('\nthe other limits, built at their ends:'); bad += open.length + (holds ? 0 : 1); } +/* Corner bosses beside a joint cut from beneath (#70). A boss stands where four cells + meet, and so does a wall key's recess, an H-clip's, and the notch a dovetail's or a + puzzle's tab goes into from the next piece. The joint was cut from the cells and not + from the bosses, so they stood in the whole of each housing and nothing could go in, + with Download on: a housing filled in is watertight, and the bosses' own edges were + there already. And a joint that houses itself in a floor, keys at 2.8 mm and the + puzzle's lobes at 2.6, stood that floor round the 2.6 mm bosses and sealed their + pockets in it, as an extra floor did. + * + So each is built two pieces side by side at 42 mm, with magnets from beneath, from + above and screws, and read along vertical lines 0.3 mm apart. The housing is what the + joint takes out of the plate without its mountings (solid with no joint, empty with + one), and none of it may be solid with the bosses on, and solid 5 microns round: a + boss's cut stands NUDGE off the cell's (see buildPiece), and the sliver of boss that + leaves in a housing, 1.7 microns thick, is not a fill. Every pocket has to be empty + from its mouth to its floor. And the edges two bosses share where they meet, used four + times (quarantined above), may not be more than the same plate has with no joint. */ +console.log('\ncorner bosses beside a joint cut from beneath:'); +{ + // along a vertical line, the faces above a height, each counted by which way it faces, + // add up to how many shells that height is inside + const columns = (polys) => { + const cells = new Map(), key = (i, j) => i * 100003 + j; + for (const t of G.polysToTriangles(polys)) { + const xs = t.map((v) => v[0]), ys = t.map((v) => v[1]); + for (let i = Math.floor(Math.min(...xs)); i <= Math.floor(Math.max(...xs)); i++) + for (let j = Math.floor(Math.min(...ys)); j <= Math.floor(Math.max(...ys)); j++) { + if (!cells.has(key(i, j))) cells.set(key(i, j), []); + cells.get(key(i, j)).push(t); + } + } + return (x, y) => { + const cross = []; + for (const [a, b, c] of cells.get(key(Math.floor(x), Math.floor(y))) || []) { + const n = (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]); + if (Math.abs(n) < 1e-12) continue; + const d = (b[1] - c[1]) * (a[0] - c[0]) + (c[0] - b[0]) * (a[1] - c[1]); + const l1 = ((b[1] - c[1]) * (x - c[0]) + (c[0] - b[0]) * (y - c[1])) / d; + const l2 = ((c[1] - a[1]) * (x - c[0]) + (a[0] - c[0]) * (y - c[1])) / d; + if (l1 < 0 || l2 < 0 || l1 + l2 > 1) continue; + cross.push([l1 * a[2] + l2 * b[2] + (1 - l1 - l2) * c[2], Math.sign(n)]); + } + return (z) => cross.reduce((w, [zc, s]) => zc > z ? w + s : w, 0); + }; + }; + const h = 0.3, dz = 0.1; + const zs = Array.from({ length: 40 }, (_, k) => (k + 0.5) * dz); + const at = { pitch: 42, drawerW: 168, drawerD: 84, bedW: 100, bedD: 400 }; + const JOINTS = [ + ['keys in the floor', { connector: 'bowtie' }], + ['keys in the wall', { connector: 'bowtie', keyMount: 'wall' }], + ['H-clip', { connector: 'hclip' }], + ['dovetail', { connector: 'dovetail' }], + ['puzzle tabs', { connector: 'puzzle' }], + ['extra floor, no joint', { connector: 'none', bottomPad: 1 }], + ]; + const MOUNTS = [ + ['magnets below', { magnets: true }], + ['magnets above', { magnets: true, magnetSide: 'top' }], + ['screws', { screws: true }], + ]; + for (const [jn, j] of JOINTS) + for (const [mn, m] of MOUNTS) { + const r = buildAll({ ...at, baseMode: 'bosses', ...j, ...m }); + const cfg = r.cfg, pad = G.platePad(cfg); + const plain = buildAll({ ...at, baseMode: 'bosses', ...j, ...m, connector: 'none', bottomPad: 0 }); + const without = buildAll({ ...at, ...j, bottomPad: pad }); + const solidBefore = buildAll({ ...at, ...j, connector: 'none', bottomPad: pad }); + let housing = 0, filled = 0, pts = 0, buried = 0; + r.pieces.forEach((polys, pi) => { + const pc = r.L.pieces[pi]; + const A = columns(polys), B = columns(without.pieces[pi]), C = columns(solidBefore.pieces[pi]); + if (cfg.connector !== 'none') { + const W = pc.mL + pc.nx * cfg.pitch + pc.mR, D = pc.mF + pc.ny * cfg.pitch + pc.mB; + for (let x = h / 2 + 0.000731; x < W; x += h) + for (let y = h / 2 + 0.000419; y < D; y += h) { + const a = A(x, y), b = B(x, y), c = C(x, y); + let round = null; + for (const z of zs) + if (c(z) >= 1 && b(z) <= 0) { + housing++; + if (a(z) < 1) continue; + round = round || [[1, 1], [1, -1], [-1, 1], [-1, -1]].map(([u, v]) => A(x + u * 0.005, y + v * 0.005)); + if (round.every((f) => f(z) >= 1)) filled++; + } + } + } + // each pocket's sides and middle, from its mouth to its floor: a standing boss's + // top is its own height, and a floor's the floor's + const top = G.cornerBosses(cfg) ? Math.min(2.6, Math.max(cfg.magnets ? cfg.magnetH + 0.8 : 0, + cfg.screws ? cfg.screwHeadDepth + 1 : 0)) : pad; + const spans = []; + if (cfg.magnets) spans.push(cfg.magnetSide === 'top' + ? [cfg.magnetD / 2 - 0.3, top - cfg.magnetH, top] : [cfg.magnetD / 2 - 0.3, 0, cfg.magnetH]); + if (cfg.screws) spans.push([cfg.screwHeadD / 2 - 0.3, 0, cfg.screwHeadDepth], [cfg.screwHoleD / 2 - 0.3, 0, top]); + 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; + const py = pc.mF + (k + 0.5) * cfg.pitch + sy * cfg.holeOffset; + for (const [rad, z0, z1] of spans) + for (let q = 0; q < 8; q++) for (const rr of [0, rad / 2, rad]) { + const col = A(px + rr * Math.cos(q * Math.PI / 4) + 0.000731, py + rr * Math.sin(q * Math.PI / 4) + 0.000419); + for (let z = z0 + 0.1; z <= z1 - 0.1 + 1e-9; z += 0.2) { pts++; if (col(z) >= 1) buried++; } + } + } + }); + const mm3 = (n) => (n * h * h * dz).toFixed(1); + const good = !filled && !buried && !r.open && r.bad <= plain.bad && (cfg.connector === 'none' || housing > 0); + console.log(` ${`${jn}, ${mn}`.padEnd(36)} ` + + (cfg.connector === 'none' ? 'no housing' : !housing ? 'NO HOUSING CUT' + : `housing ${mm3(housing)} mm³, ${filled ? `${mm3(filled)} mm³ OF IT FILLED` : 'none filled'}`) + + `; ${buried ? `${buried} of ${pts} pocket points SOLID` : `pockets open (${pts} points)`}; ` + + `${leakText(r)}${r.bad ? `, ${plain.bad} with no joint` : ''}${good ? '' : ' FAIL'}`); + if (!good) bad++; + } +} + /* The fit clearance at its ceiling, for every joint and every pitch band. * * connClrCeiling's answer depends on the joint, which way its key goes in and the pitch, From 46126608ad1d34d0c1d256a2ba84bb91e9dd3192 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 10:27:03 +0000 Subject: [PATCH 02/16] Say in Checks when corner pockets are cut into a floor The menu still reads "Corner pockets only" when a joint's floor or an extra floor means the plate is built with a solid floor, so Checks says so, and the magnet depth is held to a boss's 2.4 mm only where the bosses stand. The page tests cover the note, both ways round, and the joint's limit on a boss's pocket at 36.13 mm. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- src/ui.js | 12 +++++++++-- test/ui/plates-robustness.spec.js | 35 +++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/ui.js b/src/ui.js index d35fe29..5b42b0c 100644 --- a/src/ui.js +++ b/src/ui.js @@ -95,10 +95,11 @@ const mountWhy = (opens, field) => `${atPitch()} — mounting holes sit ` + `${['dovetail', 'puzzle'].includes(state.connector) ? 'notches' : 'recesses'} the ` + `${CONNECTOR_NAMES[state.connector]} fit into` : mount().beside[field] ? 'a cell\'s four holes have to stay clear of each other' - : state.baseMode === 'bosses' ? 'a pocket has to stay inside 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'); -const bossDepth = () => state.baseMode === 'bosses' +// corner bosses only where they stand: over a floor the pockets are the floor's (cornerBosses) +const bossDepth = () => cornerBosses(state) ? 'with corner pockets — a boss is 2.6 mm tall, while the solid floor grows to suit' : ''; const LIMITS = { drawerW: { min: 1, max: 2000, label: 'Drawer width' }, @@ -603,6 +604,13 @@ function warningsList() { state.connector === 'snap' ? 'the snap clips' : 'the keys'; out.push({ t: `This joint adds a ${Math.max(state.bottomPad, padV).toFixed(1)} mm solid floor to house ${what}. Prefer no floor? Pick a keyed joint and set Key housing to "Inside the walls".` }); } + /* Corner pockets over a floor. The bosses would stand inside it, their pockets sealed or + cut short (#70), so core.js builds the plate as a solid floor builds it (cornerBosses), + and says so here: the menu still reads "Corner pockets only". */ + if (state.baseMode === 'bosses' && (state.magnets || state.screws) && !cornerBosses(state)) + out.push({ t: `Corner pockets need an open underside, and ${jointFloor(state) > 0 + ? 'this joint is housed in a floor' : 'Extra floor closes it'}, so the plate is built with a solid floor and the ${ + state.magnets && state.screws ? 'magnet and screw' : state.magnets ? 'magnet' : 'screw'} pockets are cut into it.` }); if (keyInWall() && layout.seams.some(s => s.junctions.some(j => Math.abs(j - Math.round(j)) > 0.25))) out.push({ t: 'One seam overlaps by a single cell — wall-housed keys need a wall junction, so that seam gets no connector. The neighbouring joints still hold the assembly.' }); diff --git a/test/ui/plates-robustness.spec.js b/test/ui/plates-robustness.spec.js index db5c058..2053cbe 100644 --- a/test/ui/plates-robustness.spec.js +++ b/test/ui/plates-robustness.spec.js @@ -117,6 +117,12 @@ test.describe('ranges on the geometry fields', () => { /Screw head Ø must be 7\.8 mm or less at a 42 mm pitch — .* the recesses the snap clips fit into/], ['#mg=1&md=20', 'errMagnet', /Magnet Ø must be 12\.3 mm or less at a 42 mm pitch — .* the notches the dovetail tabs fit into/], + /* #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 }) => { @@ -158,6 +164,35 @@ test.describe('ranges on the geometry fields', () => { expect(errors).toEqual([]); }); + /* #70: corner pockets over a floor. A bowtie housed in the floor stood its 2.8 mm floor + round the 2.6 mm bosses and sealed their pockets in it, with Download on, and an extra + floor did the same. Such a plate is built as a solid floor builds it now, and Checks + says so; the floor grows to suit, so a 3 mm magnet goes in where a boss stops at 2.4. + With the key in the walls the underside is open and the bosses stand again. */ + test('corner pockets over a floor are cut into the floor, and Checks says so', async ({ page }) => { + const errors = await openAt(page, `${BOWTIE_42}&bm=bosses&mg=1&mh=3`); + const note = /Corner pockets need an open underside, and this joint is housed in a floor, so the plate is built with a solid floor and the magnet pockets are cut into it\./; + expect(await text(page, 'warnings')).toMatch(note); + expect(await shown(page, 'errMagnet')).toBe(false); + expect(await text(page, 'pieceTail')).toMatch(/ready/); + expect(await exportOff(page)).toBe(false); + await page.selectOption('#keyMount', 'wall'); + await page.waitForFunction((re) => new RegExp(re).test( + document.getElementById('pieceTail').textContent), SETTLED.source, { timeout: 30000 }); + expect(await text(page, 'warnings')).not.toMatch(/Corner pockets need an open underside/); + expect(await text(page, 'errMagnet')).toMatch(/Magnet depth must be 2\.4 mm or less with corner pockets/); + expect(await exportOff(page)).toBe(true); + expect(errors).toEqual([]); + }); + test('corner pockets under an extra floor are cut into it, and Checks says so', async ({ page }) => { + const errors = await openAt(page, '#cn=none&bm=bosses&sc=1&bp=1'); + expect(await text(page, 'warnings')).toMatch( + /Corner pockets need an open underside, and Extra floor closes it, so the plate is built with a solid floor and the screw pockets are cut into it\./); + expect(await text(page, 'pieceTail')).toMatch(/ready/); + expect(await exportOff(page)).toBe(false); + expect(errors).toEqual([]); + }); + test('a typed value is held to the same range, and a good one clears it', async ({ page }) => { await H.openPlates(page); await H.setField(page, 'topCutoff', '0'); From f669cdd833901c114a493bcf0b0f99d07376a506 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 10:27:03 +0000 Subject: [PATCH 03/16] Rebuild the pages Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- bins/index.html | 141 +++++++++++++++++++++++++++++++++++++++----- index.html | 153 ++++++++++++++++++++++++++++++++++++++++++------ sw.js | 2 +- 3 files changed, 263 insertions(+), 33 deletions(-) diff --git a/bins/index.html b/bins/index.html index 7e64f5e..8735537 100644 --- a/bins/index.html +++ b/bins/index.html @@ -3898,6 +3898,30 @@

Your drawers

corner, its inner corner rounded, never taller than BOSS_H. Named because mountLimits has to know how much room a boss leaves around its pocket. */ const BOSS_W = 12.5, BOSS_R = 3.5, BOSS_H = 2.6; +/* How tall a corner boss is built: enough for its pocket and a layer, up to BOSS_H. */ +const bossHeight = (cfg) => Math.min(BOSS_H, Math.max( + cfg.magnets ? cfg.magnetH + 0.8 : 0, + cfg.screws ? cfg.screwHeadDepth + 1.0 : 0)); + +/* The floor a joint houses itself in: keys in the floor, and the puzzle's lobes, whose + notch runs up into it. None for the rest. */ +function jointFloor(cfg) { + const keyedConn = ['bowtie', 'snap', 'puzzlekey'].includes(cfg.connector); + if (keyedConn && cfg.keyMount !== 'wall') return cfg.key.depth + 0.8; + return cfg.connector === 'puzzle' ? 2.6 : 0; +} + +/* Whether the corner bosses are built: baseMode 'bosses', and nothing under them. A boss + stands on the bed, up to 2.6 mm, with its pocket opening below it or on top of it. A + floor under the sockets, the one a joint houses itself in (2.8 mm for keys, 2.6 for the + puzzle's lobes) or one asked for, would stand round it as tall or taller: the bosses + were buried in it and their pockets with them, sealed in solid or cut short by it, and + no magnet could go in (#70). A floor is what a solid base is, so with one the plate is + built as a solid base builds it, its pockets cut into the floor and the floor grown to + suit them; a boss would only have stood inside it. */ +function cornerBosses(cfg) { + return cfg.baseMode === 'bosses' && !(cfg.bottomPad > 0) && !(jointFloor(cfg) > 0); +} /* How thick the solid floor under the sockets is: what was asked for, raised to whatever the plate is carrying needs. A pocket cut into the floor — a magnet from either side, a @@ -3910,16 +3934,13 @@

Your drawers

/* Rounded to the micron, because 2.6 + 0.2 is 2.8000000000000003 and that is not a reason to move every face of a plate that was 2.8 before. */ const under = (depth) => Math.round((depth + MOUNT_SKIN) * 1e6) / 1e6; - if ((cfg.magnets || cfg.screws) && cfg.baseMode !== 'bosses') { + if ((cfg.magnets || cfg.screws) && !cornerBosses(cfg)) { pad = Math.max(pad, cfg.magnetBase || 2.8); if (cfg.magnets) pad = Math.max(pad, under(cfg.magnetH)); if (cfg.screws && cfg.screwHeadD > cfg.screwHoleD) pad = Math.max(pad, under(cfg.screwHeadDepth)); } - const keyedConn = ['bowtie', 'snap', 'puzzlekey'].includes(cfg.connector); - if (keyedConn && cfg.keyMount !== 'wall') pad = Math.max(pad, cfg.key.depth + 0.8); - if (cfg.connector === 'puzzle') pad = Math.max(pad, 2.6); - return pad; + return Math.max(pad, jointFloor(cfg)); } /* Plastic left round a mounting cut, to whatever holds it. 1 mm rather than a token @@ -3966,7 +3987,7 @@

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; - const bosses = cfg.baseMode === 'bosses'; + const bosses = cornerBosses(cfg); const top = bosses ? inBoss : onFloor, under = bosses ? inBoss : inCell; const r10 = (x) => Math.floor(x * 10 + 1e-9) / 10; // the fields step in tenths /* A cell's four sites are 2 × holeOffset apart, 26 mm, so past a pitch of about 50 mm @@ -3988,8 +4009,10 @@

Your drawers

Measured off the solids buildPiece cuts, at the sites it cuts pockets at: whole cells only, so a housing beside a half cell or a margin is measured from the whole cell on - the other side of it, which is the only one with pockets. A corner boss is left out: - its pocket is cut in the boss, a shell of its own that no joint is cut from. + the other side of it, which is the only one with pockets. A corner boss's pocket is at + the same site, and the joint is cut out of the boss too (#70), so it counts the same + way; a pocket from above in a boss has its floor the pocket's depth under the boss's + top rather than the floor's. Issue #64: a bowtie in the floor at 42 mm, with magnets from beneath, built 12 bad edges at 7.9 mm and 19 at 10, with Download on; puzzle tabs at 36 to 40 mm built 26 @@ -4013,7 +4036,7 @@

Your drawers

plate the page will build has at most 900 cells; at 30 × 30 with puzzle tabs this is a few milliseconds, on every redraw. */ const reach = Math.max(fit(top), fit(under)); - if (layout && !bosses && cfg.connector !== 'none' && reach > 0) { + if (layout && cfg.connector !== 'none' && reach > 0) { const plan = keyPlan(cfg), pad = platePad(cfg), H = pad + cfg.plateHeight; /* A cut's footprint, as the segments its walls stand on, its extent and its ceiling, for each seam it can be cut from. Every cut from one seam is the same solid moved @@ -4082,7 +4105,7 @@

Your drawers

c.top + MOUNT_SKIN > z + 1e-6 ? Math.min(m, c.room) : m, Infinity); const below = jointRoom(-Infinity); // a magnet from beneath, a counterbore, a shank const magnetJoint = cfg.magnetSide === 'top' && jointCuts.length - ? jointRoom(platePad(cfg) - cfg.magnetH) : below; + ? jointRoom((bosses ? bossHeight(cfg) : platePad(cfg)) - cfg.magnetH) : below; const own = fit(cfg.magnetSide === 'top' ? top : under); const room = Math.min(own, magnetJoint); return { @@ -4269,7 +4292,7 @@

Your drawers

and bloated 0.05mm so shells overlap; slicers union overlapping shells. */ function buildPiece(cfg, layout, piece, onStatus) { const pitch = cfg.pitch, half = pitch/2; - const solidBase = cfg.baseMode !== 'bosses'; + const solidBase = !cornerBosses(cfg); // with a floor under them, bosses are a solid base const pad = platePad(cfg); const isHclip = cfg.connector === 'hclip'; const topInsert = cfg.keyInsert === 'top'; @@ -5144,15 +5167,69 @@

Your drawers

const bossW = BOSS_W, rIn = BOSS_R; // never more than BOSS_H, so a pocket deeper than BOSS_H − MOUNT_SKIN would come out // through the top: mountLimits refuses one rather than this growing past it - const bossH = Math.min(BOSS_H, Math.max( - cfg.magnets ? cfg.magnetH + 0.8 : 0, - cfg.screws ? cfg.screwHeadDepth + 1.0 : 0)); + const bossH = bossHeight(cfg); const bossFastener = fastenerCutter(cfg, bossH - cfg.magnetH, bossH + 0.5, bossH + 0.5); + /* The joint's cuts from beneath are taken out of the bosses as well, after their + pockets: the same solids the cells are cut with. A wall key's recess, an H-clip's + and a dovetail's notch sit where four cells meet, which is where four bosses meet, + and they were cut from the cells only. The bosses stood in every one of them, the + whole housing, and the key, the clip or the other piece's tab could not go in (#70). + * + Cut as they are, a boss and the cell under it share faces, and the cut put the same + edges in both: the housing's outline on the bed, where both stand, and on the + piece's edge, where both end; and two bosses that meet on a cell's edge, as they all + do (quarantined in test/plate-audit.js), shared the housing's outline across it too. + An H-clip at 42 mm went from 40 edges used four times a piece to 59 and 68. So a + boss a housing reaches stops a BLOAT short of the piece's edge, where the cell's + rim stands in for it; the two that meet on either side of the same housing are one + solid, the pair's outline drawn whole; and the cut is moved NUDGE (1.7 microns) one + way along each axis, so its walls stand in the boss a hair from where they stand in + the cell. None of that touches a boss no housing reaches, which is built as it was. */ + const fromBelow = [...notches, ...pnotches].map((nb) => tabNotch(cfg, nb, pad)); + if (keyKind === 'recess') + for (const bo of keyed) + if (!(plan.junction && offJunction(bo, pitch, piece))) + fromBelow.push(keySiteOps(keyKind, keyShape, keyPrm, keyClr, bo.edge, bo.e, bo.s, H).cut); + const flatBox = (polys) => { + const b = [Infinity, Infinity, -Infinity, -Infinity]; + for (const p of polys) for (const v of p.verts) { + b[0] = Math.min(b[0], v[0]); b[1] = Math.min(b[1], v[1]); + b[2] = Math.max(b[2], v[0]); b[3] = Math.max(b[3], v[1]); + } + return b; + }; + const cutBoxes = fromBelow.map(flatBox); + const meets = (a, b) => a[0] < b[2] && b[0] < a[2] && a[1] < b[3] && b[1] < a[3]; // whole cells only: a half cell has no mounting sites (see the fastener cut above) + const all = []; for (let i = 0; i < piece.nx; i++) for (let j = 0; j < piece.ny; j++) { const ccx = gx0 + i*pitch + half, ccy = gy0 + j*pitch + half; for (const sx of [-1, 1]) for (const sy of [-1, 1]) { const cxr = ccx + sx*half, cyr = ccy + sy*half; // cell corner + const box = [Math.min(cxr, cxr - sx*bossW), Math.min(cyr, cyr - sy*bossW), + Math.max(cxr, cxr - sx*bossW), Math.max(cyr, cyr - sy*bossW)]; + all.push({ ccx, ccy, sx, sy, cxr, cyr, cuts: cutBoxes.flatMap((a, k) => meets(a, box) ? [k] : []) }); + } + } + // the bosses either side of one housing, as one + const group = all.map((_, n) => n); + const root = (n) => { while (group[n] !== n) n = group[n] = group[group[n]]; return n; }; + fromBelow.forEach((_, k) => { + const reached = all.flatMap((bs, n) => bs.cuts.includes(k) ? [n] : []); + for (const n of reached.slice(1)) group[root(n)] = root(reached[0]); + }); + const arc = []; + for (let k = 1; k <= 6; k++) { + const a = k * (Math.PI/2) / 6; + arc.push([bossW - rIn + rIn*Math.cos(a), bossW - rIn + rIn*Math.sin(a)]); + } + const onEdge = (x, lim) => Math.abs(x) < 1e-6 || Math.abs(x - lim) < 1e-6; + for (let n = 0; n < all.length; n++) { + if (root(n) !== n) continue; + const { ccx, ccy, sx, sy, cxr, cyr } = all[n]; + const members = all.filter((_, m) => root(m) === n); + const ks = [...new Set(members.flatMap((bs) => bs.cuts))]; + if (!ks.length) { // quarter boss with rounded inner corner, oriented into the cell const pts = []; pts.push([0, 0], [bossW, 0], [bossW, bossW - rIn]); @@ -5166,6 +5243,40 @@

Your drawers

if (bossFastener) boss = csgSubtract(boss, movePolys(bossFastener, ccx + sx*off, ccy + sy*off)); shells.push(boss); + continue; + } + /* In the boss's own frame u runs into the cell along x from its corner and v along + y, and a side on the piece's edge starts a BLOAT in. Two that meet on the cell + edge through their corner are mirror images across it: the pair's outline is the + one quarter's run back mirrored, without the edge between them. */ + const u0 = onEdge(cxr, W) ? BLOAT : 0, v0 = onEdge(cyr, D) ? BLOAT : 0; + const other = members.length === 2 ? members.find((bs) => bs !== all[n]) : null; + const pair = other && Math.abs(other.cxr - cxr) < 1e-6 && Math.abs(other.cyr - cyr) < 1e-6 && + (other.sx === sx) !== (other.sy === sy) ? (other.sx === sx ? 'v' : 'u') : null; + const solids = []; + if (pair) { + const lo = pair === 'v' ? u0 : v0; + const run = [[lo, -bossW], ...arc.slice().reverse().map(([p, q]) => [p, -q]), + [bossW, -(bossW - rIn)], [bossW, bossW - rIn], ...arc, [lo, bossW]]; + const pts = pair === 'v' ? run : run.map(([p, q]) => [q, p]); + solids.push({ outline: pts.map(([u, v]) => [cxr - sx*u, cyr - sy*v]), sites: members }); + } else { + for (const bs of members) { + const a0 = onEdge(bs.cxr, W) ? BLOAT : 0, b0 = onEdge(bs.cyr, D) ? BLOAT : 0; + const pts = [[a0, b0], [bossW, b0], [bossW, bossW - rIn], ...arc, [a0, bossW]]; + solids.push({ outline: pts.map(([u, v]) => [bs.cxr - bs.sx*u, bs.cyr - bs.sy*v]), sites: [bs] }); + } + } + for (const { outline, sites } of solids) { + let boss = extrudePoly(outline, 0, bossH); + if (bossFastener) + boss = csgSubtract(boss, [].concat(...sites.map((bs) => + movePolys(bossFastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off)))); + const b = flatBox(boss), cut = []; + for (const k of ks) + if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -sx*NUDGE, -sy*NUDGE)); + if (cut.length) boss = cutAgain(boss, cut, csgSubtract(boss, cut)); + shells.push(boss); } } } @@ -5837,7 +5948,7 @@

Your drawers

if (typeof module !== 'undefined') { module.exports = { computeLayout, gridCells, halfStrips, pieceConnectors, keysMeet, jointsThatFit, buildPiece, buildTestTile, buildFitSample, jointKind, keyOutline, buildKey, puzzleShape, keyHalf, hclipPrm, snapTopClip, snapTopParts, snapTopPrm, keySiteOps, topPocketCup, snapTopPocket, build3mfXML, packPlates, optimizeForPlates, transformPolys, stlBinary, checkManifold, DEFAULTS, csgSubtract, csgUnion, extrudePoly, socketCutter, polysToTriangles, - platePad, mountLimits, pieceColumn, compositions, PLATE_RANGES, PLATE_MAX_CELLS, MOUNT_SKIN, + platePad, cornerBosses, mountLimits, pieceColumn, compositions, PLATE_RANGES, PLATE_MAX_CELLS, MOUNT_SKIN, connClrCeiling, fitClearances, PRINT_LAYER, // shared mesh primitives — also used by the bins tool makePoly, triangulateRing, earTriangulate, roundedSquareRing, roundedRectRing, clampZ, profilePrism, diff --git a/index.html b/index.html index 5a940b7..398e850 100644 --- a/index.html +++ b/index.html @@ -3685,6 +3685,30 @@

Your drawers

corner, its inner corner rounded, never taller than BOSS_H. Named because mountLimits has to know how much room a boss leaves around its pocket. */ const BOSS_W = 12.5, BOSS_R = 3.5, BOSS_H = 2.6; +/* How tall a corner boss is built: enough for its pocket and a layer, up to BOSS_H. */ +const bossHeight = (cfg) => Math.min(BOSS_H, Math.max( + cfg.magnets ? cfg.magnetH + 0.8 : 0, + cfg.screws ? cfg.screwHeadDepth + 1.0 : 0)); + +/* The floor a joint houses itself in: keys in the floor, and the puzzle's lobes, whose + notch runs up into it. None for the rest. */ +function jointFloor(cfg) { + const keyedConn = ['bowtie', 'snap', 'puzzlekey'].includes(cfg.connector); + if (keyedConn && cfg.keyMount !== 'wall') return cfg.key.depth + 0.8; + return cfg.connector === 'puzzle' ? 2.6 : 0; +} + +/* Whether the corner bosses are built: baseMode 'bosses', and nothing under them. A boss + stands on the bed, up to 2.6 mm, with its pocket opening below it or on top of it. A + floor under the sockets, the one a joint houses itself in (2.8 mm for keys, 2.6 for the + puzzle's lobes) or one asked for, would stand round it as tall or taller: the bosses + were buried in it and their pockets with them, sealed in solid or cut short by it, and + no magnet could go in (#70). A floor is what a solid base is, so with one the plate is + built as a solid base builds it, its pockets cut into the floor and the floor grown to + suit them; a boss would only have stood inside it. */ +function cornerBosses(cfg) { + return cfg.baseMode === 'bosses' && !(cfg.bottomPad > 0) && !(jointFloor(cfg) > 0); +} /* How thick the solid floor under the sockets is: what was asked for, raised to whatever the plate is carrying needs. A pocket cut into the floor — a magnet from either side, a @@ -3697,16 +3721,13 @@

Your drawers

/* Rounded to the micron, because 2.6 + 0.2 is 2.8000000000000003 and that is not a reason to move every face of a plate that was 2.8 before. */ const under = (depth) => Math.round((depth + MOUNT_SKIN) * 1e6) / 1e6; - if ((cfg.magnets || cfg.screws) && cfg.baseMode !== 'bosses') { + if ((cfg.magnets || cfg.screws) && !cornerBosses(cfg)) { pad = Math.max(pad, cfg.magnetBase || 2.8); if (cfg.magnets) pad = Math.max(pad, under(cfg.magnetH)); if (cfg.screws && cfg.screwHeadD > cfg.screwHoleD) pad = Math.max(pad, under(cfg.screwHeadDepth)); } - const keyedConn = ['bowtie', 'snap', 'puzzlekey'].includes(cfg.connector); - if (keyedConn && cfg.keyMount !== 'wall') pad = Math.max(pad, cfg.key.depth + 0.8); - if (cfg.connector === 'puzzle') pad = Math.max(pad, 2.6); - return pad; + return Math.max(pad, jointFloor(cfg)); } /* Plastic left round a mounting cut, to whatever holds it. 1 mm rather than a token @@ -3753,7 +3774,7 @@

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; - const bosses = cfg.baseMode === 'bosses'; + const bosses = cornerBosses(cfg); const top = bosses ? inBoss : onFloor, under = bosses ? inBoss : inCell; const r10 = (x) => Math.floor(x * 10 + 1e-9) / 10; // the fields step in tenths /* A cell's four sites are 2 × holeOffset apart, 26 mm, so past a pitch of about 50 mm @@ -3775,8 +3796,10 @@

Your drawers

Measured off the solids buildPiece cuts, at the sites it cuts pockets at: whole cells only, so a housing beside a half cell or a margin is measured from the whole cell on - the other side of it, which is the only one with pockets. A corner boss is left out: - its pocket is cut in the boss, a shell of its own that no joint is cut from. + the other side of it, which is the only one with pockets. A corner boss's pocket is at + the same site, and the joint is cut out of the boss too (#70), so it counts the same + way; a pocket from above in a boss has its floor the pocket's depth under the boss's + top rather than the floor's. Issue #64: a bowtie in the floor at 42 mm, with magnets from beneath, built 12 bad edges at 7.9 mm and 19 at 10, with Download on; puzzle tabs at 36 to 40 mm built 26 @@ -3800,7 +3823,7 @@

Your drawers

plate the page will build has at most 900 cells; at 30 × 30 with puzzle tabs this is a few milliseconds, on every redraw. */ const reach = Math.max(fit(top), fit(under)); - if (layout && !bosses && cfg.connector !== 'none' && reach > 0) { + if (layout && cfg.connector !== 'none' && reach > 0) { const plan = keyPlan(cfg), pad = platePad(cfg), H = pad + cfg.plateHeight; /* A cut's footprint, as the segments its walls stand on, its extent and its ceiling, for each seam it can be cut from. Every cut from one seam is the same solid moved @@ -3869,7 +3892,7 @@

Your drawers

c.top + MOUNT_SKIN > z + 1e-6 ? Math.min(m, c.room) : m, Infinity); const below = jointRoom(-Infinity); // a magnet from beneath, a counterbore, a shank const magnetJoint = cfg.magnetSide === 'top' && jointCuts.length - ? jointRoom(platePad(cfg) - cfg.magnetH) : below; + ? jointRoom((bosses ? bossHeight(cfg) : platePad(cfg)) - cfg.magnetH) : below; const own = fit(cfg.magnetSide === 'top' ? top : under); const room = Math.min(own, magnetJoint); return { @@ -4056,7 +4079,7 @@

Your drawers

and bloated 0.05mm so shells overlap; slicers union overlapping shells. */ function buildPiece(cfg, layout, piece, onStatus) { const pitch = cfg.pitch, half = pitch/2; - const solidBase = cfg.baseMode !== 'bosses'; + const solidBase = !cornerBosses(cfg); // with a floor under them, bosses are a solid base const pad = platePad(cfg); const isHclip = cfg.connector === 'hclip'; const topInsert = cfg.keyInsert === 'top'; @@ -4931,15 +4954,69 @@

Your drawers

const bossW = BOSS_W, rIn = BOSS_R; // never more than BOSS_H, so a pocket deeper than BOSS_H − MOUNT_SKIN would come out // through the top: mountLimits refuses one rather than this growing past it - const bossH = Math.min(BOSS_H, Math.max( - cfg.magnets ? cfg.magnetH + 0.8 : 0, - cfg.screws ? cfg.screwHeadDepth + 1.0 : 0)); + const bossH = bossHeight(cfg); const bossFastener = fastenerCutter(cfg, bossH - cfg.magnetH, bossH + 0.5, bossH + 0.5); + /* The joint's cuts from beneath are taken out of the bosses as well, after their + pockets: the same solids the cells are cut with. A wall key's recess, an H-clip's + and a dovetail's notch sit where four cells meet, which is where four bosses meet, + and they were cut from the cells only. The bosses stood in every one of them, the + whole housing, and the key, the clip or the other piece's tab could not go in (#70). + * + Cut as they are, a boss and the cell under it share faces, and the cut put the same + edges in both: the housing's outline on the bed, where both stand, and on the + piece's edge, where both end; and two bosses that meet on a cell's edge, as they all + do (quarantined in test/plate-audit.js), shared the housing's outline across it too. + An H-clip at 42 mm went from 40 edges used four times a piece to 59 and 68. So a + boss a housing reaches stops a BLOAT short of the piece's edge, where the cell's + rim stands in for it; the two that meet on either side of the same housing are one + solid, the pair's outline drawn whole; and the cut is moved NUDGE (1.7 microns) one + way along each axis, so its walls stand in the boss a hair from where they stand in + the cell. None of that touches a boss no housing reaches, which is built as it was. */ + const fromBelow = [...notches, ...pnotches].map((nb) => tabNotch(cfg, nb, pad)); + if (keyKind === 'recess') + for (const bo of keyed) + if (!(plan.junction && offJunction(bo, pitch, piece))) + fromBelow.push(keySiteOps(keyKind, keyShape, keyPrm, keyClr, bo.edge, bo.e, bo.s, H).cut); + const flatBox = (polys) => { + const b = [Infinity, Infinity, -Infinity, -Infinity]; + for (const p of polys) for (const v of p.verts) { + b[0] = Math.min(b[0], v[0]); b[1] = Math.min(b[1], v[1]); + b[2] = Math.max(b[2], v[0]); b[3] = Math.max(b[3], v[1]); + } + return b; + }; + const cutBoxes = fromBelow.map(flatBox); + const meets = (a, b) => a[0] < b[2] && b[0] < a[2] && a[1] < b[3] && b[1] < a[3]; // whole cells only: a half cell has no mounting sites (see the fastener cut above) + const all = []; for (let i = 0; i < piece.nx; i++) for (let j = 0; j < piece.ny; j++) { const ccx = gx0 + i*pitch + half, ccy = gy0 + j*pitch + half; for (const sx of [-1, 1]) for (const sy of [-1, 1]) { const cxr = ccx + sx*half, cyr = ccy + sy*half; // cell corner + const box = [Math.min(cxr, cxr - sx*bossW), Math.min(cyr, cyr - sy*bossW), + Math.max(cxr, cxr - sx*bossW), Math.max(cyr, cyr - sy*bossW)]; + all.push({ ccx, ccy, sx, sy, cxr, cyr, cuts: cutBoxes.flatMap((a, k) => meets(a, box) ? [k] : []) }); + } + } + // the bosses either side of one housing, as one + const group = all.map((_, n) => n); + const root = (n) => { while (group[n] !== n) n = group[n] = group[group[n]]; return n; }; + fromBelow.forEach((_, k) => { + const reached = all.flatMap((bs, n) => bs.cuts.includes(k) ? [n] : []); + for (const n of reached.slice(1)) group[root(n)] = root(reached[0]); + }); + const arc = []; + for (let k = 1; k <= 6; k++) { + const a = k * (Math.PI/2) / 6; + arc.push([bossW - rIn + rIn*Math.cos(a), bossW - rIn + rIn*Math.sin(a)]); + } + const onEdge = (x, lim) => Math.abs(x) < 1e-6 || Math.abs(x - lim) < 1e-6; + for (let n = 0; n < all.length; n++) { + if (root(n) !== n) continue; + const { ccx, ccy, sx, sy, cxr, cyr } = all[n]; + const members = all.filter((_, m) => root(m) === n); + const ks = [...new Set(members.flatMap((bs) => bs.cuts))]; + if (!ks.length) { // quarter boss with rounded inner corner, oriented into the cell const pts = []; pts.push([0, 0], [bossW, 0], [bossW, bossW - rIn]); @@ -4953,6 +5030,40 @@

Your drawers

if (bossFastener) boss = csgSubtract(boss, movePolys(bossFastener, ccx + sx*off, ccy + sy*off)); shells.push(boss); + continue; + } + /* In the boss's own frame u runs into the cell along x from its corner and v along + y, and a side on the piece's edge starts a BLOAT in. Two that meet on the cell + edge through their corner are mirror images across it: the pair's outline is the + one quarter's run back mirrored, without the edge between them. */ + const u0 = onEdge(cxr, W) ? BLOAT : 0, v0 = onEdge(cyr, D) ? BLOAT : 0; + const other = members.length === 2 ? members.find((bs) => bs !== all[n]) : null; + const pair = other && Math.abs(other.cxr - cxr) < 1e-6 && Math.abs(other.cyr - cyr) < 1e-6 && + (other.sx === sx) !== (other.sy === sy) ? (other.sx === sx ? 'v' : 'u') : null; + const solids = []; + if (pair) { + const lo = pair === 'v' ? u0 : v0; + const run = [[lo, -bossW], ...arc.slice().reverse().map(([p, q]) => [p, -q]), + [bossW, -(bossW - rIn)], [bossW, bossW - rIn], ...arc, [lo, bossW]]; + const pts = pair === 'v' ? run : run.map(([p, q]) => [q, p]); + solids.push({ outline: pts.map(([u, v]) => [cxr - sx*u, cyr - sy*v]), sites: members }); + } else { + for (const bs of members) { + const a0 = onEdge(bs.cxr, W) ? BLOAT : 0, b0 = onEdge(bs.cyr, D) ? BLOAT : 0; + const pts = [[a0, b0], [bossW, b0], [bossW, bossW - rIn], ...arc, [a0, bossW]]; + solids.push({ outline: pts.map(([u, v]) => [bs.cxr - bs.sx*u, bs.cyr - bs.sy*v]), sites: [bs] }); + } + } + for (const { outline, sites } of solids) { + let boss = extrudePoly(outline, 0, bossH); + if (bossFastener) + boss = csgSubtract(boss, [].concat(...sites.map((bs) => + movePolys(bossFastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off)))); + const b = flatBox(boss), cut = []; + for (const k of ks) + if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -sx*NUDGE, -sy*NUDGE)); + if (cut.length) boss = cutAgain(boss, cut, csgSubtract(boss, cut)); + shells.push(boss); } } } @@ -5624,7 +5735,7 @@

Your drawers

if (typeof module !== 'undefined') { module.exports = { computeLayout, gridCells, halfStrips, pieceConnectors, keysMeet, jointsThatFit, buildPiece, buildTestTile, buildFitSample, jointKind, keyOutline, buildKey, puzzleShape, keyHalf, hclipPrm, snapTopClip, snapTopParts, snapTopPrm, keySiteOps, topPocketCup, snapTopPocket, build3mfXML, packPlates, optimizeForPlates, transformPolys, stlBinary, checkManifold, DEFAULTS, csgSubtract, csgUnion, extrudePoly, socketCutter, polysToTriangles, - platePad, mountLimits, pieceColumn, compositions, PLATE_RANGES, PLATE_MAX_CELLS, MOUNT_SKIN, + platePad, cornerBosses, mountLimits, pieceColumn, compositions, PLATE_RANGES, PLATE_MAX_CELLS, MOUNT_SKIN, connClrCeiling, fitClearances, PRINT_LAYER, // shared mesh primitives — also used by the bins tool makePoly, triangulateRing, earTriangulate, roundedSquareRing, roundedRectRing, clampZ, profilePrism, @@ -7419,10 +7530,11 @@

Your drawers

`${['dovetail', 'puzzle'].includes(state.connector) ? 'notches' : 'recesses'} the ` + `${CONNECTOR_NAMES[state.connector]} fit into` : mount().beside[field] ? 'a cell\'s four holes have to stay clear of each other' - : state.baseMode === 'bosses' ? 'a pocket has to stay inside 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'); -const bossDepth = () => state.baseMode === 'bosses' +// corner bosses only where they stand: over a floor the pockets are the floor's (cornerBosses) +const bossDepth = () => cornerBosses(state) ? 'with corner pockets — a boss is 2.6 mm tall, while the solid floor grows to suit' : ''; const LIMITS = { drawerW: { min: 1, max: 2000, label: 'Drawer width' }, @@ -7927,6 +8039,13 @@

Your drawers

state.connector === 'snap' ? 'the snap clips' : 'the keys'; out.push({ t: `This joint adds a ${Math.max(state.bottomPad, padV).toFixed(1)} mm solid floor to house ${what}. Prefer no floor? Pick a keyed joint and set Key housing to "Inside the walls".` }); } + /* Corner pockets over a floor. The bosses would stand inside it, their pockets sealed or + cut short (#70), so core.js builds the plate as a solid floor builds it (cornerBosses), + and says so here: the menu still reads "Corner pockets only". */ + if (state.baseMode === 'bosses' && (state.magnets || state.screws) && !cornerBosses(state)) + out.push({ t: `Corner pockets need an open underside, and ${jointFloor(state) > 0 + ? 'this joint is housed in a floor' : 'Extra floor closes it'}, so the plate is built with a solid floor and the ${ + state.magnets && state.screws ? 'magnet and screw' : state.magnets ? 'magnet' : 'screw'} pockets are cut into it.` }); if (keyInWall() && layout.seams.some(s => s.junctions.some(j => Math.abs(j - Math.round(j)) > 0.25))) out.push({ t: 'One seam overlaps by a single cell — wall-housed keys need a wall junction, so that seam gets no connector. The neighbouring joints still hold the assembly.' }); diff --git a/sw.js b/sw.js index 827cb0e..28f14f2 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 = "508e30fe00d3"; +const VERSION = "f574dc64c687"; const FILES = [ "./", "bins/", From de2419b4494bcdc37171ad6b9319e3780ea9be7b Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 13:32:39 +0000 Subject: [PATCH 04/16] Cut a reached corner boss's pockets again when they come out open A boss's pocket is a lottery of its own: default screws in one-cell pieces leave 3 to 6 open edges on a boss's underside at 22 of the 901 pitches from 34 to 60 mm that take them, in bosses no housing reaches, as on the base. A boss a housing reaches is cut a BLOAT short of the piece's edge, and that draws the lottery again at other pitches: four one-cell pieces with dovetails, whose notches reach the bosses from 34 to 36.4 mm, left 3 open edges in two pieces at 34.64 and 34.72 mm, where the base built them closed. Those bosses now have their pockets cut again (cutAgain) when the first cut comes out open, and no boss a housing reaches leaks at any of the 901 pitches. Bosses no housing reaches are built as before. The audit builds both pitches. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- docs/ENGINE.md | 6 +++++- src/core.js | 16 +++++++++++++--- test/plate-audit.js | 12 ++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/docs/ENGINE.md b/docs/ENGINE.md index 2aa979a..e8cd764 100644 --- a/docs/ENGINE.md +++ b/docs/ENGINE.md @@ -398,7 +398,11 @@ a piece to 59 and 68. So a boss a housing reaches stops a `BLOAT` short of the p edge, the two either side of one housing are built as one solid, and the cut is moved `NUDGE` into its own boss, so its walls stand 1.7 microns from the cell's. That leaves fewer four-use edges than before (31 a piece for that H-clip) and none used once, and a -boss no housing reaches is built byte for byte as it was. +boss no housing reaches is built byte for byte as it was. A boss a housing reaches has +its pockets cut again (`cutAgain`) if they come out open: a boss's pocket is a lottery of +its own (default screws in a one-cell piece leave 3 to 6 open edges on a boss's underside +at 22 of the 901 pitches from 34 to 60 mm that take them, in bosses no housing reaches), +and the shorter boss draws it again at other pitches. `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 diff --git a/src/core.js b/src/core.js index 6f7abee..eb173c5 100644 --- a/src/core.js +++ b/src/core.js @@ -3661,11 +3661,21 @@ function buildPiece(cfg, layout, piece, onStatus) { solids.push({ outline: pts.map(([u, v]) => [bs.cxr - bs.sx*u, bs.cyr - bs.sy*v]), sites: [bs] }); } } + /* The pockets are cut again (cutAgain) if they come out open. A boss's pocket is a + lottery of its own: default screws in one-cell pieces leave 3 to 6 open edges on + a boss's underside at 22 of the 901 pitches from 34 to 60 mm that take them, in + bosses no housing reaches, which are built as before. A boss cut short of the + piece's edge draws the lottery again at other pitches: four one-cell pieces with + dovetails, whose notches reach the bosses from 34 to 36.4 mm, left it at 34.64 + and 34.72 mm, where the whole boss had built closed. Cut again, no boss a housing + reaches leaks at any of those pitches. */ for (const { outline, sites } of solids) { let boss = extrudePoly(outline, 0, bossH); - if (bossFastener) - boss = csgSubtract(boss, [].concat(...sites.map((bs) => - movePolys(bossFastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off)))); + if (bossFastener) { + const pockets = [].concat(...sites.map((bs) => + movePolys(bossFastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off))); + boss = cutAgain(boss, pockets, csgSubtract(boss, pockets)); + } const b = flatBox(boss), cut = []; for (const k of ks) if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -sx*NUDGE, -sy*NUDGE)); diff --git a/test/plate-audit.js b/test/plate-audit.js index 3e563fd..2a97f0b 100644 --- a/test/plate-audit.js +++ b/test/plate-audit.js @@ -2210,6 +2210,18 @@ console.log('\ncorner bosses beside a joint cut from beneath:'); `${leakText(r)}${r.bad ? `, ${plain.bad} with no joint` : ''}${good ? '' : ' FAIL'}`); if (!good) bad++; } + /* A boss a housing reaches stops short of the piece's edge, and its pockets are a + lottery of their own: four one-cell pieces with dovetails, whose notches reach the + bosses from 34 to 36.4 mm, left 3 open edges under a boss with default screws at + these two pitches, where the whole boss had built closed, until the pockets were cut + again where they come out open (buildPiece). */ + for (const p of [34.64, 34.72]) { + const r = buildAll({ pitch: p, drawerW: 2 * p, drawerD: 2 * p, bedW: p + 5, bedD: p + 5, + baseMode: 'bosses', screws: true }); + console.log(` ${`dovetail, one-cell pieces at ${p} mm, screws`.padEnd(36)} ${r.L.pieces.length} pieces; ${leakText(r)}` + + `${r.bad ? ' FAIL' : ''}`); + if (r.bad) bad++; + } } /* The fit clearance at its ceiling, for every joint and every pitch band. From 31ff006ae14a36bedb3e36eea72a87fdcb4bb982 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 13:32:58 +0000 Subject: [PATCH 05/16] Rebuild the pages Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- bins/index.html | 16 +++++++++++++--- index.html | 16 +++++++++++++--- sw.js | 2 +- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/bins/index.html b/bins/index.html index 8735537..c1d4496 100644 --- a/bins/index.html +++ b/bins/index.html @@ -5267,11 +5267,21 @@

Your drawers

solids.push({ outline: pts.map(([u, v]) => [bs.cxr - bs.sx*u, bs.cyr - bs.sy*v]), sites: [bs] }); } } + /* The pockets are cut again (cutAgain) if they come out open. A boss's pocket is a + lottery of its own: default screws in one-cell pieces leave 3 to 6 open edges on + a boss's underside at 22 of the 901 pitches from 34 to 60 mm that take them, in + bosses no housing reaches, which are built as before. A boss cut short of the + piece's edge draws the lottery again at other pitches: four one-cell pieces with + dovetails, whose notches reach the bosses from 34 to 36.4 mm, left it at 34.64 + and 34.72 mm, where the whole boss had built closed. Cut again, no boss a housing + reaches leaks at any of those pitches. */ for (const { outline, sites } of solids) { let boss = extrudePoly(outline, 0, bossH); - if (bossFastener) - boss = csgSubtract(boss, [].concat(...sites.map((bs) => - movePolys(bossFastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off)))); + if (bossFastener) { + const pockets = [].concat(...sites.map((bs) => + movePolys(bossFastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off))); + boss = cutAgain(boss, pockets, csgSubtract(boss, pockets)); + } const b = flatBox(boss), cut = []; for (const k of ks) if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -sx*NUDGE, -sy*NUDGE)); diff --git a/index.html b/index.html index 398e850..33eb421 100644 --- a/index.html +++ b/index.html @@ -5054,11 +5054,21 @@

Your drawers

solids.push({ outline: pts.map(([u, v]) => [bs.cxr - bs.sx*u, bs.cyr - bs.sy*v]), sites: [bs] }); } } + /* The pockets are cut again (cutAgain) if they come out open. A boss's pocket is a + lottery of its own: default screws in one-cell pieces leave 3 to 6 open edges on + a boss's underside at 22 of the 901 pitches from 34 to 60 mm that take them, in + bosses no housing reaches, which are built as before. A boss cut short of the + piece's edge draws the lottery again at other pitches: four one-cell pieces with + dovetails, whose notches reach the bosses from 34 to 36.4 mm, left it at 34.64 + and 34.72 mm, where the whole boss had built closed. Cut again, no boss a housing + reaches leaks at any of those pitches. */ for (const { outline, sites } of solids) { let boss = extrudePoly(outline, 0, bossH); - if (bossFastener) - boss = csgSubtract(boss, [].concat(...sites.map((bs) => - movePolys(bossFastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off)))); + if (bossFastener) { + const pockets = [].concat(...sites.map((bs) => + movePolys(bossFastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off))); + boss = cutAgain(boss, pockets, csgSubtract(boss, pockets)); + } const b = flatBox(boss), cut = []; for (const k of ks) if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -sx*NUDGE, -sy*NUDGE)); diff --git a/sw.js b/sw.js index 28f14f2..f51bb68 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 = "f574dc64c687"; +const VERSION = "f90972e82aa9"; const FILES = [ "./", "bins/", From f7eee05050a71d1c412d7d956aa8748046a564a9 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 13:44:47 +0000 Subject: [PATCH 06/16] Keep a corner boss's joint cut off the cell's when either is cut again A boss a housing reaches has the joint's cut moved a NUDGE along each axis, so its walls stand a hair from the cell's and no edge is used four times. But a cut that comes out open is taken again a NUDGE along a diagonal (cutAgain), the cell's and the boss's alike, and that could put the boss's walls back on the cell's: a wall puzzle key at 36.13 mm with screws and a margin had 73 edges used four times in one piece, against 26 on the base. Moved two NUDGEs, no try of either cut lands on the other, and that piece has 21. The audit builds it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- docs/ENGINE.md | 5 ++++- src/core.js | 13 +++++++++---- test/plate-audit.js | 16 ++++++++++++++-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/docs/ENGINE.md b/docs/ENGINE.md index e8cd764..e216ac5 100644 --- a/docs/ENGINE.md +++ b/docs/ENGINE.md @@ -396,7 +396,10 @@ outline went into the boss and into the cell it shares faces with, and into both bosses meeting across a cell edge: an H-clip at 42 mm went from 40 edges used four times a piece to 59 and 68. So a boss a housing reaches stops a `BLOAT` short of the piece's edge, the two either side of one housing are built as one solid, and the cut is moved -`NUDGE` into its own boss, so its walls stand 1.7 microns from the cell's. That leaves +two `NUDGE`s into its own boss, so its walls stand 3.4 microns from the cell's. (One +`NUDGE` is not enough: a cut that comes out open is taken again a `NUDGE` along a +diagonal, the cell's and the boss's alike, and that could put the boss's walls back on +the cell's: 52 more four-use edges in a piece, on a wall puzzle key at 36.13 mm.) That leaves fewer four-use edges than before (31 a piece for that H-clip) and none used once, and a boss no housing reaches is built byte for byte as it was. A boss a housing reaches has its pockets cut again (`cutAgain`) if they come out open: a boss's pocket is a lottery of diff --git a/src/core.js b/src/core.js index eb173c5..c241492 100644 --- a/src/core.js +++ b/src/core.js @@ -3576,9 +3576,14 @@ function buildPiece(cfg, layout, piece, onStatus) { An H-clip at 42 mm went from 40 edges used four times a piece to 59 and 68. So a boss a housing reaches stops a BLOAT short of the piece's edge, where the cell's rim stands in for it; the two that meet on either side of the same housing are one - solid, the pair's outline drawn whole; and the cut is moved NUDGE (1.7 microns) one - way along each axis, so its walls stand in the boss a hair from where they stand in - the cell. None of that touches a boss no housing reaches, which is built as it was. */ + solid, the pair's outline drawn whole; and the cut is moved two NUDGEs (3.4 microns) + one way along each axis, so its walls stand in the boss a hair from where they stand + in the cell. Two, because a cut is taken again a NUDGE along a diagonal when it comes + out open (cutAgain), the cell's and the boss's alike: moved one NUDGE, the boss's + could come back to where the cell's stood, or go where the cell's had gone, and a + wall puzzle key at 36.13 mm with screws and a margin had 52 more edges used four + times than the base. None of that touches a boss no housing reaches, which is built + as it was. */ const fromBelow = [...notches, ...pnotches].map((nb) => tabNotch(cfg, nb, pad)); if (keyKind === 'recess') for (const bo of keyed) @@ -3678,7 +3683,7 @@ function buildPiece(cfg, layout, piece, onStatus) { } const b = flatBox(boss), cut = []; for (const k of ks) - if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -sx*NUDGE, -sy*NUDGE)); + if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -2*sx*NUDGE, -2*sy*NUDGE)); if (cut.length) boss = cutAgain(boss, cut, csgSubtract(boss, cut)); shells.push(boss); } diff --git a/test/plate-audit.js b/test/plate-audit.js index 2a97f0b..2e157dd 100644 --- a/test/plate-audit.js +++ b/test/plate-audit.js @@ -2108,8 +2108,8 @@ console.log('\nthe other limits, built at their ends:'); above and screws, and read along vertical lines 0.3 mm apart. The housing is what the joint takes out of the plate without its mountings (solid with no joint, empty with one), and none of it may be solid with the bosses on, and solid 5 microns round: a - boss's cut stands NUDGE off the cell's (see buildPiece), and the sliver of boss that - leaves in a housing, 1.7 microns thick, is not a fill. Every pocket has to be empty + boss's cut stands two NUDGEs off the cell's (see buildPiece), and the sliver of boss + that leaves in a housing, 3.4 microns thick, is not a fill. Every pocket has to be empty from its mouth to its floor. And the edges two bosses share where they meet, used four times (quarantined above), may not be more than the same plate has with no joint. */ console.log('\ncorner bosses beside a joint cut from beneath:'); @@ -2222,6 +2222,18 @@ console.log('\ncorner bosses beside a joint cut from beneath:'); `${r.bad ? ' FAIL' : ''}`); if (r.bad) bad++; } + /* And a boss's cut moved one NUDGE could stand where the cell's stands, when one or the + other was taken again (cutAgain): a wall puzzle key at 36.13 mm with screws and a margin + had 73 edges used four times in a piece, against 26 with no joint. */ + { + const p = 36.13, at = { pitch: p, drawerW: 4 * p + 7.3, drawerD: 2 * p + 5.1, mLeft: 3.1, mRight: 4.2, mFront: 2.5, + mBack: 2.6, bedW: 2 * p + 16, bedD: 400, baseMode: 'bosses', screws: true }; + const r = buildAll({ ...at, connector: 'puzzlekey', keyMount: 'wall', keyInsert: 'bottom' }); + const plain = buildAll({ ...at, connector: 'none' }); + const good = !r.open && r.bad <= plain.bad; + console.log(` ${'wall puzzle keys at 36.13 mm, screws'.padEnd(36)} ${leakText(r)}, ${plain.bad} with no joint${good ? '' : ' FAIL'}`); + if (!good) bad++; + } } /* The fit clearance at its ceiling, for every joint and every pitch band. From 64d5437db0e92ca3ef827037aaeb7d3c5c50ba4d Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 13:45:32 +0000 Subject: [PATCH 07/16] Rebuild the pages Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- bins/index.html | 13 +++++++++---- index.html | 13 +++++++++---- sw.js | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/bins/index.html b/bins/index.html index c1d4496..e502870 100644 --- a/bins/index.html +++ b/bins/index.html @@ -5182,9 +5182,14 @@

Your drawers

An H-clip at 42 mm went from 40 edges used four times a piece to 59 and 68. So a boss a housing reaches stops a BLOAT short of the piece's edge, where the cell's rim stands in for it; the two that meet on either side of the same housing are one - solid, the pair's outline drawn whole; and the cut is moved NUDGE (1.7 microns) one - way along each axis, so its walls stand in the boss a hair from where they stand in - the cell. None of that touches a boss no housing reaches, which is built as it was. */ + solid, the pair's outline drawn whole; and the cut is moved two NUDGEs (3.4 microns) + one way along each axis, so its walls stand in the boss a hair from where they stand + in the cell. Two, because a cut is taken again a NUDGE along a diagonal when it comes + out open (cutAgain), the cell's and the boss's alike: moved one NUDGE, the boss's + could come back to where the cell's stood, or go where the cell's had gone, and a + wall puzzle key at 36.13 mm with screws and a margin had 52 more edges used four + times than the base. None of that touches a boss no housing reaches, which is built + as it was. */ const fromBelow = [...notches, ...pnotches].map((nb) => tabNotch(cfg, nb, pad)); if (keyKind === 'recess') for (const bo of keyed) @@ -5284,7 +5289,7 @@

Your drawers

} const b = flatBox(boss), cut = []; for (const k of ks) - if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -sx*NUDGE, -sy*NUDGE)); + if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -2*sx*NUDGE, -2*sy*NUDGE)); if (cut.length) boss = cutAgain(boss, cut, csgSubtract(boss, cut)); shells.push(boss); } diff --git a/index.html b/index.html index 33eb421..92d2c8c 100644 --- a/index.html +++ b/index.html @@ -4969,9 +4969,14 @@

Your drawers

An H-clip at 42 mm went from 40 edges used four times a piece to 59 and 68. So a boss a housing reaches stops a BLOAT short of the piece's edge, where the cell's rim stands in for it; the two that meet on either side of the same housing are one - solid, the pair's outline drawn whole; and the cut is moved NUDGE (1.7 microns) one - way along each axis, so its walls stand in the boss a hair from where they stand in - the cell. None of that touches a boss no housing reaches, which is built as it was. */ + solid, the pair's outline drawn whole; and the cut is moved two NUDGEs (3.4 microns) + one way along each axis, so its walls stand in the boss a hair from where they stand + in the cell. Two, because a cut is taken again a NUDGE along a diagonal when it comes + out open (cutAgain), the cell's and the boss's alike: moved one NUDGE, the boss's + could come back to where the cell's stood, or go where the cell's had gone, and a + wall puzzle key at 36.13 mm with screws and a margin had 52 more edges used four + times than the base. None of that touches a boss no housing reaches, which is built + as it was. */ const fromBelow = [...notches, ...pnotches].map((nb) => tabNotch(cfg, nb, pad)); if (keyKind === 'recess') for (const bo of keyed) @@ -5071,7 +5076,7 @@

Your drawers

} const b = flatBox(boss), cut = []; for (const k of ks) - if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -sx*NUDGE, -sy*NUDGE)); + if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -2*sx*NUDGE, -2*sy*NUDGE)); if (cut.length) boss = cutAgain(boss, cut, csgSubtract(boss, cut)); shells.push(boss); } diff --git a/sw.js b/sw.js index f51bb68..910c2cd 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 = "f90972e82aa9"; +const VERSION = "75bacc49b327"; const FILES = [ "./", "bins/", From 74811e3d3adc0325f500ce130189cc68a0759533 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 14:50:33 +0000 Subject: [PATCH 08/16] Cut every corner boss's pockets again when they come out open A boss's pocket is a lottery of its own, joint or no joint: default screws in a one-cell piece left 3 to 6 open edges on a boss's underside at 22 of the 901 pitches from 34 to 60 mm that take them, and a 9.1 mm magnet at 39.46 mm 12 a piece. A boss no housing reaches now has its pocket cut again (cutAgain) when the first cut comes out open, as a reached boss's already is. Only when open. At 13 more of those pitches a whole boss's first cut comes out closed with a face turned over; unfoldFinished lays that fold out again, and every one of those pieces was watertight and oriented, so the first cut is kept and the bytes with it. Retaking those too would change 13 one-cell pitches and 10 magnet designs that had nothing wrong. Against the head before this, design by design: - one-cell drawer, default screws: 22 of 901 build new bytes, all 22 open before (81 edges), all watertight and oriented after; 879 the same bytes. - four one-cell pieces with dovetails, and with H-clips: the same 22 pitches each, open before (306 and 324 edges), 0 after; 879 the same. - one-cell drawer, magnets 6 mm and at their cap, from beneath and above, every 0.02 mm from 34 to 46: 26 of 2064 new bytes, all open before, 0 after; 2038 the same. Two at 43.9 mm (a 4.9 mm magnet) stay open with 3 edges: every try comes out open too, so they keep their bytes. No design changed whose first cut was closed, and none has more edges used four times. The audit builds the 37.7 mm one-cell drawer and the 39.46 mm magnet plate. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- docs/ENGINE.md | 18 ++++++++++++------ src/core.js | 32 ++++++++++++++++++++------------ test/plate-audit.js | 12 ++++++++++++ 3 files changed, 44 insertions(+), 18 deletions(-) diff --git a/docs/ENGINE.md b/docs/ENGINE.md index e216ac5..75134ab 100644 --- a/docs/ENGINE.md +++ b/docs/ENGINE.md @@ -400,12 +400,18 @@ two `NUDGE`s into its own boss, so its walls stand 3.4 microns from the cell's. `NUDGE` is not enough: a cut that comes out open is taken again a `NUDGE` along a diagonal, the cell's and the boss's alike, and that could put the boss's walls back on the cell's: 52 more four-use edges in a piece, on a wall puzzle key at 36.13 mm.) That leaves -fewer four-use edges than before (31 a piece for that H-clip) and none used once, and a -boss no housing reaches is built byte for byte as it was. A boss a housing reaches has -its pockets cut again (`cutAgain`) if they come out open: a boss's pocket is a lottery of -its own (default screws in a one-cell piece leave 3 to 6 open edges on a boss's underside -at 22 of the 901 pitches from 34 to 60 mm that take them, in bosses no housing reaches), -and the shorter boss draws it again at other pitches. +fewer four-use edges than before (31 a piece for that H-clip) and none used once. + +A boss's pocket is a lottery of its own: default screws in a one-cell piece left 3 to 6 +open edges on a boss's underside at 22 of the 901 pitches from 34 to 60 mm that take +them, and a 9.1 mm magnet at 39.46 mm 12 a piece, with no joint at all. So every boss's +pockets are cut again (`cutAgain`) when they come out open. A boss no housing reaches is +cut again only then, and is otherwise built byte for byte as it was: a pocket that comes +out closed with a face turned over (13 more of those pitches) has the fold +`unfoldFinished` lays out again, and every one of those pieces was watertight and +oriented. A boss a housing reaches is new, and is cut again when a pocket comes out +turned over too, as the joint's cut is; the shorter boss draws the lottery at other +pitches (34.64 and 34.72 mm, in four one-cell pieces with dovetails). `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 diff --git a/src/core.js b/src/core.js index c241492..2a9ef32 100644 --- a/src/core.js +++ b/src/core.js @@ -3582,8 +3582,7 @@ function buildPiece(cfg, layout, piece, onStatus) { out open (cutAgain), the cell's and the boss's alike: moved one NUDGE, the boss's could come back to where the cell's stood, or go where the cell's had gone, and a wall puzzle key at 36.13 mm with screws and a margin had 52 more edges used four - times than the base. None of that touches a boss no housing reaches, which is built - as it was. */ + times than the base. None of that touches a boss no housing reaches. */ const fromBelow = [...notches, ...pnotches].map((nb) => tabNotch(cfg, nb, pad)); if (keyKind === 'recess') for (const bo of keyed) @@ -3639,8 +3638,19 @@ function buildPiece(cfg, layout, piece, onStatus) { pts.push([0, bossW]); const world = pts.map(([u, v]) => [cxr - sx*u, cyr - sy*v]); let boss = extrudePoly(world, 0, bossH); - if (bossFastener) - boss = csgSubtract(boss, movePolys(bossFastener, ccx + sx*off, ccy + sy*off)); + /* A boss's pocket is a lottery of its own, so it is cut again (cutAgain) when it + comes out open. Default screws in one-cell pieces left 3 to 6 open edges on a + boss's underside at 22 of the 901 pitches from 34 to 60 mm that take them, and a + 9.1 mm magnet at 39.46 mm left 12 a piece; cut again, none of those leaks. Open + only: a pocket that comes out closed with a face turned over (13 more of those + pitches) has the fold unfoldFinished lays out again, and every one of those + pieces came out watertight and oriented, so it is kept as it was, as is every + pocket that comes out closed. */ + if (bossFastener) { + const pocket = movePolys(bossFastener, ccx + sx*off, ccy + sy*off); + const first = csgSubtract(boss, pocket); + boss = first.open ? cutAgain(boss, pocket, first) : first; + } shells.push(boss); continue; } @@ -3666,14 +3676,12 @@ function buildPiece(cfg, layout, piece, onStatus) { solids.push({ outline: pts.map(([u, v]) => [bs.cxr - bs.sx*u, bs.cyr - bs.sy*v]), sites: [bs] }); } } - /* The pockets are cut again (cutAgain) if they come out open. A boss's pocket is a - lottery of its own: default screws in one-cell pieces leave 3 to 6 open edges on - a boss's underside at 22 of the 901 pitches from 34 to 60 mm that take them, in - bosses no housing reaches, which are built as before. A boss cut short of the - piece's edge draws the lottery again at other pitches: four one-cell pieces with - dovetails, whose notches reach the bosses from 34 to 36.4 mm, left it at 34.64 - and 34.72 mm, where the whole boss had built closed. Cut again, no boss a housing - reaches leaks at any of those pitches. */ + /* The pockets are cut again when they come out open, as a whole boss's are (above), + or with a face turned over, as the joint's cut below is: this boss is new, with no + bytes of its own to keep. A boss cut short of the piece's edge draws their lottery + at other pitches: four one-cell pieces with dovetails, whose notches reach the + bosses from 34 to 36.4 mm, left it at 34.64 and 34.72 mm, where the whole boss had + built closed. */ for (const { outline, sites } of solids) { let boss = extrudePoly(outline, 0, bossH); if (bossFastener) { diff --git a/test/plate-audit.js b/test/plate-audit.js index 2e157dd..d4d42d1 100644 --- a/test/plate-audit.js +++ b/test/plate-audit.js @@ -2222,6 +2222,18 @@ console.log('\ncorner bosses beside a joint cut from beneath:'); `${r.bad ? ' FAIL' : ''}`); if (r.bad) bad++; } + /* A boss no housing reaches has its pockets cut again too when they come out open: default + screws in a one-cell drawer left 6 open edges under a boss at 37.7 mm (one of 22 + pitches from 34 to 60 mm), and a 9.1 mm magnet at 39.46 mm 12 a piece, with no joint. */ + for (const [name, over] of [ + ['one cell at 37.7 mm, screws', { pitch: 37.7, drawerW: 37.7, drawerD: 37.7, bedW: 57.7, bedD: 57.7, screws: true }], + ['no joint at 39.46 mm, 9.1 magnet', { pitch: 39.46, drawerW: 157.84, drawerD: 78.92, bedW: 94.92, bedD: 400, + magnets: true, magnetD: 9.1 }]]) { + const r = buildAll({ ...over, baseMode: 'bosses', connector: 'none' }); + console.log(` ${name.padEnd(36)} ${r.L.pieces.length} piece${r.L.pieces.length > 1 ? 's' : ''}; ${leakText(r)}` + + `${r.open ? ' FAIL' : ''}`); + if (r.open) bad++; + } /* And a boss's cut moved one NUDGE could stand where the cell's stands, when one or the other was taken again (cutAgain): a wall puzzle key at 36.13 mm with screws and a margin had 73 edges used four times in a piece, against 26 with no joint. */ From 3612afd8297c41c452a8f4355df514b88f96f661 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 14:50:36 +0000 Subject: [PATCH 09/16] Rebuild the pages Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- bins/index.html | 32 ++++++++++++++++++++------------ index.html | 32 ++++++++++++++++++++------------ sw.js | 2 +- 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/bins/index.html b/bins/index.html index e502870..05146b1 100644 --- a/bins/index.html +++ b/bins/index.html @@ -5188,8 +5188,7 @@

Your drawers

out open (cutAgain), the cell's and the boss's alike: moved one NUDGE, the boss's could come back to where the cell's stood, or go where the cell's had gone, and a wall puzzle key at 36.13 mm with screws and a margin had 52 more edges used four - times than the base. None of that touches a boss no housing reaches, which is built - as it was. */ + times than the base. None of that touches a boss no housing reaches. */ const fromBelow = [...notches, ...pnotches].map((nb) => tabNotch(cfg, nb, pad)); if (keyKind === 'recess') for (const bo of keyed) @@ -5245,8 +5244,19 @@

Your drawers

pts.push([0, bossW]); const world = pts.map(([u, v]) => [cxr - sx*u, cyr - sy*v]); let boss = extrudePoly(world, 0, bossH); - if (bossFastener) - boss = csgSubtract(boss, movePolys(bossFastener, ccx + sx*off, ccy + sy*off)); + /* A boss's pocket is a lottery of its own, so it is cut again (cutAgain) when it + comes out open. Default screws in one-cell pieces left 3 to 6 open edges on a + boss's underside at 22 of the 901 pitches from 34 to 60 mm that take them, and a + 9.1 mm magnet at 39.46 mm left 12 a piece; cut again, none of those leaks. Open + only: a pocket that comes out closed with a face turned over (13 more of those + pitches) has the fold unfoldFinished lays out again, and every one of those + pieces came out watertight and oriented, so it is kept as it was, as is every + pocket that comes out closed. */ + if (bossFastener) { + const pocket = movePolys(bossFastener, ccx + sx*off, ccy + sy*off); + const first = csgSubtract(boss, pocket); + boss = first.open ? cutAgain(boss, pocket, first) : first; + } shells.push(boss); continue; } @@ -5272,14 +5282,12 @@

Your drawers

solids.push({ outline: pts.map(([u, v]) => [bs.cxr - bs.sx*u, bs.cyr - bs.sy*v]), sites: [bs] }); } } - /* The pockets are cut again (cutAgain) if they come out open. A boss's pocket is a - lottery of its own: default screws in one-cell pieces leave 3 to 6 open edges on - a boss's underside at 22 of the 901 pitches from 34 to 60 mm that take them, in - bosses no housing reaches, which are built as before. A boss cut short of the - piece's edge draws the lottery again at other pitches: four one-cell pieces with - dovetails, whose notches reach the bosses from 34 to 36.4 mm, left it at 34.64 - and 34.72 mm, where the whole boss had built closed. Cut again, no boss a housing - reaches leaks at any of those pitches. */ + /* The pockets are cut again when they come out open, as a whole boss's are (above), + or with a face turned over, as the joint's cut below is: this boss is new, with no + bytes of its own to keep. A boss cut short of the piece's edge draws their lottery + at other pitches: four one-cell pieces with dovetails, whose notches reach the + bosses from 34 to 36.4 mm, left it at 34.64 and 34.72 mm, where the whole boss had + built closed. */ for (const { outline, sites } of solids) { let boss = extrudePoly(outline, 0, bossH); if (bossFastener) { diff --git a/index.html b/index.html index 92d2c8c..26c9dcc 100644 --- a/index.html +++ b/index.html @@ -4975,8 +4975,7 @@

Your drawers

out open (cutAgain), the cell's and the boss's alike: moved one NUDGE, the boss's could come back to where the cell's stood, or go where the cell's had gone, and a wall puzzle key at 36.13 mm with screws and a margin had 52 more edges used four - times than the base. None of that touches a boss no housing reaches, which is built - as it was. */ + times than the base. None of that touches a boss no housing reaches. */ const fromBelow = [...notches, ...pnotches].map((nb) => tabNotch(cfg, nb, pad)); if (keyKind === 'recess') for (const bo of keyed) @@ -5032,8 +5031,19 @@

Your drawers

pts.push([0, bossW]); const world = pts.map(([u, v]) => [cxr - sx*u, cyr - sy*v]); let boss = extrudePoly(world, 0, bossH); - if (bossFastener) - boss = csgSubtract(boss, movePolys(bossFastener, ccx + sx*off, ccy + sy*off)); + /* A boss's pocket is a lottery of its own, so it is cut again (cutAgain) when it + comes out open. Default screws in one-cell pieces left 3 to 6 open edges on a + boss's underside at 22 of the 901 pitches from 34 to 60 mm that take them, and a + 9.1 mm magnet at 39.46 mm left 12 a piece; cut again, none of those leaks. Open + only: a pocket that comes out closed with a face turned over (13 more of those + pitches) has the fold unfoldFinished lays out again, and every one of those + pieces came out watertight and oriented, so it is kept as it was, as is every + pocket that comes out closed. */ + if (bossFastener) { + const pocket = movePolys(bossFastener, ccx + sx*off, ccy + sy*off); + const first = csgSubtract(boss, pocket); + boss = first.open ? cutAgain(boss, pocket, first) : first; + } shells.push(boss); continue; } @@ -5059,14 +5069,12 @@

Your drawers

solids.push({ outline: pts.map(([u, v]) => [bs.cxr - bs.sx*u, bs.cyr - bs.sy*v]), sites: [bs] }); } } - /* The pockets are cut again (cutAgain) if they come out open. A boss's pocket is a - lottery of its own: default screws in one-cell pieces leave 3 to 6 open edges on - a boss's underside at 22 of the 901 pitches from 34 to 60 mm that take them, in - bosses no housing reaches, which are built as before. A boss cut short of the - piece's edge draws the lottery again at other pitches: four one-cell pieces with - dovetails, whose notches reach the bosses from 34 to 36.4 mm, left it at 34.64 - and 34.72 mm, where the whole boss had built closed. Cut again, no boss a housing - reaches leaks at any of those pitches. */ + /* The pockets are cut again when they come out open, as a whole boss's are (above), + or with a face turned over, as the joint's cut below is: this boss is new, with no + bytes of its own to keep. A boss cut short of the piece's edge draws their lottery + at other pitches: four one-cell pieces with dovetails, whose notches reach the + bosses from 34 to 36.4 mm, left it at 34.64 and 34.72 mm, where the whole boss had + built closed. */ for (const { outline, sites } of solids) { let boss = extrudePoly(outline, 0, bossH); if (bossFastener) { diff --git a/sw.js b/sw.js index 910c2cd..dff9d78 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 = "75bacc49b327"; +const VERSION = "5356d4979b02"; const FILES = [ "./", "bins/", From d64717d1d3cfa7173ab8ab88cdb33a2e0de4d0ec Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 16:46:05 +0000 Subject: [PATCH 10/16] Stand a corner boss over the ceiling of a cut it would be level with A boss is its pocket's depth and 0.8 mm (a magnet) or 1.0 (a screw head) tall, up to 2.6. One a joint's cut from beneath reaches, with its top level with the cut's ceiling (a dovetail's notch 2.4 mm, an H-clip's recess 2.3, a wall key's 2.0), came out open there: a 1.6 mm magnet or a 1.4 mm head beside a dovetail left 4 to 13 open edges a piece, at every pitch the notch reaches a boss. 0.01 mm off the level either way, none did. Such a boss now stands MOUNT_LEVEL over the ceiling, with a pocket from above cut from that top. Only bosses a housing reaches, within 0.05 mm of its ceiling, change. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- docs/ENGINE.md | 8 +++++++- src/core.js | 23 +++++++++++++++++++---- test/plate-audit.js | 15 +++++++++++++++ 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/docs/ENGINE.md b/docs/ENGINE.md index 85b40be..4c38750 100644 --- a/docs/ENGINE.md +++ b/docs/ENGINE.md @@ -400,7 +400,13 @@ two `NUDGE`s into its own boss, so its walls stand 3.4 microns from the cell's. `NUDGE` is not enough: a cut that comes out open is taken again a `NUDGE` along a diagonal, the cell's and the boss's alike, and that could put the boss's walls back on the cell's: 52 more four-use edges in a piece, on a wall puzzle key at 36.13 mm.) That leaves -fewer four-use edges than before (31 a piece for that H-clip) and none used once. +fewer four-use edges than before (31 a piece for that H-clip) and none used once. A boss +is its pocket's depth and 0.8 mm (a magnet) or 1.0 (a screw head) tall, up to 2.6, and +one whose top stood level with the ceiling of the cut that reaches it (a dovetail's notch +2.4 mm, an H-clip's recess 2.3, a wall key's 2.0) came out open there: a 1.6 mm magnet or +a 1.4 mm head beside a dovetail, 4 to 13 open edges a piece. 0.01 mm off the level either +way, none did. Such a boss stands `MOUNT_LEVEL` over the ceiling, with a pocket from above +cut from that top. A boss's pocket is a lottery of its own: default screws in a one-cell piece left 3 to 6 open edges on a boss's underside at 22 of the 901 pitches from 34 to 60 mm that take diff --git a/src/core.js b/src/core.js index fc10f37..91fe8a7 100644 --- a/src/core.js +++ b/src/core.js @@ -3749,6 +3749,7 @@ function buildPiece(cfg, layout, piece, onStatus) { return b; }; const cutBoxes = fromBelow.map(flatBox); + const cutTops = fromBelow.map((polys) => Math.max(...polys.flatMap((p) => p.verts.map((v) => v[2])))); const meets = (a, b) => a[0] < b[2] && b[0] < a[2] && a[1] < b[3] && b[1] < a[3]; // whole cells only: a half cell has no mounting sites (see the fastener cut above) const all = []; @@ -3833,12 +3834,26 @@ function buildPiece(cfg, layout, piece, onStatus) { bytes of its own to keep. A boss cut short of the piece's edge draws their lottery at other pitches: four one-cell pieces with dovetails, whose notches reach the bosses from 34 to 36.4 mm, left it at 34.64 and 34.72 mm, where the whole boss had - built closed. */ + built closed. + * + A boss whose top stands level with the ceiling of a cut that reaches it came out + open there, the cut's ceiling and its top in one plane: a dovetail's notch is + 2.4 mm tall, an H-clip's recess 2.3 and a wall key's 2.0, and a boss is its + pocket's depth and 0.8 (a magnet) or 1.0 (a screw head), up to 2.6. A 1.6 mm + magnet or a 1.4 mm head beside a dovetail left 4 to 9 open edges a piece at every + pitch the notch reaches a boss; 0.01 mm off the level either way, none. So such a + boss stands MOUNT_LEVEL over the ceiling, as one with a deeper pocket does, and a + pocket from above is cut from that top. mountLimits measures it from bossHeight, + which can only refuse sooner, and a pocket from above that the cut reaches is + refused at either height. */ + const level = ks.filter((k) => Math.abs(cutTops[k] - bossH) < MOUNT_LEVEL); + const top = level.length ? Math.max(...level.map((k) => cutTops[k])) + MOUNT_LEVEL : bossH; + const fastener = top === bossH ? bossFastener : fastenerCutter(cfg, top - cfg.magnetH, top + 0.5, top + 0.5); for (const { outline, sites } of solids) { - let boss = extrudePoly(outline, 0, bossH); - if (bossFastener) { + let boss = extrudePoly(outline, 0, top); + if (fastener) { const pockets = [].concat(...sites.map((bs) => - movePolys(bossFastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off))); + movePolys(fastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off))); boss = cutAgain(boss, pockets, csgSubtract(boss, pockets)); } const b = flatBox(boss), cut = []; diff --git a/test/plate-audit.js b/test/plate-audit.js index 8454b39..0d551e5 100644 --- a/test/plate-audit.js +++ b/test/plate-audit.js @@ -2284,6 +2284,21 @@ console.log('\ncorner bosses beside a joint cut from beneath:'); console.log(` ${'wall puzzle keys at 36.13 mm, screws'.padEnd(36)} ${leakText(r)}, ${plain.bad} with no joint${good ? '' : ' FAIL'}`); if (!good) bad++; } + /* A boss is its pocket's depth and 0.8 (a magnet) or 1.0 (a screw head) tall, and one + whose top stood level with the ceiling of the cut that reaches it came out open there: + a dovetail's notch is 2.4 mm tall, an H-clip's recess 2.3 and a wall key's 2.0. These + left 4 to 13 open edges a piece until such a boss stood MOUNT_LEVEL over the ceiling + (buildPiece). */ + for (const [name, over] of [ + ['dovetail at 36.13 mm, 1.6 mm magnet', { pitch: 36.13, connector: 'dovetail', magnets: true, magnetH: 1.6 }], + ['dovetail at 34.04 mm, 1.4 mm head', { pitch: 34.04, connector: 'dovetail', screws: true, screwHeadD: 4, screwHeadDepth: 1.4 }], + ['H-clip at 33.5 mm, 1.5 mm magnet', { pitch: 33.5, connector: 'hclip', magnets: true, magnetD: 4, magnetH: 1.5 }], + ['wall bowtie at 36.13 mm, 1 mm head', { pitch: 36.13, connector: 'bowtie', keyMount: 'wall', screws: true, screwHeadDepth: 1 }]]) { + const p = over.pitch; + const r = buildAll({ drawerW: 4 * p, drawerD: 2 * p, bedW: 2 * p + 16, bedD: 400, baseMode: 'bosses', ...over }); + console.log(` ${name.padEnd(36)} ${leakText(r)}${r.open ? ' FAIL' : ''}`); + if (r.open) bad++; + } } /* The fit clearance at its ceiling, for every joint and every pitch band. From c814b0fe3a5a1071ee1cc33f21476a4fa8878acc Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 16:46:09 +0000 Subject: [PATCH 11/16] Rebuild the pages Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- bins/index.html | 23 +++++++++++++++++++---- index.html | 23 +++++++++++++++++++---- sw.js | 2 +- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/bins/index.html b/bins/index.html index 1d49f77..5f6fceb 100644 --- a/bins/index.html +++ b/bins/index.html @@ -5355,6 +5355,7 @@

Your drawers

return b; }; const cutBoxes = fromBelow.map(flatBox); + const cutTops = fromBelow.map((polys) => Math.max(...polys.flatMap((p) => p.verts.map((v) => v[2])))); const meets = (a, b) => a[0] < b[2] && b[0] < a[2] && a[1] < b[3] && b[1] < a[3]; // whole cells only: a half cell has no mounting sites (see the fastener cut above) const all = []; @@ -5439,12 +5440,26 @@

Your drawers

bytes of its own to keep. A boss cut short of the piece's edge draws their lottery at other pitches: four one-cell pieces with dovetails, whose notches reach the bosses from 34 to 36.4 mm, left it at 34.64 and 34.72 mm, where the whole boss had - built closed. */ + built closed. + * + A boss whose top stands level with the ceiling of a cut that reaches it came out + open there, the cut's ceiling and its top in one plane: a dovetail's notch is + 2.4 mm tall, an H-clip's recess 2.3 and a wall key's 2.0, and a boss is its + pocket's depth and 0.8 (a magnet) or 1.0 (a screw head), up to 2.6. A 1.6 mm + magnet or a 1.4 mm head beside a dovetail left 4 to 9 open edges a piece at every + pitch the notch reaches a boss; 0.01 mm off the level either way, none. So such a + boss stands MOUNT_LEVEL over the ceiling, as one with a deeper pocket does, and a + pocket from above is cut from that top. mountLimits measures it from bossHeight, + which can only refuse sooner, and a pocket from above that the cut reaches is + refused at either height. */ + const level = ks.filter((k) => Math.abs(cutTops[k] - bossH) < MOUNT_LEVEL); + const top = level.length ? Math.max(...level.map((k) => cutTops[k])) + MOUNT_LEVEL : bossH; + const fastener = top === bossH ? bossFastener : fastenerCutter(cfg, top - cfg.magnetH, top + 0.5, top + 0.5); for (const { outline, sites } of solids) { - let boss = extrudePoly(outline, 0, bossH); - if (bossFastener) { + let boss = extrudePoly(outline, 0, top); + if (fastener) { const pockets = [].concat(...sites.map((bs) => - movePolys(bossFastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off))); + movePolys(fastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off))); boss = cutAgain(boss, pockets, csgSubtract(boss, pockets)); } const b = flatBox(boss), cut = []; diff --git a/index.html b/index.html index 40443c0..5ac6eb3 100644 --- a/index.html +++ b/index.html @@ -5142,6 +5142,7 @@

Your drawers

return b; }; const cutBoxes = fromBelow.map(flatBox); + const cutTops = fromBelow.map((polys) => Math.max(...polys.flatMap((p) => p.verts.map((v) => v[2])))); const meets = (a, b) => a[0] < b[2] && b[0] < a[2] && a[1] < b[3] && b[1] < a[3]; // whole cells only: a half cell has no mounting sites (see the fastener cut above) const all = []; @@ -5226,12 +5227,26 @@

Your drawers

bytes of its own to keep. A boss cut short of the piece's edge draws their lottery at other pitches: four one-cell pieces with dovetails, whose notches reach the bosses from 34 to 36.4 mm, left it at 34.64 and 34.72 mm, where the whole boss had - built closed. */ + built closed. + * + A boss whose top stands level with the ceiling of a cut that reaches it came out + open there, the cut's ceiling and its top in one plane: a dovetail's notch is + 2.4 mm tall, an H-clip's recess 2.3 and a wall key's 2.0, and a boss is its + pocket's depth and 0.8 (a magnet) or 1.0 (a screw head), up to 2.6. A 1.6 mm + magnet or a 1.4 mm head beside a dovetail left 4 to 9 open edges a piece at every + pitch the notch reaches a boss; 0.01 mm off the level either way, none. So such a + boss stands MOUNT_LEVEL over the ceiling, as one with a deeper pocket does, and a + pocket from above is cut from that top. mountLimits measures it from bossHeight, + which can only refuse sooner, and a pocket from above that the cut reaches is + refused at either height. */ + const level = ks.filter((k) => Math.abs(cutTops[k] - bossH) < MOUNT_LEVEL); + const top = level.length ? Math.max(...level.map((k) => cutTops[k])) + MOUNT_LEVEL : bossH; + const fastener = top === bossH ? bossFastener : fastenerCutter(cfg, top - cfg.magnetH, top + 0.5, top + 0.5); for (const { outline, sites } of solids) { - let boss = extrudePoly(outline, 0, bossH); - if (bossFastener) { + let boss = extrudePoly(outline, 0, top); + if (fastener) { const pockets = [].concat(...sites.map((bs) => - movePolys(bossFastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off))); + movePolys(fastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off))); boss = cutAgain(boss, pockets, csgSubtract(boss, pockets)); } const b = flatBox(boss), cut = []; diff --git a/sw.js b/sw.js index 6f524bf..34e0a0e 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 = "5bdc0e1d95b1"; +const VERSION = "817b521085d7"; const FILES = [ "./", "bins/", From eefacc3a44e48373bf54ab3dc7bf003427bd9f8b Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 18:50:43 +0000 Subject: [PATCH 12/16] Cut a corner boss again the other way when every retry leaves it folded A wall puzzle key at 36.92 mm with screws (a 2 mm hole, a 7.1 x 0.8 mm head), four cells square, kept a joint cut with a face turned over in the pair of bosses by the front edge's key, in A2 and in B2: three folds on the bed a piece, no edge open, and Download on. Every one of cutAgain's tries came back the same. Now a boss's cut that every try leaves open or turned is taken again moved two NUDGEs the other way along one axis, then the other, then both, and the first that comes out clean is kept; if none does, the first stands. Here the first, along y, builds both pieces with no folds and the same four-use edges. A cut that comes out right is built exactly as before, and the audit builds the design and counts its folds. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- docs/ENGINE.md | 9 +++++++++ src/core.js | 32 ++++++++++++++++++++++++++++---- test/plate-audit.js | 16 ++++++++++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/docs/ENGINE.md b/docs/ENGINE.md index 37b2350..fd542ea 100644 --- a/docs/ENGINE.md +++ b/docs/ENGINE.md @@ -419,6 +419,15 @@ oriented. A boss a housing reaches is new, and is cut again when a pocket comes turned over too, as the joint's cut is; the shorter boss draws the lottery at other pitches (34.64 and 34.72 mm, in four one-cell pieces with dovetails). +The joint's cut in a boss is a lottery too, and `cutAgain` does not always win it: a wall +puzzle key at 36.92 mm with screws (a 2 mm hole, a 7.1 × 0.8 mm head), four cells +square, kept a cut with a face turned over in two of its four pieces after every try, +three folds on the bed a piece, about one build in 3,600 of bosses a joint reaches. So +such a cut is taken again moved two `NUDGE`s the other way along one axis, then the +other, then both, and the first that comes out clean is kept; if none does, the first +stands. Each stands as far off the cell's walls as the first, and none nearer the +pockets. + `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 diff --git a/src/core.js b/src/core.js index 01dff7e..0cbd132 100644 --- a/src/core.js +++ b/src/core.js @@ -3920,10 +3920,34 @@ function buildPiece(cfg, layout, piece, onStatus) { movePolys(fastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off))); boss = cutAgain(boss, pockets, csgSubtract(boss, pockets)); } - const b = flatBox(boss), cut = []; - for (const k of ks) - if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -2*sx*NUDGE, -2*sy*NUDGE)); - if (cut.length) boss = cutAgain(boss, cut, csgSubtract(boss, cut)); + /* cutAgain's tries are not always enough here. A wall puzzle key at 36.92 mm with + screws (a 2 mm hole, a 7.1 x 0.8 head), four cells square, kept a cut with a + face turned over in the pair of bosses by the front edge's key, of A2 and of B2, + after every try: three folds on the bed a piece, about one build in 3,600 of + bosses a joint reaches. Moved two NUDGEs the other way along y it came out + clean. So a cut that every try leaves open or turned is taken again moved two + NUDGEs the other way along one axis, then the other, then both, and the first + that comes out closed with nothing turned over is kept; if none does, the first + stands. Two NUDGEs, not more: each stands as far from the cell's walls as the + first, and none nearer the pockets (see mountLimits). A cut that comes out right + is built exactly as before. */ + const b = flatBox(boss); + const cutAt = (a, c) => ks.flatMap((k) => + meets(cutBoxes[k], b) ? movePolys(fromBelow[k], -a*sx*NUDGE, -c*sy*NUDGE) : []); + const cut = cutAt(2, 2); + if (cut.length) { + const solid = boss; + boss = cutAgain(solid, cut, csgSubtract(solid, cut)); + for (const [a, c] of [[2, -2], [-2, 2], [-2, -2]]) { + if (!boss.open && !boss.turned) break; + let again; + try { + const alt = cutAt(a, c); + again = cutAgain(solid, alt, csgSubtract(solid, alt)); + } catch (e) { continue; } // the first cut stands + if (!again.open && !again.turned) boss = again; + } + } shells.push(boss); } } diff --git a/test/plate-audit.js b/test/plate-audit.js index 80252af..8c7ea47 100644 --- a/test/plate-audit.js +++ b/test/plate-audit.js @@ -2370,6 +2370,22 @@ console.log('\ncorner bosses beside a joint cut from beneath:'); console.log(` ${name.padEnd(36)} ${leakText(r)}${r.open ? ' FAIL' : ''}`); if (r.open) bad++; } + /* And a boss's cut can come out with a face turned over after every one of cutAgain's + tries: a wall puzzle key at 36.92 mm with screws (a 2 mm hole, a 7.1 x 0.8 head), four + 2 x 2 pieces, left three folds on the bed in two of them, by the front edge's key, with + no edge open, until such a cut was taken again moved the other way (buildPiece). So + folds as well, which an edge count cannot see. */ + { + const p = 36.92; + const r = buildAll({ pitch: p, drawerW: 4 * p, drawerD: 4 * p, bedW: 2 * p + 16, bedD: 2 * p + 16, + connector: 'puzzlekey', keyMount: 'wall', keyInsert: 'bottom', baseMode: 'bosses', + screws: true, screwHoleD: 2, screwHeadD: 7.1, screwHeadDepth: 0.8 }); + const folds = r.pieces.reduce((s, pp) => s + checkOrientation(pp).folds, 0); + const good = !r.open && !folds; + console.log(` ${'wall puzzle keys at 36.92 mm, screws'.padEnd(36)} ${r.L.pieces.length} pieces; ${leakText(r)}` + + `${folds ? `, ${folds} FOLDS` : ''}${good ? '' : ' FAIL'}`); + if (!good) bad++; + } } /* The fit clearance at its ceiling, for every joint and every pitch band. From ab7e5f70aa1ba1d73e1b82f78da1284732ada890 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 18:51:13 +0000 Subject: [PATCH 13/16] Keep a corner boss's pockets MOUNT_SEAM short of the boss's own cut mountLimits measured the joint's cuts where they stand in the cells, and a corner boss's cut stands two NUDGEs along each axis off that, up to 4.8 microns nearer a pocket: a pocket at the cap was 0.0051 to 0.0055 mm short of an H-clip's recess in the boss and 0.0057 to 0.0070 of a key's in the walls, against the 0.01 it was meant to keep. In a boss a pocket now stops that much further off. At every 0.01 mm of pitch from 30 to 60 with the five joints that reach the bosses, that lowers 2,676 of the 33,430 caps a joint sets (8%), all by a tenth but 6 dovetail ones by a hundredth, and starts a dovetail's refused sizes a hundredth lower in 5,392 of its 24,008. Without corner bosses nothing moves, and no build changes: NUDGE moves out of buildPiece, the same 1.7 microns, for mountLimits to use. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- docs/ENGINE.md | 9 ++++++++- src/core.js | 20 +++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/ENGINE.md b/docs/ENGINE.md index fd542ea..9c6c555 100644 --- a/docs/ENGINE.md +++ b/docs/ENGINE.md @@ -833,7 +833,14 @@ currently installed): that breaks in, about 0.02 mm wide and rounded out to the hundredth either side, as the field takes them: at 36 mm on the page's design 5.59, 5.6, 5.73 and 5.74 mm are refused, and 5.58, 5.61, 5.72 and 5.75 are taken. The page says so at the field and names the - sizes taken either side. Past the weld's reach there is still the + sizes taken either side. A corner boss's cut stands two `NUDGE`s along each axis off the + cell's, up to 4.8 microns nearer a pocket (one 0.01 mm short of the cell's was 0.0051 to + 0.0070 mm short of the boss's), so in a boss a pocket stops that much further off. + Counting a design's magnet, screw hole and screw head apart, at every 0.01 mm of pitch + from 30 to 60 with the five joints that reach the bosses, that lowers 2,676 of the + 33,430 caps a joint sets (8%), all by a tenth but 6 of a dovetail's by a hundredth, and + starts a dovetail's refused sizes a hundredth lower in 5,392 of its 24,008; nothing + without corner bosses moves. Past the weld's reach there is still the lottery the room cannot see, about one design in a thousand, single sizes with clean ones on either side, and it needs the pocket and the cut together: a 14.1 mm counterbore 2.4 to 3 mm deep, 0.09 mm short of a dovetail's notch at 43.17 mm, loose, diff --git a/src/core.js b/src/core.js index 0cbd132..89dd21f 100644 --- a/src/core.js +++ b/src/core.js @@ -2406,6 +2406,10 @@ const MOUNT_WALL = 1.0; level, and how near its walls may come to any joint's cut without breaking into it. See mountLimits. */ const MOUNT_LEVEL = 0.05, MOUNT_SEAM = 0.01; +/* How far a cut is moved, 1.7 microns along each axis, when it is taken again for coming + out open or with a face turned over (cutAgain, in buildPiece). A corner boss's cut from + beneath is moved two of them along each axis, off where the cell's stands. */ +const NUDGE = 0.0017; /* How far a mounting bore about (x, y) can grow before it meets any of `segs`, as the radius of the circle through its corners: the polygon cylinder() cuts, `sides` flats with a corner at every 2πk/sides from +x. A point is in that polygon when it stands no @@ -2654,6 +2658,17 @@ function mountLimits(cfg, layout, known) { const own = { magnetD: fit(cfg.magnetSide === 'top' ? top : under), screwHoleD: fit(top), screwHeadD: fit(under) }; // a dovetail's notch takes a pocket from beneath that breaks into it; every other cut does not const notch = cfg.connector === 'dovetail'; + /* The cuts are measured where they stand in the cells, and a corner boss's stands two + NUDGEs along each axis off that (buildPiece), up to 2·NUDGE·√2 (4.8 microns) nearer a + pocket: one MOUNT_SEAM short of the cell's cut was 0.0051 to 0.0055 mm short of an + H-clip's recess in the boss, and 0.0057 to 0.0070 of a key's in the walls. So in a + boss a pocket stops that much further off, MOUNT_SEAM short of the boss's cut as + well. Counting a design's magnet, screw hole and screw head apart, at every 0.01 mm + of pitch from 30 to 60 with the five joints that reach the bosses, it lowers 2,676 + of the 33,430 caps a joint sets (8%), all by a tenth but 6 of a dovetail's by a + hundredth, and starts a dovetail's refused sizes (`near`) a hundredth lower in 5,392 + of its 24,008. Without corner bosses nothing moves. */ + const seam = MOUNT_SEAM + (bosses ? 2 * NUDGE * Math.SQRT2 : 0); /* What the joint's cuts leave one size, as { cap, why, near }: the largest size, and what stops it: 'cut', a pocket that would break into a key's recess or a puzzle tab's notch; 'floor', one from above that leaves no layer of floor over a cut; 'level', one from @@ -2679,7 +2694,7 @@ function mountLimits(cfg, layout, known) { const level = Math.round(Math.abs(ceiling - c.top) * 1e6) / 1e6 < MOUNT_LEVEL; const stop = above ? 'floor' : !notch ? 'cut' : level ? 'level' : 'part'; for (const s of c.sites) { - const short = fits(s.bore[sides] - MOUNT_SEAM); + const short = fits(s.bore[sides] - seam); const size = stop === 'part' ? 2 * s.body : short; if (size < cap) { cap = size; why = stop; } if (stop === 'part') near.push([short, fits(s.bore[sides])]); @@ -3184,13 +3199,12 @@ function buildPiece(cfg, layout, piece, onStatus) { * So the cut is taken again as the pockets' is, as other trees over the same solids: * the cutters in the other order, the solid's faces in the other order, the faces * started a third and two thirds of the way round (which puts another of its planes at - * the root), the cutters moved 1.7 microns, the jitter the notch cutters already + * the root), the cutters moved 1.7 microns (NUDGE), the jitter the notch cutters already * carry, two ways, and last each cutter on its own, one after another, since two in * one cut split each other's faces and lose a sliver the same way. The first result * that is closed and has nothing turned over is kept; a cut that comes out right first * time, which is nearly every one, is built exactly as before. A try that throws is * passed over. */ - const NUDGE = 0.0017; // the cutters in a cut, each solid on its own (polygons that share a corner go together) const apart = (cut) => { const up = cut.map((_, i) => i), at = new Map(); From e72401cf1f911aca90b0ac4d91a2f56a4d1df207 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 18:51:25 +0000 Subject: [PATCH 14/16] Stop pointing corner pockets over a floored key at keys put in from above With corner pockets over a key housed in the floor, a refused magnet or screw size went on to say that keys inside the walls, put in from above, keep out of the solid floor under the pockets. Such a key needs no floor, so taking the hint stood the bosses up again with the key's cup in their pockets, #75's case. The hint is now left out wherever corner pockets would stand without the joint's floor, and kept under an Extra floor, which keeps them buried as a solid base does. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- src/ui.js | 8 ++++++-- test/ui/plates-robustness.spec.js | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/ui.js b/src/ui.js index e8bf682..244b710 100644 --- a/src/ui.js +++ b/src/ui.js @@ -103,7 +103,10 @@ const cutsNamed = () => `${['dovetail', 'puzzle'].includes(state.connector) ? 'n that would reach the tab in one, a pocket any wider coming too near the notch's edge, or any other hole breaking into the cut. 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 - stands into a boss's pocket (#75). */ + stands into 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 + taking the hint would stand them up again, and the cup in their pockets. Only a floor + asked for (bottomPad) keeps them buried whatever the joint. */ const mountWhy = (opens, field) => { const joint = mount().joint[field]; const cuts = cutsNamed(); @@ -119,7 +122,8 @@ const mountWhy = (opens, field) => { : 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') + - (joint && KEYED.includes(state.connector) && !keyFromTop() && !cornerBosses(state) + (joint && KEYED.includes(state.connector) && !keyFromTop() && + !(state.baseMode === 'bosses' && !(state.bottomPad > 0)) ? `; keys ${keyInWall() ? '' : 'housed inside the walls and '}put in from above ` + 'keep out of the solid floor under these pockets' : ''); }; diff --git a/test/ui/plates-robustness.spec.js b/test/ui/plates-robustness.spec.js index 1e4f4f5..a50307f 100644 --- a/test/ui/plates-robustness.spec.js +++ b/test/ui/plates-robustness.spec.js @@ -197,6 +197,27 @@ test.describe('ranges on the geometry fields', () => { expect(await exportOff(page)).toBe(true); expect(errors).toEqual([]); }); + /* #79's review: a refused pocket over a floored key went on to say that keys inside the + walls, put in from above, keep out of the solid floor under it. With corner pockets + that is the way back to #75: such a key needs no floor, so the bosses stand again + and its cup stands in their pockets. An extra floor keeps them buried, and there the + hint holds, as it does for a solid base. */ + test('corner pockets over a floored key are not pointed at keys put in from above', async ({ page }) => { + const at = '#pi=37.98&w=151.92&d=75.96&mm=custom&ml=0&mr=0&mf=0&mb=0&bw=91.96&bd=400&cn=bowtie&km=floor' + + '&ki=bottom&bm=bosses&mg=1&md=5.81'; + const errors = await openAt(page, at); + const refusal = /Magnet Ø must be 3\.8 mm or less at a 37\.98 mm pitch — .* the recesses the bowtie keys fit into/; + const hint = /put in from above keep out of the solid floor/; + expect(await text(page, 'errMagnet')).toMatch(refusal); + expect(await text(page, 'errMagnet')).not.toMatch(hint); + expect(await text(page, 'warnings')).not.toMatch(hint); + expect(await exportOff(page)).toBe(true); + await page.goto('about:blank'); + await openAt(page, at.replace('&bm=bosses', '&bm=bosses&bp=1')); + expect(await text(page, 'errMagnet')).toMatch(refusal); + expect(await text(page, 'errMagnet')).toMatch(hint); + expect(errors).toEqual([]); + }); test('corner pockets under an extra floor are cut into it, and Checks says so', async ({ page }) => { const errors = await openAt(page, '#cn=none&bm=bosses&sc=1&bp=1'); expect(await text(page, 'warnings')).toMatch( From 8cdabed6e0164c56012cf67cb71d3962c5a2312e Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 18:51:43 +0000 Subject: [PATCH 15/16] Say what the corner bosses' level and offset notes measured and promise The level boss's comment said 4 to 9 open edges where the dovetail left 4 to 13; it gives each joint's now: 4 to 13 beside a dovetail, 9 to 30 an H-clip, 4 to 8, 9 to 18 and 25 to 74 a bowtie, a snap clip and a puzzle key in the walls. ENGINE.md no longer lists a puzzle's notch among the cuts taken from bosses: the puzzle's lobes always have their floor. The two NUDGEs keep a boss's walls off the cell's along each axis while at most one of the two cuts is taken again, and the notes now say so, not more. And the level test is left unrounded, with the reason: rounded to the micron as mountLimits' is, the bosses raised now at exactly MOUNT_LEVEL (2.25 mm by an H-clip, 2.05 by a key in the walls, 2.45 by a dovetail) would not be, and their bytes would change, where both ways build clean. No build changes. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- docs/ENGINE.md | 41 ++++++++++++++++++++++++----------------- src/core.js | 24 +++++++++++++++++++----- 2 files changed, 43 insertions(+), 22 deletions(-) diff --git a/docs/ENGINE.md b/docs/ENGINE.md index 9c6c555..cfbf5ea 100644 --- a/docs/ENGINE.md +++ b/docs/ENGINE.md @@ -389,23 +389,30 @@ Corner bosses are built only on an open underside (`cornerBosses`). A floor unde sockets, a key housed in the floor (2.8 mm), the puzzle's lobes (2.6) or Extra floor, stood round the 2.6 mm bosses and sealed their pockets in it (#70); with one, the plate is built as a solid floor builds it, pockets and the floor's growth included, and Checks says -so. A joint cut from beneath where four cells meet (a wall key's recess, an H-clip's, a -dovetail's or a puzzle's notch) is taken out of the bosses as well as the cells, after -their pockets; the bosses used to stand in the whole housing. Cut plainly, the housing's -outline went into the boss and into the cell it shares faces with, and into both of two -bosses meeting across a cell edge: an H-clip at 42 mm went from 40 edges used four times -a piece to 59 and 68. So a boss a housing reaches stops a `BLOAT` short of the piece's -edge, the two either side of one housing are built as one solid, and the cut is moved -two `NUDGE`s into its own boss, so its walls stand 3.4 microns from the cell's. (One -`NUDGE` is not enough: a cut that comes out open is taken again a `NUDGE` along a -diagonal, the cell's and the boss's alike, and that could put the boss's walls back on -the cell's: 52 more four-use edges in a piece, on a wall puzzle key at 36.13 mm.) That leaves -fewer four-use edges than before (31 a piece for that H-clip) and none used once. A boss -is its pocket's depth and 0.8 mm (a magnet) or 1.0 (a screw head) tall, up to 2.6, and -one whose top stood level with the ceiling of the cut that reaches it (a dovetail's notch -2.4 mm, an H-clip's recess 2.3, a wall key's 2.0) came out open there: a 1.6 mm magnet or -a 1.4 mm head beside a dovetail, 4 to 13 open edges a piece. 0.01 mm off the level either -way, none did. Such a boss stands `MOUNT_LEVEL` over the ceiling, with a pocket from above +so. A joint cut from beneath where four cells meet (a wall key's recess, an H-clip's or a +dovetail's notch; the puzzle's lobes always have their floor, so no boss stands by them) +is taken out of the bosses as well as the cells, after their pockets; the bosses used to +stand in the whole housing. Cut plainly, the housing's outline went into the boss and +into the cell it shares faces with, and into both of two bosses meeting across a cell +edge: an H-clip at 42 mm went from 40 edges used four times a piece to 59 and 68. So a +boss a housing reaches stops a `BLOAT` short of the piece's edge, the two either side of +one housing are built as one solid, and the cut is moved two `NUDGE`s into its own boss, +so its walls stand off the cell's. (One `NUDGE` is not enough: a cut that comes out open +is taken again a `NUDGE` along a diagonal, the cell's and the boss's alike, and that could +put the boss's walls back on the cell's: 52 more four-use edges in a piece, on a wall +puzzle key at 36.13 mm.) That leaves fewer four-use edges than before (31 a piece for that +H-clip) and none used once. Two `NUDGE`s keep the walls a `NUDGE` apart or more along +each axis while at most one of the two cuts is taken again, and that is all they promise: +with both taken again, a wall square to x can stand where the cell's does (both of +`cutAgain`'s nudges go up y, so one square to y cannot), and a wall that runs along the +diagonal the cut is moved on is not moved off the cell's at all. A boss is its pocket's +depth and 0.8 mm (a magnet) or 1.0 (a screw head) tall, up to 2.6, and one whose top +stood level with the ceiling of the cut that reaches it (a dovetail's notch 2.4 mm, an +H-clip's recess 2.3, a wall key's 2.0) came out open there, at every pitch the cut +reaches it: 4 to 13 open edges a piece beside a dovetail (a 1.6 mm magnet or a 1.4 mm +head), 9 to 30 beside an H-clip, and 4 to 8, 9 to 18 and 25 to 74 beside a bowtie, a snap +clip and a puzzle key in the walls. Beside the dovetail, 0.01 mm off the level either way, +none did. Such a boss stands `MOUNT_LEVEL` over the ceiling, with a pocket from above cut from that top. A boss's pocket is a lottery of its own: default screws in a one-cell piece left 3 to 6 diff --git a/src/core.js b/src/core.js index 89dd21f..e3dd24b 100644 --- a/src/core.js +++ b/src/core.js @@ -3812,7 +3812,12 @@ function buildPiece(cfg, layout, piece, onStatus) { out open (cutAgain), the cell's and the boss's alike: moved one NUDGE, the boss's could come back to where the cell's stood, or go where the cell's had gone, and a wall puzzle key at 36.13 mm with screws and a margin had 52 more edges used four - times than the base. None of that touches a boss no housing reaches. */ + times than the base. Two keep them a NUDGE apart or more along each axis while at + most one of the two is taken again. That is all they promise: with both taken + again, a wall square to x can stand where the cell's does (cutAgain's nudges both + go up y, so one square to y cannot), and a wall that runs along the diagonal the cut + is moved on is not moved off the cell's at all. None of that touches a boss no + housing reaches. */ const fromBelow = [...notches, ...pnotches].map((nb) => tabNotch(cfg, nb, pad)); if (keyKind === 'recess') for (const bo of keyed) @@ -3917,13 +3922,22 @@ function buildPiece(cfg, layout, piece, onStatus) { A boss whose top stands level with the ceiling of a cut that reaches it came out open there, the cut's ceiling and its top in one plane: a dovetail's notch is 2.4 mm tall, an H-clip's recess 2.3 and a wall key's 2.0, and a boss is its - pocket's depth and 0.8 (a magnet) or 1.0 (a screw head), up to 2.6. A 1.6 mm - magnet or a 1.4 mm head beside a dovetail left 4 to 9 open edges a piece at every - pitch the notch reaches a boss; 0.01 mm off the level either way, none. So such a + pocket's depth and 0.8 (a magnet) or 1.0 (a screw head), up to 2.6. Level, a + boss left open edges at every pitch the cut reaches it: 4 to 13 a piece beside a + dovetail (a 1.6 mm magnet or a 1.4 mm head), 9 to 30 beside an H-clip, and 4 to + 8, 9 to 18 and 25 to 74 beside a bowtie, a snap clip and a puzzle key in the + walls; beside the dovetail, 0.01 mm off the level either way, none. So such a boss stands MOUNT_LEVEL over the ceiling, as one with a deeper pocket does, and a pocket from above is cut from that top. mountLimits measures it from bossHeight, which can only refuse sooner, and a pocket from above that the cut reaches is - refused at either height. */ + refused at either height. + * + Level here is not rounded to the micron, as mountLimits' is: exactly MOUNT_LEVEL + off, a boss is raised or not as the difference comes out in floating point, a + 2.25 mm one under an H-clip's 2.3 and a 2.45 mm one over a dovetail's 2.4 raised, + a 2.35 mm one under the dovetail's not. Both ways build clean. Rounded, the bosses + raised now at exactly MOUNT_LEVEL would not be, and their bytes would change: 2.25 + mm beside an H-clip, 2.05 beside a key in the walls, 2.45 beside a dovetail. */ const level = ks.filter((k) => Math.abs(cutTops[k] - bossH) < MOUNT_LEVEL); const top = level.length ? Math.max(...level.map((k) => cutTops[k])) + MOUNT_LEVEL : bossH; const fastener = top === bossH ? bossFastener : fastenerCutter(cfg, top - cfg.magnetH, top + 0.5, top + 0.5); From e8f6b0431712160a87d962ffe3466d863a014ca7 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 18:51:55 +0000 Subject: [PATCH 16/16] Rebuild the pages Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uqqb1cvhXxrpb3P6y6ykBY --- bins/index.html | 76 +++++++++++++++++++++++++++++++++++++------- index.html | 84 ++++++++++++++++++++++++++++++++++++++++--------- sw.js | 2 +- 3 files changed, 135 insertions(+), 27 deletions(-) diff --git a/bins/index.html b/bins/index.html index 42a192a..b4bf8ae 100644 --- a/bins/index.html +++ b/bins/index.html @@ -4012,6 +4012,10 @@

Your drawers

level, and how near its walls may come to any joint's cut without breaking into it. See mountLimits. */ const MOUNT_LEVEL = 0.05, MOUNT_SEAM = 0.01; +/* How far a cut is moved, 1.7 microns along each axis, when it is taken again for coming + out open or with a face turned over (cutAgain, in buildPiece). A corner boss's cut from + beneath is moved two of them along each axis, off where the cell's stands. */ +const NUDGE = 0.0017; /* How far a mounting bore about (x, y) can grow before it meets any of `segs`, as the radius of the circle through its corners: the polygon cylinder() cuts, `sides` flats with a corner at every 2πk/sides from +x. A point is in that polygon when it stands no @@ -4260,6 +4264,17 @@

Your drawers

const own = { magnetD: fit(cfg.magnetSide === 'top' ? top : under), screwHoleD: fit(top), screwHeadD: fit(under) }; // a dovetail's notch takes a pocket from beneath that breaks into it; every other cut does not const notch = cfg.connector === 'dovetail'; + /* The cuts are measured where they stand in the cells, and a corner boss's stands two + NUDGEs along each axis off that (buildPiece), up to 2·NUDGE·√2 (4.8 microns) nearer a + pocket: one MOUNT_SEAM short of the cell's cut was 0.0051 to 0.0055 mm short of an + H-clip's recess in the boss, and 0.0057 to 0.0070 of a key's in the walls. So in a + boss a pocket stops that much further off, MOUNT_SEAM short of the boss's cut as + well. Counting a design's magnet, screw hole and screw head apart, at every 0.01 mm + of pitch from 30 to 60 with the five joints that reach the bosses, it lowers 2,676 + of the 33,430 caps a joint sets (8%), all by a tenth but 6 of a dovetail's by a + hundredth, and starts a dovetail's refused sizes (`near`) a hundredth lower in 5,392 + of its 24,008. Without corner bosses nothing moves. */ + const seam = MOUNT_SEAM + (bosses ? 2 * NUDGE * Math.SQRT2 : 0); /* What the joint's cuts leave one size, as { cap, why, near }: the largest size, and what stops it: 'cut', a pocket that would break into a key's recess or a puzzle tab's notch; 'floor', one from above that leaves no layer of floor over a cut; 'level', one from @@ -4285,7 +4300,7 @@

Your drawers

const level = Math.round(Math.abs(ceiling - c.top) * 1e6) / 1e6 < MOUNT_LEVEL; const stop = above ? 'floor' : !notch ? 'cut' : level ? 'level' : 'part'; for (const s of c.sites) { - const short = fits(s.bore[sides] - MOUNT_SEAM); + const short = fits(s.bore[sides] - seam); const size = stop === 'part' ? 2 * s.body : short; if (size < cap) { cap = size; why = stop; } if (stop === 'part') near.push([short, fits(s.bore[sides])]); @@ -4790,13 +4805,12 @@

Your drawers

* So the cut is taken again as the pockets' is, as other trees over the same solids: * the cutters in the other order, the solid's faces in the other order, the faces * started a third and two thirds of the way round (which puts another of its planes at - * the root), the cutters moved 1.7 microns, the jitter the notch cutters already + * the root), the cutters moved 1.7 microns (NUDGE), the jitter the notch cutters already * carry, two ways, and last each cutter on its own, one after another, since two in * one cut split each other's faces and lose a sliver the same way. The first result * that is closed and has nothing turned over is kept; a cut that comes out right first * time, which is nearly every one, is built exactly as before. A try that throws is * passed over. */ - const NUDGE = 0.0017; // the cutters in a cut, each solid on its own (polygons that share a corner go together) const apart = (cut) => { const up = cut.map((_, i) => i), at = new Map(); @@ -5404,7 +5418,12 @@

Your drawers

out open (cutAgain), the cell's and the boss's alike: moved one NUDGE, the boss's could come back to where the cell's stood, or go where the cell's had gone, and a wall puzzle key at 36.13 mm with screws and a margin had 52 more edges used four - times than the base. None of that touches a boss no housing reaches. */ + times than the base. Two keep them a NUDGE apart or more along each axis while at + most one of the two is taken again. That is all they promise: with both taken + again, a wall square to x can stand where the cell's does (cutAgain's nudges both + go up y, so one square to y cannot), and a wall that runs along the diagonal the cut + is moved on is not moved off the cell's at all. None of that touches a boss no + housing reaches. */ const fromBelow = [...notches, ...pnotches].map((nb) => tabNotch(cfg, nb, pad)); if (keyKind === 'recess') for (const bo of keyed) @@ -5509,13 +5528,22 @@

Your drawers

A boss whose top stands level with the ceiling of a cut that reaches it came out open there, the cut's ceiling and its top in one plane: a dovetail's notch is 2.4 mm tall, an H-clip's recess 2.3 and a wall key's 2.0, and a boss is its - pocket's depth and 0.8 (a magnet) or 1.0 (a screw head), up to 2.6. A 1.6 mm - magnet or a 1.4 mm head beside a dovetail left 4 to 9 open edges a piece at every - pitch the notch reaches a boss; 0.01 mm off the level either way, none. So such a + pocket's depth and 0.8 (a magnet) or 1.0 (a screw head), up to 2.6. Level, a + boss left open edges at every pitch the cut reaches it: 4 to 13 a piece beside a + dovetail (a 1.6 mm magnet or a 1.4 mm head), 9 to 30 beside an H-clip, and 4 to + 8, 9 to 18 and 25 to 74 beside a bowtie, a snap clip and a puzzle key in the + walls; beside the dovetail, 0.01 mm off the level either way, none. So such a boss stands MOUNT_LEVEL over the ceiling, as one with a deeper pocket does, and a pocket from above is cut from that top. mountLimits measures it from bossHeight, which can only refuse sooner, and a pocket from above that the cut reaches is - refused at either height. */ + refused at either height. + * + Level here is not rounded to the micron, as mountLimits' is: exactly MOUNT_LEVEL + off, a boss is raised or not as the difference comes out in floating point, a + 2.25 mm one under an H-clip's 2.3 and a 2.45 mm one over a dovetail's 2.4 raised, + a 2.35 mm one under the dovetail's not. Both ways build clean. Rounded, the bosses + raised now at exactly MOUNT_LEVEL would not be, and their bytes would change: 2.25 + mm beside an H-clip, 2.05 beside a key in the walls, 2.45 beside a dovetail. */ const level = ks.filter((k) => Math.abs(cutTops[k] - bossH) < MOUNT_LEVEL); const top = level.length ? Math.max(...level.map((k) => cutTops[k])) + MOUNT_LEVEL : bossH; const fastener = top === bossH ? bossFastener : fastenerCutter(cfg, top - cfg.magnetH, top + 0.5, top + 0.5); @@ -5526,10 +5554,34 @@

Your drawers

movePolys(fastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off))); boss = cutAgain(boss, pockets, csgSubtract(boss, pockets)); } - const b = flatBox(boss), cut = []; - for (const k of ks) - if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -2*sx*NUDGE, -2*sy*NUDGE)); - if (cut.length) boss = cutAgain(boss, cut, csgSubtract(boss, cut)); + /* cutAgain's tries are not always enough here. A wall puzzle key at 36.92 mm with + screws (a 2 mm hole, a 7.1 x 0.8 head), four cells square, kept a cut with a + face turned over in the pair of bosses by the front edge's key, of A2 and of B2, + after every try: three folds on the bed a piece, about one build in 3,600 of + bosses a joint reaches. Moved two NUDGEs the other way along y it came out + clean. So a cut that every try leaves open or turned is taken again moved two + NUDGEs the other way along one axis, then the other, then both, and the first + that comes out closed with nothing turned over is kept; if none does, the first + stands. Two NUDGEs, not more: each stands as far from the cell's walls as the + first, and none nearer the pockets (see mountLimits). A cut that comes out right + is built exactly as before. */ + const b = flatBox(boss); + const cutAt = (a, c) => ks.flatMap((k) => + meets(cutBoxes[k], b) ? movePolys(fromBelow[k], -a*sx*NUDGE, -c*sy*NUDGE) : []); + const cut = cutAt(2, 2); + if (cut.length) { + const solid = boss; + boss = cutAgain(solid, cut, csgSubtract(solid, cut)); + for (const [a, c] of [[2, -2], [-2, 2], [-2, -2]]) { + if (!boss.open && !boss.turned) break; + let again; + try { + const alt = cutAt(a, c); + again = cutAgain(solid, alt, csgSubtract(solid, alt)); + } catch (e) { continue; } // the first cut stands + if (!again.open && !again.turned) boss = again; + } + } shells.push(boss); } } diff --git a/index.html b/index.html index 76b85cf..d783bd4 100644 --- a/index.html +++ b/index.html @@ -3799,6 +3799,10 @@

Your drawers

level, and how near its walls may come to any joint's cut without breaking into it. See mountLimits. */ const MOUNT_LEVEL = 0.05, MOUNT_SEAM = 0.01; +/* How far a cut is moved, 1.7 microns along each axis, when it is taken again for coming + out open or with a face turned over (cutAgain, in buildPiece). A corner boss's cut from + beneath is moved two of them along each axis, off where the cell's stands. */ +const NUDGE = 0.0017; /* How far a mounting bore about (x, y) can grow before it meets any of `segs`, as the radius of the circle through its corners: the polygon cylinder() cuts, `sides` flats with a corner at every 2πk/sides from +x. A point is in that polygon when it stands no @@ -4047,6 +4051,17 @@

Your drawers

const own = { magnetD: fit(cfg.magnetSide === 'top' ? top : under), screwHoleD: fit(top), screwHeadD: fit(under) }; // a dovetail's notch takes a pocket from beneath that breaks into it; every other cut does not const notch = cfg.connector === 'dovetail'; + /* The cuts are measured where they stand in the cells, and a corner boss's stands two + NUDGEs along each axis off that (buildPiece), up to 2·NUDGE·√2 (4.8 microns) nearer a + pocket: one MOUNT_SEAM short of the cell's cut was 0.0051 to 0.0055 mm short of an + H-clip's recess in the boss, and 0.0057 to 0.0070 of a key's in the walls. So in a + boss a pocket stops that much further off, MOUNT_SEAM short of the boss's cut as + well. Counting a design's magnet, screw hole and screw head apart, at every 0.01 mm + of pitch from 30 to 60 with the five joints that reach the bosses, it lowers 2,676 + of the 33,430 caps a joint sets (8%), all by a tenth but 6 of a dovetail's by a + hundredth, and starts a dovetail's refused sizes (`near`) a hundredth lower in 5,392 + of its 24,008. Without corner bosses nothing moves. */ + const seam = MOUNT_SEAM + (bosses ? 2 * NUDGE * Math.SQRT2 : 0); /* What the joint's cuts leave one size, as { cap, why, near }: the largest size, and what stops it: 'cut', a pocket that would break into a key's recess or a puzzle tab's notch; 'floor', one from above that leaves no layer of floor over a cut; 'level', one from @@ -4072,7 +4087,7 @@

Your drawers

const level = Math.round(Math.abs(ceiling - c.top) * 1e6) / 1e6 < MOUNT_LEVEL; const stop = above ? 'floor' : !notch ? 'cut' : level ? 'level' : 'part'; for (const s of c.sites) { - const short = fits(s.bore[sides] - MOUNT_SEAM); + const short = fits(s.bore[sides] - seam); const size = stop === 'part' ? 2 * s.body : short; if (size < cap) { cap = size; why = stop; } if (stop === 'part') near.push([short, fits(s.bore[sides])]); @@ -4577,13 +4592,12 @@

Your drawers

* So the cut is taken again as the pockets' is, as other trees over the same solids: * the cutters in the other order, the solid's faces in the other order, the faces * started a third and two thirds of the way round (which puts another of its planes at - * the root), the cutters moved 1.7 microns, the jitter the notch cutters already + * the root), the cutters moved 1.7 microns (NUDGE), the jitter the notch cutters already * carry, two ways, and last each cutter on its own, one after another, since two in * one cut split each other's faces and lose a sliver the same way. The first result * that is closed and has nothing turned over is kept; a cut that comes out right first * time, which is nearly every one, is built exactly as before. A try that throws is * passed over. */ - const NUDGE = 0.0017; // the cutters in a cut, each solid on its own (polygons that share a corner go together) const apart = (cut) => { const up = cut.map((_, i) => i), at = new Map(); @@ -5191,7 +5205,12 @@

Your drawers

out open (cutAgain), the cell's and the boss's alike: moved one NUDGE, the boss's could come back to where the cell's stood, or go where the cell's had gone, and a wall puzzle key at 36.13 mm with screws and a margin had 52 more edges used four - times than the base. None of that touches a boss no housing reaches. */ + times than the base. Two keep them a NUDGE apart or more along each axis while at + most one of the two is taken again. That is all they promise: with both taken + again, a wall square to x can stand where the cell's does (cutAgain's nudges both + go up y, so one square to y cannot), and a wall that runs along the diagonal the cut + is moved on is not moved off the cell's at all. None of that touches a boss no + housing reaches. */ const fromBelow = [...notches, ...pnotches].map((nb) => tabNotch(cfg, nb, pad)); if (keyKind === 'recess') for (const bo of keyed) @@ -5296,13 +5315,22 @@

Your drawers

A boss whose top stands level with the ceiling of a cut that reaches it came out open there, the cut's ceiling and its top in one plane: a dovetail's notch is 2.4 mm tall, an H-clip's recess 2.3 and a wall key's 2.0, and a boss is its - pocket's depth and 0.8 (a magnet) or 1.0 (a screw head), up to 2.6. A 1.6 mm - magnet or a 1.4 mm head beside a dovetail left 4 to 9 open edges a piece at every - pitch the notch reaches a boss; 0.01 mm off the level either way, none. So such a + pocket's depth and 0.8 (a magnet) or 1.0 (a screw head), up to 2.6. Level, a + boss left open edges at every pitch the cut reaches it: 4 to 13 a piece beside a + dovetail (a 1.6 mm magnet or a 1.4 mm head), 9 to 30 beside an H-clip, and 4 to + 8, 9 to 18 and 25 to 74 beside a bowtie, a snap clip and a puzzle key in the + walls; beside the dovetail, 0.01 mm off the level either way, none. So such a boss stands MOUNT_LEVEL over the ceiling, as one with a deeper pocket does, and a pocket from above is cut from that top. mountLimits measures it from bossHeight, which can only refuse sooner, and a pocket from above that the cut reaches is - refused at either height. */ + refused at either height. + * + Level here is not rounded to the micron, as mountLimits' is: exactly MOUNT_LEVEL + off, a boss is raised or not as the difference comes out in floating point, a + 2.25 mm one under an H-clip's 2.3 and a 2.45 mm one over a dovetail's 2.4 raised, + a 2.35 mm one under the dovetail's not. Both ways build clean. Rounded, the bosses + raised now at exactly MOUNT_LEVEL would not be, and their bytes would change: 2.25 + mm beside an H-clip, 2.05 beside a key in the walls, 2.45 beside a dovetail. */ const level = ks.filter((k) => Math.abs(cutTops[k] - bossH) < MOUNT_LEVEL); const top = level.length ? Math.max(...level.map((k) => cutTops[k])) + MOUNT_LEVEL : bossH; const fastener = top === bossH ? bossFastener : fastenerCutter(cfg, top - cfg.magnetH, top + 0.5, top + 0.5); @@ -5313,10 +5341,34 @@

Your drawers

movePolys(fastener, bs.ccx + bs.sx*off, bs.ccy + bs.sy*off))); boss = cutAgain(boss, pockets, csgSubtract(boss, pockets)); } - const b = flatBox(boss), cut = []; - for (const k of ks) - if (meets(cutBoxes[k], b)) cut.push(...movePolys(fromBelow[k], -2*sx*NUDGE, -2*sy*NUDGE)); - if (cut.length) boss = cutAgain(boss, cut, csgSubtract(boss, cut)); + /* cutAgain's tries are not always enough here. A wall puzzle key at 36.92 mm with + screws (a 2 mm hole, a 7.1 x 0.8 head), four cells square, kept a cut with a + face turned over in the pair of bosses by the front edge's key, of A2 and of B2, + after every try: three folds on the bed a piece, about one build in 3,600 of + bosses a joint reaches. Moved two NUDGEs the other way along y it came out + clean. So a cut that every try leaves open or turned is taken again moved two + NUDGEs the other way along one axis, then the other, then both, and the first + that comes out closed with nothing turned over is kept; if none does, the first + stands. Two NUDGEs, not more: each stands as far from the cell's walls as the + first, and none nearer the pockets (see mountLimits). A cut that comes out right + is built exactly as before. */ + const b = flatBox(boss); + const cutAt = (a, c) => ks.flatMap((k) => + meets(cutBoxes[k], b) ? movePolys(fromBelow[k], -a*sx*NUDGE, -c*sy*NUDGE) : []); + const cut = cutAt(2, 2); + if (cut.length) { + const solid = boss; + boss = cutAgain(solid, cut, csgSubtract(solid, cut)); + for (const [a, c] of [[2, -2], [-2, 2], [-2, -2]]) { + if (!boss.open && !boss.turned) break; + let again; + try { + const alt = cutAt(a, c); + again = cutAgain(solid, alt, csgSubtract(solid, alt)); + } catch (e) { continue; } // the first cut stands + if (!again.open && !again.turned) boss = again; + } + } shells.push(boss); } } @@ -7792,7 +7844,10 @@

Your drawers

that would reach the tab in one, a pocket any wider coming too near the notch's edge, or any other hole breaking into the cut. 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 - stands into a boss's pocket (#75). */ + stands into 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 + taking the hint would stand them up again, and the cup in their pockets. Only a floor + asked for (bottomPad) keeps them buried whatever the joint. */ const mountWhy = (opens, field) => { const joint = mount().joint[field]; const cuts = cutsNamed(); @@ -7808,7 +7863,8 @@

Your drawers

: 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') + - (joint && KEYED.includes(state.connector) && !keyFromTop() && !cornerBosses(state) + (joint && KEYED.includes(state.connector) && !keyFromTop() && + !(state.baseMode === 'bosses' && !(state.bottomPad > 0)) ? `; keys ${keyInWall() ? '' : 'housed inside the walls and '}put in from above ` + 'keep out of the solid floor under these pockets' : ''); }; diff --git a/sw.js b/sw.js index 05bf191..661b5d4 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 = "2d02b78ce418"; +const VERSION = "a8545a50ba92"; const FILES = [ "./", "bins/",