@floless/app 0.109.4 → 0.111.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +569 -80
- package/dist/skills/floless-app-steel-model/SKILL.md +117 -2
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +54 -8
- package/dist/web/app.css +73 -9
- package/dist/web/aware.js +4 -4
- package/dist/web/index.html +19 -0
- package/dist/web/steel-3d-view.js +19 -6
- package/dist/web/steel-editor.html +59 -31
- package/dist/web/workspaces.js +417 -6
- package/package.json +2 -2
package/dist/floless-server.cjs
CHANGED
|
@@ -53792,7 +53792,7 @@ function appVersion() {
|
|
|
53792
53792
|
return resolveVersion({
|
|
53793
53793
|
isSea: isSea2(),
|
|
53794
53794
|
sqVersionXml: readSqVersionXml(),
|
|
53795
|
-
define: true ? "0.
|
|
53795
|
+
define: true ? "0.111.0" : void 0,
|
|
53796
53796
|
pkgVersion: readPkgVersion()
|
|
53797
53797
|
});
|
|
53798
53798
|
}
|
|
@@ -53808,7 +53808,7 @@ function resolveChannel(s) {
|
|
|
53808
53808
|
function appChannel() {
|
|
53809
53809
|
return resolveChannel({
|
|
53810
53810
|
isSea: isSea2(),
|
|
53811
|
-
define: true ? "0.
|
|
53811
|
+
define: true ? "0.111.0" : void 0,
|
|
53812
53812
|
// argv[1] is the entry the runtime actually loaded (…/dist/floless-server.cjs), which is what
|
|
53813
53813
|
// carries the npx cache prefix. Absent under the SEA exe, which never reaches the npx branch.
|
|
53814
53814
|
modulePath: process.argv[1]
|
|
@@ -55125,6 +55125,43 @@ function xsectionFor(profile, dims) {
|
|
|
55125
55125
|
}
|
|
55126
55126
|
return rect;
|
|
55127
55127
|
}
|
|
55128
|
+
function oneSidedPly(half, t, s) {
|
|
55129
|
+
if (!plyFitsSection(t, half)) return null;
|
|
55130
|
+
const outer = -s * half;
|
|
55131
|
+
const sideDir = outer >= 0 ? 1 : -1;
|
|
55132
|
+
return { lapN: outer, sideDir, plyFarN: outer + sideDir * -t, ply: t, derived: true };
|
|
55133
|
+
}
|
|
55134
|
+
function plyFitsSection(t, half) {
|
|
55135
|
+
return t > 0 && t < 2 * half;
|
|
55136
|
+
}
|
|
55137
|
+
function bearingFaces(x, uOnN, vOnN, requestedSide) {
|
|
55138
|
+
const side = requestedSide >= 0 ? 1 : -1;
|
|
55139
|
+
const onU = Math.abs(Math.abs(uOnN) - 1) < 1e-9;
|
|
55140
|
+
const onV = Math.abs(Math.abs(vOnN) - 1) < 1e-9;
|
|
55141
|
+
if (!onU && !onV) return null;
|
|
55142
|
+
const sU = uOnN >= 0 ? 1 : -1;
|
|
55143
|
+
const sV = vOnN >= 0 ? 1 : -1;
|
|
55144
|
+
switch (x.shape) {
|
|
55145
|
+
case "i": {
|
|
55146
|
+
if (!onU) return null;
|
|
55147
|
+
if (!plyFitsSection(x.tw, x.bf / 2)) return null;
|
|
55148
|
+
return { lapN: side * x.tw / 2, sideDir: side, plyFarN: -side * x.tw / 2, ply: x.tw, derived: false };
|
|
55149
|
+
}
|
|
55150
|
+
case "channel": {
|
|
55151
|
+
if (!onU) return null;
|
|
55152
|
+
return oneSidedPly(x.bf / 2, x.tw, sU);
|
|
55153
|
+
}
|
|
55154
|
+
case "angle": {
|
|
55155
|
+
return onU ? oneSidedPly(x.b / 2, x.t, sU) : oneSidedPly(x.d / 2, x.t, sV);
|
|
55156
|
+
}
|
|
55157
|
+
// A closed section cannot be through-bolted by this detail — refuse rather than bolt into a void.
|
|
55158
|
+
case "rhs":
|
|
55159
|
+
case "chs":
|
|
55160
|
+
return null;
|
|
55161
|
+
case "rect":
|
|
55162
|
+
return null;
|
|
55163
|
+
}
|
|
55164
|
+
}
|
|
55128
55165
|
|
|
55129
55166
|
// index.ts
|
|
55130
55167
|
var import_node_crypto22 = require("node:crypto");
|
|
@@ -60214,6 +60251,13 @@ var GROUPS = {
|
|
|
60214
60251
|
bolt: { key: "bolt", label: "Bolts", color: "#b0c4d8" },
|
|
60215
60252
|
// cool zinc-grey (matches the anchor fasteners)
|
|
60216
60253
|
stiffener: { key: "stiffener", label: "Stiffeners", color: "#9aafc3" },
|
|
60254
|
+
// Brace gusset — the design pass picked this by LUMINANCE, not by eye: the plate band is a pure
|
|
60255
|
+
// lightness ramp (every swatch is the same hue family), so a new row has to land in a real gap. The
|
|
60256
|
+
// first try, #8d9bb0, sat ~4/255 off `custom` (#8a97a8) — indistinguishable at swatch size, so a model
|
|
60257
|
+
// holding an imported connection beside a modelled gusset showed two rows of the same grey. #94a2b7
|
|
60258
|
+
// sits between `custom` (~150) and washer-plate/stiffener (~172), ~11 clear of each. Being a lightness
|
|
60259
|
+
// step rather than a hue shift is also what keeps the band colour-blind-legible.
|
|
60260
|
+
"gusset-plate": { key: "gusset-plate", label: "Gusset plates", color: "#94a2b7" },
|
|
60217
60261
|
cope: { key: "cope", label: "Copes", color: "#c2703a" },
|
|
60218
60262
|
// a muted cut/burn amber — the removed corner (subtractive; rendered as the notch, not a swatch mesh)
|
|
60219
60263
|
// Imported (custom) connection — one neutral steel band for the whole opaque assembly, so it reads
|
|
@@ -60405,6 +60449,37 @@ function expandBasePlate(joint, col) {
|
|
|
60405
60449
|
function webHalfThk(profile, w) {
|
|
60406
60450
|
return profileKind(profile) === "I" ? Math.min(w * 0.5, Math.max(w * 0.1, 5)) / 2 : 0;
|
|
60407
60451
|
}
|
|
60452
|
+
function sectionAxesOnNormal(rot, atEnd1) {
|
|
60453
|
+
const th = (rot ?? 0) * Math.PI / 180;
|
|
60454
|
+
const round = (n) => Math.abs(n) < 1e-9 ? 0 : Math.abs(Math.abs(n) - 1) < 1e-9 ? Math.sign(n) : n;
|
|
60455
|
+
const flip = atEnd1 ? -1 : 1;
|
|
60456
|
+
return { uOnN: round(-flip * Math.cos(th)), vOnN: round(flip * Math.sin(th)) };
|
|
60457
|
+
}
|
|
60458
|
+
function realWebThk(profile, w) {
|
|
60459
|
+
const x = xsectionFor(profile, { w, d: w });
|
|
60460
|
+
switch (x.shape) {
|
|
60461
|
+
case "i":
|
|
60462
|
+
case "channel":
|
|
60463
|
+
return x.tw;
|
|
60464
|
+
case "angle":
|
|
60465
|
+
case "rhs":
|
|
60466
|
+
return x.t;
|
|
60467
|
+
case "chs":
|
|
60468
|
+
return x.t;
|
|
60469
|
+
case "rect":
|
|
60470
|
+
return webHalfThk(profile, w) * 2;
|
|
60471
|
+
}
|
|
60472
|
+
}
|
|
60473
|
+
function lapFaces(member, requestedSide, atEnd1) {
|
|
60474
|
+
const { uOnN, vOnN } = sectionAxesOnNormal(member.rot, atEnd1);
|
|
60475
|
+
const faces = bearingFaces(xsectionFor(member.profile, member.dims), uOnN, vOnN, requestedSide);
|
|
60476
|
+
if (faces) return faces;
|
|
60477
|
+
if (profileKind(member.profile) === "I" && Math.abs(Math.abs(uOnN) - 1) < 1e-9) {
|
|
60478
|
+
const h = webHalfThk(member.profile, member.dims.w);
|
|
60479
|
+
return { lapN: requestedSide * h, sideDir: requestedSide, plyFarN: -requestedSide * h, ply: 2 * h, derived: false };
|
|
60480
|
+
}
|
|
60481
|
+
return null;
|
|
60482
|
+
}
|
|
60408
60483
|
function distPointSeg(p, a, b) {
|
|
60409
60484
|
const abx = b[0] - a[0], aby = b[1] - a[1], abz = b[2] - a[2];
|
|
60410
60485
|
const apx = p[0] - a[0], apy = p[1] - a[1], apz = p[2] - a[2];
|
|
@@ -60430,7 +60505,11 @@ function inferSupport(beam, end, memberGeo) {
|
|
|
60430
60505
|
best = m;
|
|
60431
60506
|
}
|
|
60432
60507
|
}
|
|
60433
|
-
return best &&
|
|
60508
|
+
return best && supportReaches(end, best) ? best : void 0;
|
|
60509
|
+
}
|
|
60510
|
+
function supportReaches(end, support) {
|
|
60511
|
+
if (!finite3(support.from) || !finite3(support.to) || !support.dims) return false;
|
|
60512
|
+
return distPointSeg(end, support.from, support.to) <= Math.max(support.dims.w, support.dims.d);
|
|
60434
60513
|
}
|
|
60435
60514
|
function flangeThk(profile, d) {
|
|
60436
60515
|
return profileKind(profile) === "I" ? Math.min(d * 0.5, Math.max(d * 0.1, 6)) : d / 2;
|
|
@@ -60506,10 +60585,11 @@ function expandShearPlate(joint, beam, support, nativeSupport) {
|
|
|
60506
60585
|
const clearance = Math.max(0, num(p, "clearance", 12.7));
|
|
60507
60586
|
const stiffener = p?.["stiffener"] === true;
|
|
60508
60587
|
const height = pos(p, "plateHeight", (rows2 - 1) * pitch + 2 * edge);
|
|
60509
|
-
const twHalf = webHalfThk(beam.profile, beam.dims.w);
|
|
60510
60588
|
const webSide = num(p, "webSide", 1) >= 0 ? 1 : -1;
|
|
60511
|
-
const
|
|
60512
|
-
|
|
60589
|
+
const lap = lapFaces(beam, webSide, atEnd1);
|
|
60590
|
+
if (!lap) return { parts: [], operations: [], viewOperations: [] };
|
|
60591
|
+
const pOff = lap.lapN + lap.sideDir * (thickness / 2);
|
|
60592
|
+
const u0 = support && profileKind(support.profile) === "I" ? realWebThk(support.profile, support.dims.w) / 2 : 0;
|
|
60513
60593
|
const edgeV = Math.min(edge, height * 0.4);
|
|
60514
60594
|
const pV = rows2 > 1 ? Math.min(pitch, Math.max(0, height - 2 * edgeV) / (rows2 - 1)) : 0;
|
|
60515
60595
|
const vOffs = Array.from({ length: rows2 }, (_, i) => (i - (rows2 - 1) / 2) * pV);
|
|
@@ -60520,16 +60600,16 @@ function expandShearPlate(joint, beam, support, nativeSupport) {
|
|
|
60520
60600
|
const pU = cols > 1 ? Math.min(colPitch, (regHi - regLo) / (cols - 1)) : 0;
|
|
60521
60601
|
const uOffs = Array.from({ length: cols }, (_, j) => cU + (j - (cols - 1) / 2) * pU);
|
|
60522
60602
|
const nutH = 0.8 * boltDia, nutAF = 1.6 * boltDia;
|
|
60523
|
-
const plateOuterN =
|
|
60524
|
-
const webFarN =
|
|
60525
|
-
const headTipN = plateOuterN +
|
|
60526
|
-
const nutTipN = webFarN -
|
|
60603
|
+
const plateOuterN = lap.lapN + lap.sideDir * thickness;
|
|
60604
|
+
const webFarN = lap.plyFarN;
|
|
60605
|
+
const headTipN = plateOuterN + lap.sideDir * nutH;
|
|
60606
|
+
const nutTipN = webFarN - lap.sideDir * nutH;
|
|
60527
60607
|
const grade = p?.["boltGrade"] === "A490" ? "A490" : "A325";
|
|
60528
60608
|
const plateMaterial = authoredText(p, "plateMaterial");
|
|
60529
60609
|
const fastenerMaterial = authoredText(p, "fastenerMaterial");
|
|
60530
60610
|
const standard = text(p, "fastenerStandard", `${grade}N`);
|
|
60531
60611
|
const boltType = p?.["boltType"] === "site" ? "site" : "shop";
|
|
60532
|
-
const grip = thickness +
|
|
60612
|
+
const grip = thickness + lap.ply;
|
|
60533
60613
|
const boltLen = aiscBoltLength(grip, boltDia);
|
|
60534
60614
|
const callout = `\u2300${Math.round(boltDia)} ${grade} \xD7 ${Math.round(boltLen)}`;
|
|
60535
60615
|
const holes = [];
|
|
@@ -60542,7 +60622,10 @@ function expandShearPlate(joint, beam, support, nativeSupport) {
|
|
|
60542
60622
|
holes.push({ id: `${jid}:plate-hole${k}`, u: u - width / 2, v, d: boltDia + holeClr });
|
|
60543
60623
|
bolts.push(
|
|
60544
60624
|
// the shank = the AISC bolt LENGTH, from under the head (plate outer face) into the connection
|
|
60545
|
-
|
|
60625
|
+
// The shank runs from under the head INTO the connection — i.e. AGAINST the side the plate grows
|
|
60626
|
+
// on. It must follow the derived side, not the requested one: on a one-sided section those differ,
|
|
60627
|
+
// and using the request sent the bolt out into open air instead of through the plate and the ply.
|
|
60628
|
+
{ id: `${jid}:bolt${k}`, group: "bolt", kind: "rod", nativeKind: "bolt-shank", from: P(u0 + u, v, plateOuterN), to: P(u0 + u, v, plateOuterN - lap.sideDir * boltLen), d: boltDia, material: fastenerMaterial, fastener: { role: "shear-bolt" }, meta: { label: `Bolt ${callout}` } },
|
|
60546
60629
|
{ id: `${jid}:head${k}`, group: "nut", kind: "nut", nativeKind: "bolt-head", from: P(u0 + u, v, plateOuterN), to: P(u0 + u, v, headTipN), acrossFlats: nutAF, material: fastenerMaterial, fastener: { role: "bolt-head" }, meta: { label: `Bolt head ${callout}` } },
|
|
60547
60630
|
{ id: `${jid}:nut${k}`, group: "nut", kind: "nut", nativeKind: "nut", from: P(u0 + u, v, webFarN), to: P(u0 + u, v, nutTipN), acrossFlats: nutAF, material: fastenerMaterial, fastener: { role: "nut" }, meta: { label: `Bolt nut ${callout}` } }
|
|
60548
60631
|
);
|
|
@@ -60579,8 +60662,8 @@ function expandShearPlate(joint, beam, support, nativeSupport) {
|
|
|
60579
60662
|
meta: { label: `Shear plate ${Math.round(width)}\xD7${Math.round(height)}\xD7${Math.round(thickness)}` }
|
|
60580
60663
|
};
|
|
60581
60664
|
const weldSide = p?.["weldSide"] === "near" || p?.["weldSide"] === "far" ? p["weldSide"] : "both";
|
|
60582
|
-
const nOuter = pOff +
|
|
60583
|
-
const nInner = pOff -
|
|
60665
|
+
const nOuter = pOff + lap.sideDir * thickness / 2;
|
|
60666
|
+
const nInner = pOff - lap.sideDir * thickness / 2;
|
|
60584
60667
|
const faceWeld = (suffix, n) => ({
|
|
60585
60668
|
id: `${joint.id}:${suffix}`,
|
|
60586
60669
|
group: "weld",
|
|
@@ -60598,7 +60681,7 @@ function expandShearPlate(joint, beam, support, nativeSupport) {
|
|
|
60598
60681
|
if (stiffener) {
|
|
60599
60682
|
if (support && support.role === "beam" && !support.isBrace && finite3(support.from) && finite3(support.to) && support.dims && support.dims.d > 0 && support.dims.w > 0) {
|
|
60600
60683
|
const supPosOff = typeof support.posOffset === "number" && isFinite(support.posOffset) ? support.posOffset : 0;
|
|
60601
|
-
const twGirder =
|
|
60684
|
+
const twGirder = realWebThk(support.profile, support.dims.w);
|
|
60602
60685
|
const stiffH = support.dims.d * 0.9;
|
|
60603
60686
|
const stiffW = Math.max(support.dims.w / 2 - twGirder / 2, thickness * 2);
|
|
60604
60687
|
const girderCentZ = endPt[2] + supPosOff;
|
|
@@ -60608,7 +60691,7 @@ function expandShearPlate(joint, beam, support, nativeSupport) {
|
|
|
60608
60691
|
const wfx = endPt[0] - uDir[0] * (twGirder / 2), wfy = endPt[1] - uDir[1] * (twGirder / 2);
|
|
60609
60692
|
parts.push({ id: `${joint.id}:stiffweld`, group: "weld", kind: "weld", closed: false, path: [[wfx, wfy, girderCentZ - stiffH / 2], [wfx, wfy, girderCentZ + stiffH / 2]], leg: weldLeg, meta: { label: `Fillet ${weldLeg}` } });
|
|
60610
60693
|
} else {
|
|
60611
|
-
const oppOff = -
|
|
60694
|
+
const oppOff = lap.plyFarN - lap.sideDir * (thickness / 2);
|
|
60612
60695
|
parts.push({ id: `${joint.id}:stiff`, group: "stiffener", kind: "plate", center: P(u0 + width / 2, 0, oppOff), uDir, vDir, width, depth: height, thickness, holes: [], material: plateMaterial, meta: { label: `Stiffener ${Math.round(width)}\xD7${Math.round(height)}\xD7${Math.round(thickness)}` } });
|
|
60613
60696
|
parts.push({ id: `${joint.id}:stiffweld`, group: "weld", kind: "weld", closed: false, path: [P(u0, -height / 2, oppOff), P(u0, height / 2, oppOff)], leg: weldLeg, meta: { label: `Fillet ${weldLeg}` } });
|
|
60614
60697
|
}
|
|
@@ -60719,6 +60802,194 @@ function expandShearPlate(joint, beam, support, nativeSupport) {
|
|
|
60719
60802
|
}
|
|
60720
60803
|
return { parts, operations, viewOperations };
|
|
60721
60804
|
}
|
|
60805
|
+
function braceSetback(member, support, at) {
|
|
60806
|
+
if (!support || !finite3(support.from) || !finite3(support.to)) return null;
|
|
60807
|
+
if (!finite3(member.from) || !finite3(member.to)) return null;
|
|
60808
|
+
const halfW = (support.dims?.w ?? 0) / 2;
|
|
60809
|
+
if (!(halfW > 0)) return null;
|
|
60810
|
+
const endPt = at === "end1" ? member.to : member.from;
|
|
60811
|
+
const farPt = at === "end1" ? member.from : member.to;
|
|
60812
|
+
let ux = farPt[0] - endPt[0], uy = farPt[1] - endPt[1];
|
|
60813
|
+
const hLen = Math.hypot(ux, uy);
|
|
60814
|
+
if (!(hLen > 1e-6)) return null;
|
|
60815
|
+
ux /= hLen;
|
|
60816
|
+
uy /= hLen;
|
|
60817
|
+
const sx = support.to[0] - support.from[0], sy = support.to[1] - support.from[1];
|
|
60818
|
+
const sLen = Math.hypot(sx, sy);
|
|
60819
|
+
if (!(sLen > 1e-6)) return null;
|
|
60820
|
+
const mx = -sy / sLen, my = sx / sLen;
|
|
60821
|
+
const d0 = (endPt[0] - support.from[0]) * mx + (endPt[1] - support.from[1]) * my;
|
|
60822
|
+
const rate = ux * mx + uy * my;
|
|
60823
|
+
if (Math.abs(rate) < 1e-6) return null;
|
|
60824
|
+
const skew = (uy * mx - ux * my) / rate;
|
|
60825
|
+
if (Math.abs(d0) >= halfW) return { mm: 0, skew };
|
|
60826
|
+
const tA = (halfW - d0) / rate, tB = (-halfW - d0) / rate;
|
|
60827
|
+
const forward = [tA, tB].filter((t2) => Number.isFinite(t2) && t2 > 0);
|
|
60828
|
+
if (!forward.length) return { mm: 0, skew };
|
|
60829
|
+
const t = Math.min(...forward);
|
|
60830
|
+
const own = Math.hypot(farPt[0] - endPt[0], farPt[1] - endPt[1], farPt[2] - endPt[2]);
|
|
60831
|
+
return t < own * 0.5 ? { mm: t, skew } : null;
|
|
60832
|
+
}
|
|
60833
|
+
function expandBraceGusset(joint, brace, support, nativeSupport) {
|
|
60834
|
+
const p = joint.params;
|
|
60835
|
+
const none = { parts: [], operations: [], viewOperations: [] };
|
|
60836
|
+
const at = joint.at === "end1" ? "end1" : "end0";
|
|
60837
|
+
const endPt = at === "end1" ? brace.to : brace.from;
|
|
60838
|
+
const farPt = at === "end1" ? brace.from : brace.to;
|
|
60839
|
+
let ux = farPt[0] - endPt[0], uy = farPt[1] - endPt[1];
|
|
60840
|
+
const hLen = Math.hypot(ux, uy);
|
|
60841
|
+
if (!(hLen > 1e-6)) return none;
|
|
60842
|
+
ux /= hLen;
|
|
60843
|
+
uy /= hLen;
|
|
60844
|
+
const uDir = [ux, uy, 0];
|
|
60845
|
+
const vDir = [0, 0, 1];
|
|
60846
|
+
const nDir = [uy, -ux, 0];
|
|
60847
|
+
const len3d = Math.hypot(farPt[0] - endPt[0], farPt[1] - endPt[1], farPt[2] - endPt[2]);
|
|
60848
|
+
if (!(len3d > 1e-6)) return none;
|
|
60849
|
+
const levelness = hLen / len3d;
|
|
60850
|
+
if (levelness < 0.99875) return none;
|
|
60851
|
+
const setback = braceSetback(brace, support, at);
|
|
60852
|
+
if (setback == null) return none;
|
|
60853
|
+
const faceAt = (n) => setback.mm - n * setback.skew;
|
|
60854
|
+
const halfAcross = Math.max(brace.dims.w, brace.dims.d) / 2;
|
|
60855
|
+
const trimMm = (setback.mm + halfAcross * Math.abs(setback.skew)) / levelness;
|
|
60856
|
+
if (!(trimMm < len3d * 0.5)) return none;
|
|
60857
|
+
const posOff = typeof brace.posOffset === "number" && isFinite(brace.posOffset) ? brace.posOffset : 0;
|
|
60858
|
+
const midZ = endPt[2] + posOff;
|
|
60859
|
+
const P = (u, v, n) => [
|
|
60860
|
+
endPt[0] + uDir[0] * u + nDir[0] * n,
|
|
60861
|
+
endPt[1] + uDir[1] * u + nDir[1] * n,
|
|
60862
|
+
midZ + v
|
|
60863
|
+
];
|
|
60864
|
+
const thickness = pos(p, "plateThickness", 9.525);
|
|
60865
|
+
const width = pos(p, "plateWidth", 177.8);
|
|
60866
|
+
const boltDia = pos(p, "boltDia", 19.05);
|
|
60867
|
+
const cols = intMin1(p, "boltCols", 2);
|
|
60868
|
+
const rows2 = intMin1(p, "boltRows", 1);
|
|
60869
|
+
const pitch = pos(p, "boltPitch", 76.2);
|
|
60870
|
+
const colPitch = pos(p, "boltColPitch", pitch);
|
|
60871
|
+
const holeClr = num(p, "holeClearance", 2);
|
|
60872
|
+
const edge = Math.max(0, num(p, "edgeDist", Math.max(1.5 * boltDia, 30)));
|
|
60873
|
+
const weldLeg = num(p, "weldLeg", 6.35);
|
|
60874
|
+
const plateCount = num(p, "plateCount", 2) >= 2 ? 2 : 1;
|
|
60875
|
+
const height = pos(p, "plateHeight", (rows2 - 1) * pitch + 2 * edge);
|
|
60876
|
+
const webSide = num(p, "webSide", 1) >= 0 ? 1 : -1;
|
|
60877
|
+
const lap = lapFaces(brace, webSide, at === "end1");
|
|
60878
|
+
if (!lap) return none;
|
|
60879
|
+
const aMid = lap.lapN + lap.sideDir * (thickness / 2);
|
|
60880
|
+
const bMid = lap.plyFarN - lap.sideDir * (thickness / 2);
|
|
60881
|
+
const aOuter = lap.lapN + lap.sideDir * thickness;
|
|
60882
|
+
const bOuter = lap.plyFarN - lap.sideDir * thickness;
|
|
60883
|
+
const uA = faceAt(aMid);
|
|
60884
|
+
const uB = faceAt(bMid);
|
|
60885
|
+
const edgeV = Math.min(edge, height * 0.4);
|
|
60886
|
+
const pV = rows2 > 1 ? Math.min(pitch, Math.max(0, height - 2 * edgeV) / (rows2 - 1)) : 0;
|
|
60887
|
+
const vOffs = Array.from({ length: rows2 }, (_, i) => (i - (rows2 - 1) / 2) * pV);
|
|
60888
|
+
const edgeU = Math.min(edge, width * 0.4);
|
|
60889
|
+
const platesLo = plateCount === 2 ? Math.max(uA, uB) : uA;
|
|
60890
|
+
const platesHi = (plateCount === 2 ? Math.min(uA, uB) : uA) + width;
|
|
60891
|
+
const regLo = Math.max(platesLo, trimMm) + edgeU;
|
|
60892
|
+
const regHi = platesHi - edgeU;
|
|
60893
|
+
if (!(regHi > regLo)) return none;
|
|
60894
|
+
const cU = (regLo + regHi) / 2;
|
|
60895
|
+
const pU = cols > 1 ? Math.min(colPitch, (regHi - regLo) / (cols - 1)) : 0;
|
|
60896
|
+
const uAbs = Array.from({ length: cols }, (_, j) => cU + (j - (cols - 1) / 2) * pU);
|
|
60897
|
+
const nutH = 0.8 * boltDia, nutAF = 1.6 * boltDia;
|
|
60898
|
+
const grade = p?.["boltGrade"] === "A490" ? "A490" : "A325";
|
|
60899
|
+
const plateMaterial = authoredText(p, "plateMaterial");
|
|
60900
|
+
const fastenerMaterial = authoredText(p, "fastenerMaterial");
|
|
60901
|
+
const standard = text(p, "fastenerStandard", `${grade}N`);
|
|
60902
|
+
const boltType = p?.["boltType"] === "site" ? "site" : "shop";
|
|
60903
|
+
const grip = thickness * plateCount + lap.ply;
|
|
60904
|
+
const boltLen = aiscBoltLength(grip, boltDia);
|
|
60905
|
+
const callout = `\u2300${Math.round(boltDia)} ${grade} \xD7 ${Math.round(boltLen)}`;
|
|
60906
|
+
const headN = aOuter;
|
|
60907
|
+
const nutFaceN = plateCount === 2 ? bOuter : lap.plyFarN;
|
|
60908
|
+
const headTipN = headN + lap.sideDir * nutH;
|
|
60909
|
+
const nutTipN = nutFaceN - lap.sideDir * nutH;
|
|
60910
|
+
const holesA = [];
|
|
60911
|
+
const holesB = [];
|
|
60912
|
+
const bolts = [];
|
|
60913
|
+
const instances = [];
|
|
60914
|
+
let k = 0;
|
|
60915
|
+
for (const v of vOffs) {
|
|
60916
|
+
for (const u of uAbs) {
|
|
60917
|
+
const jid = joint.id;
|
|
60918
|
+
holesA.push({ id: `${jid}:plateA-hole${k}`, u: u - uA - width / 2, v, d: boltDia + holeClr });
|
|
60919
|
+
if (plateCount === 2) holesB.push({ id: `${jid}:plateB-hole${k}`, u: u - uB - width / 2, v, d: boltDia + holeClr });
|
|
60920
|
+
bolts.push(
|
|
60921
|
+
{ id: `${jid}:bolt${k}`, group: "bolt", kind: "rod", nativeKind: "bolt-shank", from: P(u, v, headN), to: P(u, v, headN - lap.sideDir * boltLen), d: boltDia, material: fastenerMaterial, fastener: { role: "brace-bolt" }, meta: { label: `Bolt ${callout}` } },
|
|
60922
|
+
{ id: `${jid}:head${k}`, group: "nut", kind: "nut", nativeKind: "bolt-head", from: P(u, v, headN), to: P(u, v, headTipN), acrossFlats: nutAF, material: fastenerMaterial, fastener: { role: "bolt-head" }, meta: { label: `Bolt head ${callout}` } },
|
|
60923
|
+
{ id: `${jid}:nut${k}`, group: "nut", kind: "nut", nativeKind: "nut", from: P(u, v, nutFaceN), to: P(u, v, nutTipN), acrossFlats: nutAF, material: fastenerMaterial, fastener: { role: "nut" }, meta: { label: `Bolt nut ${callout}` } }
|
|
60924
|
+
);
|
|
60925
|
+
const point = P(u, v, aMid);
|
|
60926
|
+
const instanceId = `${jid}:bolt-array:instance${k}`;
|
|
60927
|
+
const holeEffects = [
|
|
60928
|
+
{ id: `${instanceId}:hole:plateA`, targetId: `${jid}:plateA`, center: point, axis: nDir, diameterMm: boltDia + holeClr },
|
|
60929
|
+
{ id: `${instanceId}:hole:member`, targetId: brace.id, center: point, axis: nDir, diameterMm: boltDia + holeClr }
|
|
60930
|
+
];
|
|
60931
|
+
if (plateCount === 2) holeEffects.push({ id: `${instanceId}:hole:plateB`, targetId: `${jid}:plateB`, center: point, axis: nDir, diameterMm: boltDia + holeClr });
|
|
60932
|
+
instances.push({ id: instanceId, point, shankId: `${jid}:bolt${k}`, headId: `${jid}:head${k}`, nutIds: [`${jid}:nut${k}`], washerIds: [], holeEffects });
|
|
60933
|
+
k++;
|
|
60934
|
+
}
|
|
60935
|
+
}
|
|
60936
|
+
const mkPlate = (suffix, uStart, mid, holes, side) => ({
|
|
60937
|
+
id: `${joint.id}:${suffix}`,
|
|
60938
|
+
group: "gusset-plate",
|
|
60939
|
+
kind: "plate",
|
|
60940
|
+
center: P(uStart + width / 2, 0, mid),
|
|
60941
|
+
uDir,
|
|
60942
|
+
vDir,
|
|
60943
|
+
width,
|
|
60944
|
+
depth: height,
|
|
60945
|
+
thickness,
|
|
60946
|
+
holes,
|
|
60947
|
+
material: plateMaterial,
|
|
60948
|
+
meta: { label: `Gusset plate ${Math.round(width)}\xD7${Math.round(height)}\xD7${Math.round(thickness)}${side}`, setbackMm: trimMm }
|
|
60949
|
+
});
|
|
60950
|
+
const plateA = mkPlate("plateA", uA, aMid, holesA, plateCount === 2 ? " (near)" : "");
|
|
60951
|
+
const parts = [plateA];
|
|
60952
|
+
if (plateCount === 2) parts.push(mkPlate("plateB", uB, bMid, holesB, " (far)"));
|
|
60953
|
+
const welds = [];
|
|
60954
|
+
const faceWeld = (suffix, uStart, n) => ({
|
|
60955
|
+
id: `${joint.id}:${suffix}`,
|
|
60956
|
+
group: "weld",
|
|
60957
|
+
kind: "weld",
|
|
60958
|
+
closed: false,
|
|
60959
|
+
path: [P(uStart, -height / 2, n), P(uStart, height / 2, n)],
|
|
60960
|
+
leg: weldLeg,
|
|
60961
|
+
meta: { label: `Fillet ${weldLeg}` }
|
|
60962
|
+
});
|
|
60963
|
+
welds.push(faceWeld("weld", uA, aMid));
|
|
60964
|
+
if (plateCount === 2) welds.push(faceWeld("weld2", uB, bMid));
|
|
60965
|
+
parts.push(...bolts, ...welds);
|
|
60966
|
+
const operations = [{
|
|
60967
|
+
id: `${joint.id}:bolt-array`,
|
|
60968
|
+
kind: "bolt-array",
|
|
60969
|
+
partToBoltTo: plateA.id,
|
|
60970
|
+
partToBeBolted: brace.id,
|
|
60971
|
+
frame: { origin: P(cU, 0, aMid), uDir, vDir, normal: nDir },
|
|
60972
|
+
uOffsetsMm: uAbs.map((u) => u - cU),
|
|
60973
|
+
vOffsetsMm: vOffs.slice(),
|
|
60974
|
+
diameterMm: boltDia,
|
|
60975
|
+
toleranceMm: holeClr,
|
|
60976
|
+
standard,
|
|
60977
|
+
grade,
|
|
60978
|
+
boltType,
|
|
60979
|
+
threadInMaterial: false,
|
|
60980
|
+
components: { bolt: true, nut: true, washer: false },
|
|
60981
|
+
instances
|
|
60982
|
+
}];
|
|
60983
|
+
const viewOperations = [];
|
|
60984
|
+
const weldRecords = (into, mainId) => {
|
|
60985
|
+
for (const weld of welds) {
|
|
60986
|
+
into.push({ id: weld.id, kind: "weld", mainId, secondaryId: weld.id === `${joint.id}:weld2` ? `${joint.id}:plateB` : plateA.id, path: weld.path, weldType: "fillet", sizeMm: weld.leg, around: false, shop: true });
|
|
60987
|
+
}
|
|
60988
|
+
};
|
|
60989
|
+
if (nativeSupport) weldRecords(operations, nativeSupport.id);
|
|
60990
|
+
else if (support) weldRecords(viewOperations, support.id);
|
|
60991
|
+
return { parts, operations, viewOperations, trims: [{ id: brace.id, end: at, mm: trimMm }] };
|
|
60992
|
+
}
|
|
60722
60993
|
function expandCustom(joint) {
|
|
60723
60994
|
const place = finite3(joint.place) ? joint.place : [0, 0, 0];
|
|
60724
60995
|
const [dx, dy, dz] = place;
|
|
@@ -60742,6 +61013,7 @@ function expandJoints(joints, memberGeo) {
|
|
|
60742
61013
|
const elements = [];
|
|
60743
61014
|
const operations = [];
|
|
60744
61015
|
const viewOperations = [];
|
|
61016
|
+
const memberTrims = [];
|
|
60745
61017
|
const skipped = [];
|
|
60746
61018
|
const usedGroups = /* @__PURE__ */ new Set();
|
|
60747
61019
|
(joints ?? []).forEach((j, i) => {
|
|
@@ -60806,13 +61078,42 @@ function expandJoints(joints, memberGeo) {
|
|
|
60806
61078
|
elements.push(part);
|
|
60807
61079
|
if (part.kind !== "cut") usedGroups.add(part.group);
|
|
60808
61080
|
}
|
|
61081
|
+
} else if (j.kind === "brace-gusset") {
|
|
61082
|
+
const braceMember = j.main ? memberGeo.get(j.main) : void 0;
|
|
61083
|
+
if (!braceMember || braceMember.role !== "beam" || !braceMember.isBrace) {
|
|
61084
|
+
skipped.push(j.id);
|
|
61085
|
+
return;
|
|
61086
|
+
}
|
|
61087
|
+
if (!finite3(braceMember.from) || !finite3(braceMember.to) || !braceMember.dims || !(braceMember.dims.w > 0) || !(braceMember.dims.d > 0)) {
|
|
61088
|
+
skipped.push(j.id);
|
|
61089
|
+
return;
|
|
61090
|
+
}
|
|
61091
|
+
const braceEnd = j.at === "end1" ? braceMember.to : braceMember.from;
|
|
61092
|
+
let nativeSupport = j.secondaries && j.secondaries[0] ? memberGeo.get(j.secondaries[0]) : void 0;
|
|
61093
|
+
if (nativeSupport && nativeSupport.isBrace) nativeSupport = void 0;
|
|
61094
|
+
if (nativeSupport && !supportReaches(braceEnd, nativeSupport)) nativeSupport = void 0;
|
|
61095
|
+
const support = nativeSupport ?? inferSupport(braceMember, braceEnd, memberGeo);
|
|
61096
|
+
const expansion = expandBraceGusset(j, braceMember, support, nativeSupport);
|
|
61097
|
+
if (!expansion.parts.length) {
|
|
61098
|
+
skipped.push(j.id);
|
|
61099
|
+
return;
|
|
61100
|
+
}
|
|
61101
|
+
operations.push(...expansion.operations);
|
|
61102
|
+
viewOperations.push(...expansion.viewOperations);
|
|
61103
|
+
if (expansion.trims) memberTrims.push(...expansion.trims);
|
|
61104
|
+
for (const part of expansion.parts) {
|
|
61105
|
+
part.conn = j.id;
|
|
61106
|
+
part.connKind = j.kind;
|
|
61107
|
+
elements.push(part);
|
|
61108
|
+
usedGroups.add(part.group);
|
|
61109
|
+
}
|
|
60809
61110
|
} else {
|
|
60810
61111
|
skipped.push(j.id);
|
|
60811
61112
|
}
|
|
60812
61113
|
});
|
|
60813
61114
|
for (const part of elements) if (part.kind === "cut") operations.push(cutToBooleanCut(part));
|
|
60814
61115
|
const groups = [...usedGroups].map((k) => GROUPS[k]);
|
|
60815
|
-
return { elements, operations, viewOperations, groups, skipped };
|
|
61116
|
+
return { elements, operations, viewOperations, memberTrims, groups, skipped };
|
|
60816
61117
|
}
|
|
60817
61118
|
|
|
60818
61119
|
// ../web/steel-3d-core.js
|
|
@@ -62115,6 +62416,30 @@ function teklaClassFor(profile, role) {
|
|
|
62115
62416
|
if (isW || isHSS) return role === "brace" ? "4" : role === "column" ? "2" : "3";
|
|
62116
62417
|
return "1";
|
|
62117
62418
|
}
|
|
62419
|
+
var BOLT_OWNED_HOLE_GROUPS = /* @__PURE__ */ new Set(["shear-plate", "gusset-plate"]);
|
|
62420
|
+
function applyMemberTrims(elements, trims) {
|
|
62421
|
+
const unapplied = [];
|
|
62422
|
+
for (const trim of trims) {
|
|
62423
|
+
if (!(trim.mm > 0)) continue;
|
|
62424
|
+
const box = elements.find((e) => e.kind === "box" && e.id === trim.id);
|
|
62425
|
+
if (!box || !box.from || !box.to) {
|
|
62426
|
+
unapplied.push(trim.id);
|
|
62427
|
+
continue;
|
|
62428
|
+
}
|
|
62429
|
+
const [a, b] = trim.end === "end1" ? [box.to, box.from] : [box.from, box.to];
|
|
62430
|
+
const dx = b[0] - a[0], dy = b[1] - a[1], dz = b[2] - a[2];
|
|
62431
|
+
const L = Math.hypot(dx, dy, dz);
|
|
62432
|
+
if (!(L > trim.mm)) {
|
|
62433
|
+
unapplied.push(trim.id);
|
|
62434
|
+
continue;
|
|
62435
|
+
}
|
|
62436
|
+
const t = trim.mm / L;
|
|
62437
|
+
a[0] += dx * t;
|
|
62438
|
+
a[1] += dy * t;
|
|
62439
|
+
a[2] += dz * t;
|
|
62440
|
+
}
|
|
62441
|
+
return unapplied;
|
|
62442
|
+
}
|
|
62118
62443
|
function contractToScene(contractInput) {
|
|
62119
62444
|
if (isModelV2(contractInput)) {
|
|
62120
62445
|
const { view, issues } = readModelOrIssues(contractInput);
|
|
@@ -62227,6 +62552,7 @@ function contractToScene(contractInput) {
|
|
|
62227
62552
|
color: pickColor(profile, paletteRank.indexOf(profile), contract)
|
|
62228
62553
|
}));
|
|
62229
62554
|
const joints = expandJoints(contract.joints, memberGeo);
|
|
62555
|
+
for (const id of applyMemberTrims(elements, joints.memberTrims)) skipped.push(`trim:${id}`);
|
|
62230
62556
|
for (const part of joints.elements) {
|
|
62231
62557
|
const canonical = canonicalConnectionElement(part);
|
|
62232
62558
|
if (!canonical) {
|
|
@@ -62279,7 +62605,7 @@ function canonicalConnectionElement(part) {
|
|
|
62279
62605
|
if (part.kind === "plate") {
|
|
62280
62606
|
const halfW = part.width / 2;
|
|
62281
62607
|
const halfD = part.depth / 2;
|
|
62282
|
-
const independentHoles = part.group
|
|
62608
|
+
const independentHoles = BOLT_OWNED_HOLE_GROUPS.has(part.group) ? [] : part.holes.map((hole, index) => ({
|
|
62283
62609
|
id: hole.id || `${part.id}:hole${index}`,
|
|
62284
62610
|
center: [hole.u, hole.v],
|
|
62285
62611
|
diameterMm: hole.d
|
|
@@ -62636,6 +62962,7 @@ function sceneFromModel(view) {
|
|
|
62636
62962
|
color: pickColor(profile, paletteRank.indexOf(profile), view.doc)
|
|
62637
62963
|
}));
|
|
62638
62964
|
const joints = expandJoints(view.doc.joints, memberGeo);
|
|
62965
|
+
for (const id of applyMemberTrims(elements, joints.memberTrims)) skipped.push(`trim:${id}`);
|
|
62639
62966
|
for (const part of joints.elements) elements.push(part);
|
|
62640
62967
|
for (const g of joints.groups) groups.push(g);
|
|
62641
62968
|
for (const id of joints.skipped) skipped.push(`joint:${id}`);
|
|
@@ -63423,6 +63750,49 @@ function registerRevisionRoutes(app) {
|
|
|
63423
63750
|
return { ok: true, version };
|
|
63424
63751
|
}
|
|
63425
63752
|
);
|
|
63753
|
+
app.get(
|
|
63754
|
+
"/api/projects/:id/revision-read/staged",
|
|
63755
|
+
async (req, reply) => {
|
|
63756
|
+
const project = getProject(req.params.id);
|
|
63757
|
+
if (!project) return reply.status(404).send({ ok: false, error: `unknown project: ${req.params.id}` });
|
|
63758
|
+
const requestId = typeof req.query?.requestId === "string" ? req.query.requestId : "";
|
|
63759
|
+
if (!requestId) return reply.status(400).send({ ok: false, error: "requestId is required \u2014 a review belongs to the read that staged it" });
|
|
63760
|
+
const request = getRequest(requestId);
|
|
63761
|
+
if (!request || request.type !== "revision-read" || request.project !== project.id) {
|
|
63762
|
+
return reply.status(410).send({ ok: false, error: "that revision request no longer exists \u2014 re-attach the revised set and read it again" });
|
|
63763
|
+
}
|
|
63764
|
+
if (request.status !== "staged") {
|
|
63765
|
+
return reply.status(409).send({ ok: false, error: `that revision request is "${request.status}", not staged for review` });
|
|
63766
|
+
}
|
|
63767
|
+
const stagingKey = getProjectStagingId(project.id);
|
|
63768
|
+
const st = stagingKey ? readStaged(stagingKey) : null;
|
|
63769
|
+
if (!st) {
|
|
63770
|
+
return reply.status(410).send({ ok: false, error: "there is no staged review for this project \u2014 read the revised set again" });
|
|
63771
|
+
}
|
|
63772
|
+
if (st.record.requestId !== requestId) {
|
|
63773
|
+
return reply.status(409).send({
|
|
63774
|
+
ok: false,
|
|
63775
|
+
error: "this review belongs to a different read of this project \u2014 reload and review the current one",
|
|
63776
|
+
code: "stage-superseded"
|
|
63777
|
+
});
|
|
63778
|
+
}
|
|
63779
|
+
const current = readAcceptedForRequest(project.app, project.id, "read");
|
|
63780
|
+
if (current == null || declaredTypeOf(current) !== STEEL_V2) {
|
|
63781
|
+
return reply.status(409).send({ ok: false, error: "this project no longer holds the model this review was staged against" });
|
|
63782
|
+
}
|
|
63783
|
+
let candidate;
|
|
63784
|
+
try {
|
|
63785
|
+
candidate = acceptContract(st.candidate, { appId: project.app, projectId: project.id, operation: "read" });
|
|
63786
|
+
} catch (e) {
|
|
63787
|
+
if (e instanceof ContractPolicyError) {
|
|
63788
|
+
return reply.status(409).send({ ok: false, error: `this staged review can no longer be applied \u2014 ${e.message}`, code: e.code });
|
|
63789
|
+
}
|
|
63790
|
+
throw e;
|
|
63791
|
+
}
|
|
63792
|
+
const fresh = stageRevisionRead(current, candidate);
|
|
63793
|
+
return { ok: true, staged: stagedSummary(fresh, st.record) };
|
|
63794
|
+
}
|
|
63795
|
+
);
|
|
63426
63796
|
app.post(
|
|
63427
63797
|
"/api/projects/:id/revision-read/confirm",
|
|
63428
63798
|
async (req, reply) => {
|
|
@@ -63533,6 +63903,124 @@ function registerRevisionRoutes(app) {
|
|
|
63533
63903
|
);
|
|
63534
63904
|
}
|
|
63535
63905
|
|
|
63906
|
+
// steel-prepass-route.ts
|
|
63907
|
+
var ROOT_KEYS = ["filter", "datum"];
|
|
63908
|
+
var PLAN_KEYS = ["grid", "datum_at", "datum_ref", "control2_at", "control2_ref", "elevation_in"];
|
|
63909
|
+
var isObj3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
63910
|
+
function registerSteelPrepassRoute(app, deps) {
|
|
63911
|
+
app.put(
|
|
63912
|
+
"/api/projects/:id/steel-prepass",
|
|
63913
|
+
{ bodyLimit: 25 * 1024 * 1024 },
|
|
63914
|
+
// the filter block enumerates every drawing element (matches the contract PUT)
|
|
63915
|
+
async (req, reply) => {
|
|
63916
|
+
const project = deps.getProject(req.params.id);
|
|
63917
|
+
if (!project) return reply.status(404).send({ ok: false, error: `unknown project: ${req.params.id}` });
|
|
63918
|
+
const rawIfMatch = typeof req.headers["if-match"] === "string" ? req.headers["if-match"] : void 0;
|
|
63919
|
+
if (rawIfMatch === "*") {
|
|
63920
|
+
return reply.status(428).send({
|
|
63921
|
+
ok: false,
|
|
63922
|
+
code: "precondition-required",
|
|
63923
|
+
error: "this verb patches the document you read, so it needs that document's exact ETag \u2014 `If-Match: *` cannot detect a write that landed since your GET. Re-GET and send `If-Match: <the ETag>`."
|
|
63924
|
+
});
|
|
63925
|
+
}
|
|
63926
|
+
const body = isObj3(req.body) ? req.body : null;
|
|
63927
|
+
if (!body) return reply.status(400).send({ ok: false, error: "body must be an object of the form { filter?, datum?, sheets? }" });
|
|
63928
|
+
const unknownRoot = Object.keys(body).filter((k) => ![...ROOT_KEYS, "sheets"].includes(k));
|
|
63929
|
+
if (unknownRoot.length) {
|
|
63930
|
+
return reply.status(400).send({
|
|
63931
|
+
ok: false,
|
|
63932
|
+
code: "prepass-path-refused",
|
|
63933
|
+
error: `the pre-read pass may write ${ROOT_KEYS.map((k) => `\`${k}\``).join(", ")} and \`sheets\` \u2014 not ${unknownRoot.map((k) => `\`${k}\``).join(", ")}. Members and their observations go through POST /revision-read, which stages them for review.`
|
|
63934
|
+
});
|
|
63935
|
+
}
|
|
63936
|
+
if (body.sheets !== void 0 && !isObj3(body.sheets)) {
|
|
63937
|
+
return reply.status(400).send({ ok: false, error: "`sheets` must be an object keyed by sheet name, never an array \u2014 a positional list writes each sheet's grid onto the other" });
|
|
63938
|
+
}
|
|
63939
|
+
const sheets = isObj3(body.sheets) ? body.sheets : {};
|
|
63940
|
+
for (const [sheet, patch2] of Object.entries(sheets)) {
|
|
63941
|
+
if (!isObj3(patch2)) return reply.status(400).send({ ok: false, error: `\`sheets["${sheet}"]\` must be an object of ${PLAN_KEYS.map((k) => `\`${k}\``).join(", ")}` });
|
|
63942
|
+
const unknown = Object.keys(patch2).filter((k) => !PLAN_KEYS.includes(k));
|
|
63943
|
+
if (unknown.length) {
|
|
63944
|
+
return reply.status(400).send({
|
|
63945
|
+
ok: false,
|
|
63946
|
+
code: "prepass-path-refused",
|
|
63947
|
+
error: `\`sheets["${sheet}"]\` may write ${PLAN_KEYS.map((k) => `\`${k}\``).join(", ")} \u2014 not ${unknown.map((k) => `\`${k}\``).join(", ")}`
|
|
63948
|
+
});
|
|
63949
|
+
}
|
|
63950
|
+
}
|
|
63951
|
+
const current = readAcceptedForRequest(project.app, project.id, "put");
|
|
63952
|
+
if (current == null) {
|
|
63953
|
+
return reply.status(404).send({ ok: false, error: "this project has no contract yet \u2014 the first write of a read creates it through the contract route" });
|
|
63954
|
+
}
|
|
63955
|
+
const declared = declaredTypeOf(current);
|
|
63956
|
+
if (declared !== STEEL_V1 && declared !== STEEL_V2) {
|
|
63957
|
+
return reply.status(400).send({
|
|
63958
|
+
ok: false,
|
|
63959
|
+
code: "prepass-not-steel",
|
|
63960
|
+
error: `this project holds a "${declared}" contract, and the pre-read pass writes ${STEEL_V1} / ${STEEL_V2} \u2014 nothing was written`
|
|
63961
|
+
});
|
|
63962
|
+
}
|
|
63963
|
+
const doc = structuredClone(current);
|
|
63964
|
+
const plans = Array.isArray(doc.plans) ? doc.plans : [];
|
|
63965
|
+
const storedNames = plans.map((p) => isObj3(p) ? String(p.sheet ?? "") : "");
|
|
63966
|
+
const known = new Set(storedNames);
|
|
63967
|
+
const missing = Object.keys(sheets).filter((s) => !known.has(s));
|
|
63968
|
+
if (missing.length) {
|
|
63969
|
+
return reply.status(400).send({
|
|
63970
|
+
ok: false,
|
|
63971
|
+
code: "prepass-unknown-sheet",
|
|
63972
|
+
error: `this project has no plan for ${missing.map((s) => `"${s}"`).join(", ")} \u2014 the pre-read pass writes to sheets a read has already created, it never adds one`
|
|
63973
|
+
});
|
|
63974
|
+
}
|
|
63975
|
+
const dupes = [...new Set(Object.keys(sheets).filter((s) => storedNames.filter((n) => n === s).length > 1))];
|
|
63976
|
+
if (dupes.length) {
|
|
63977
|
+
return reply.status(400).send({
|
|
63978
|
+
ok: false,
|
|
63979
|
+
code: "prepass-duplicate-sheet",
|
|
63980
|
+
error: `this project has more than one plan named ${dupes.map((s) => `"${s}"`).join(", ")}, so there is no single sheet to write to \u2014 give the duplicate plans distinct sheet names before re-reading`
|
|
63981
|
+
});
|
|
63982
|
+
}
|
|
63983
|
+
if (plans.length && isObj3(body.filter)) {
|
|
63984
|
+
const fSheets = Array.isArray(body.filter.sheets) ? body.filter.sheets : [];
|
|
63985
|
+
const strays = fSheets.map((s) => isObj3(s) ? String(s.sheet ?? "") : "").filter((s) => s && !known.has(s));
|
|
63986
|
+
if (strays.length) {
|
|
63987
|
+
return reply.status(400).send({
|
|
63988
|
+
ok: false,
|
|
63989
|
+
code: "prepass-unknown-sheet",
|
|
63990
|
+
error: `\`filter.sheets\` names ${[...new Set(strays)].map((s) => `"${s}"`).join(", ")}, which this project has no plan for`
|
|
63991
|
+
});
|
|
63992
|
+
}
|
|
63993
|
+
}
|
|
63994
|
+
let applied = false;
|
|
63995
|
+
for (const k of ROOT_KEYS) if (body[k] !== void 0) {
|
|
63996
|
+
doc[k] = body[k];
|
|
63997
|
+
applied = true;
|
|
63998
|
+
}
|
|
63999
|
+
for (const p of plans) {
|
|
64000
|
+
const patch2 = isObj3(p) ? sheets[String(p.sheet ?? "")] : void 0;
|
|
64001
|
+
if (!isObj3(patch2)) continue;
|
|
64002
|
+
for (const k of PLAN_KEYS) if (patch2[k] !== void 0) {
|
|
64003
|
+
p[k] = patch2[k];
|
|
64004
|
+
applied = true;
|
|
64005
|
+
}
|
|
64006
|
+
}
|
|
64007
|
+
const ifNoneMatch = typeof req.headers["if-none-match"] === "string" ? req.headers["if-none-match"] : void 0;
|
|
64008
|
+
let written;
|
|
64009
|
+
try {
|
|
64010
|
+
written = await writeContractChecked(project.app, doc, project.id, { origin: "client", ifMatch: rawIfMatch, ifNoneMatch });
|
|
64011
|
+
} catch (e) {
|
|
64012
|
+
if (e instanceof PreconditionRequiredError) return reply.status(428).send({ ok: false, error: e.message, code: e.code });
|
|
64013
|
+
if (e instanceof PreconditionFailedError) return reply.status(412).send({ ok: false, error: e.message, code: e.code });
|
|
64014
|
+
if (e instanceof ContractError) return reply.status(400).send({ ok: false, error: e.message, ...e.code ? { code: e.code } : {} });
|
|
64015
|
+
throw e;
|
|
64016
|
+
}
|
|
64017
|
+
reply.header("ETag", written.etag);
|
|
64018
|
+
if (applied) deps.clearApproval(project.id);
|
|
64019
|
+
return { ok: true, etag: written.etag };
|
|
64020
|
+
}
|
|
64021
|
+
);
|
|
64022
|
+
}
|
|
64023
|
+
|
|
63536
64024
|
// project-export-files.ts
|
|
63537
64025
|
var import_node_fs27 = require("node:fs");
|
|
63538
64026
|
var import_node_path24 = require("node:path");
|
|
@@ -64159,8 +64647,8 @@ function resolveMember(ctx, sheet, v1Id) {
|
|
|
64159
64647
|
function remapJoints(v1, ctx) {
|
|
64160
64648
|
const issues = [];
|
|
64161
64649
|
const joints = [];
|
|
64162
|
-
if (!
|
|
64163
|
-
for (const j of arr3(v1.joints).filter(
|
|
64650
|
+
if (!isObj4(v1)) return { joints, issues };
|
|
64651
|
+
for (const j of arr3(v1.joints).filter(isObj4)) {
|
|
64164
64652
|
const id = str3(j.id) ?? "";
|
|
64165
64653
|
const kind = str3(j.kind) ?? "";
|
|
64166
64654
|
const out = { id, kind };
|
|
@@ -64189,7 +64677,7 @@ function remapJoints(v1, ctx) {
|
|
|
64189
64677
|
if (str3(j.at)) out.at = str3(j.at);
|
|
64190
64678
|
if (str3(j.conn)) out.conn = str3(j.conn);
|
|
64191
64679
|
if (str3(j.name)) out.name = str3(j.name);
|
|
64192
|
-
if (
|
|
64680
|
+
if (isObj4(j.params)) out.params = clone(j.params);
|
|
64193
64681
|
const jSource = enumOr(j.source, ["auto", "user"], `$.joints[id=${id}].source`, issues);
|
|
64194
64682
|
if (jSource) out.source = jSource;
|
|
64195
64683
|
if (typeof j.verified === "boolean") out.verified = j.verified;
|
|
@@ -64206,7 +64694,7 @@ function remapPlanDims(plan, ctx) {
|
|
|
64206
64694
|
const dims = [];
|
|
64207
64695
|
const sheet = str3(plan.sheet) ?? "";
|
|
64208
64696
|
const gridMap = ctx.gridIds[sheet] ?? {};
|
|
64209
|
-
for (const d of arr3(plan.dims).filter(
|
|
64697
|
+
for (const d of arr3(plan.dims).filter(isObj4)) {
|
|
64210
64698
|
const out = {
|
|
64211
64699
|
id: str3(d.id) ?? "",
|
|
64212
64700
|
a: clone(d.a),
|
|
@@ -64217,7 +64705,7 @@ function remapPlanDims(plan, ctx) {
|
|
|
64217
64705
|
if (num3(d.rot) !== null) out.rot = num3(d.rot);
|
|
64218
64706
|
if (typeof d.pin === "boolean") out.pin = d.pin;
|
|
64219
64707
|
for (const side of ["aRef", "bRef"]) {
|
|
64220
|
-
const ref =
|
|
64708
|
+
const ref = isObj4(d[side]) ? d[side] : null;
|
|
64221
64709
|
if (!ref) continue;
|
|
64222
64710
|
const m = str3(ref.m), g = str3(ref.g);
|
|
64223
64711
|
if (m !== null && g !== null) {
|
|
@@ -64256,7 +64744,7 @@ function remapPlanDims(plan, ctx) {
|
|
|
64256
64744
|
}
|
|
64257
64745
|
function remapPropLabels(v1, ctx) {
|
|
64258
64746
|
const issues = [];
|
|
64259
|
-
if (!
|
|
64747
|
+
if (!isObj4(v1) || !isObj4(v1.prop_labels)) return { propLabels: void 0, issues };
|
|
64260
64748
|
const p = v1.prop_labels;
|
|
64261
64749
|
const out = {};
|
|
64262
64750
|
if (Array.isArray(p.props)) out.props = clone(p.props);
|
|
@@ -64293,15 +64781,15 @@ function parseLegacySceneRef(raw, ctx) {
|
|
|
64293
64781
|
function remapViews(v1, ctx, planSheets) {
|
|
64294
64782
|
const issues = [];
|
|
64295
64783
|
const views = [];
|
|
64296
|
-
if (!
|
|
64297
|
-
for (const v of arr3(v1.views).filter(
|
|
64784
|
+
if (!isObj4(v1)) return { views, issues };
|
|
64785
|
+
for (const v of arr3(v1.views).filter(isObj4)) {
|
|
64298
64786
|
const id = str3(v.id) ?? "";
|
|
64299
64787
|
const out = { id, name: str3(v.name) ?? "" };
|
|
64300
64788
|
if (num3(v.v) !== null) out.v = num3(v.v);
|
|
64301
64789
|
if (num3(v.order) !== null) out.order = num3(v.order);
|
|
64302
64790
|
const mode = enumOr(v.mode, ["solid", "wire", "xray"], `$.views[id=${id}].mode`, issues);
|
|
64303
64791
|
if (mode) out.mode = mode;
|
|
64304
|
-
if (
|
|
64792
|
+
if (isObj4(v.camera)) {
|
|
64305
64793
|
const c = v.camera;
|
|
64306
64794
|
const cam = {};
|
|
64307
64795
|
if (num3(c.v) !== null) cam.v = num3(c.v);
|
|
@@ -64313,11 +64801,11 @@ function remapViews(v1, ctx, planSheets) {
|
|
|
64313
64801
|
if (num3(c.zoom) !== null) cam.zoom = num3(c.zoom);
|
|
64314
64802
|
out.camera = cam;
|
|
64315
64803
|
}
|
|
64316
|
-
if (
|
|
64804
|
+
if (isObj4(v.clips)) out.clips = clone(v.clips);
|
|
64317
64805
|
if (out.camera || out.clips) {
|
|
64318
64806
|
issues.push({ code: "view-camera-unframed", severity: "decision", message: `saved view "${id}" carries camera/clip coordinates in the OLD scene frame; assign a frame, confirm keep-as-world, or discard before commit (epic \xA710)` });
|
|
64319
64807
|
}
|
|
64320
|
-
if (
|
|
64808
|
+
if (isObj4(v.objects)) {
|
|
64321
64809
|
const o = v.objects;
|
|
64322
64810
|
const objs = {};
|
|
64323
64811
|
if (num3(o.v) !== null) objs.v = num3(o.v);
|
|
@@ -64350,7 +64838,7 @@ function remapViews(v1, ctx, planSheets) {
|
|
|
64350
64838
|
}
|
|
64351
64839
|
out.objects = objs;
|
|
64352
64840
|
}
|
|
64353
|
-
const gen =
|
|
64841
|
+
const gen = isObj4(v.generated) ? v.generated : null;
|
|
64354
64842
|
if (gen) {
|
|
64355
64843
|
const kind = str3(gen.kind);
|
|
64356
64844
|
const dir = kind === "level" ? "z" : kind === "grid-x" ? "x" : kind === "grid-y" ? "y" : null;
|
|
@@ -64413,8 +64901,8 @@ function axisCoordinate(ctx, id) {
|
|
|
64413
64901
|
}
|
|
64414
64902
|
function remapDetailPlacements(v1) {
|
|
64415
64903
|
const issues = [];
|
|
64416
|
-
if (!
|
|
64417
|
-
for (const d of arr3(v1.detail_placements).filter(
|
|
64904
|
+
if (!isObj4(v1)) return { placements: [], issues };
|
|
64905
|
+
for (const d of arr3(v1.detail_placements).filter(isObj4)) {
|
|
64418
64906
|
const id = str3(d.id) ?? "", sheet = str3(d.sheet) ?? "";
|
|
64419
64907
|
issues.push({
|
|
64420
64908
|
code: str3(d.anchorId) ? "detail-placement-unmigrated" : "detail-unanchored",
|
|
@@ -64427,7 +64915,7 @@ function remapDetailPlacements(v1) {
|
|
|
64427
64915
|
}
|
|
64428
64916
|
function remapDims3d(v1) {
|
|
64429
64917
|
const issues = [];
|
|
64430
|
-
const entries2 =
|
|
64918
|
+
const entries2 = isObj4(v1) ? arr3(v1.dims3d).filter(isObj4) : [];
|
|
64431
64919
|
if (entries2.length) {
|
|
64432
64920
|
issues.push({ code: "dims3d-ownerless", severity: "block", message: `${entries2.length} 3D dimension(s) carry world coordinates in the OLD scene frame and have no owner to recompute from; assign a frame, confirm keep-as-world, or discard them before migrating (epic \xA710)` });
|
|
64433
64921
|
}
|
|
@@ -64435,7 +64923,7 @@ function remapDims3d(v1) {
|
|
|
64435
64923
|
}
|
|
64436
64924
|
|
|
64437
64925
|
// steel-model-migrate.ts
|
|
64438
|
-
var
|
|
64926
|
+
var isObj4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
64439
64927
|
var arr3 = (v) => Array.isArray(v) ? v : [];
|
|
64440
64928
|
var str3 = (v) => typeof v === "string" ? v : null;
|
|
64441
64929
|
var num3 = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
@@ -64462,7 +64950,7 @@ var axisId = (dir, index) => `ax:${dir}:${index}`;
|
|
|
64462
64950
|
var v1GridId = (dir, index) => `${dir === "x" ? "gv" : "gh"}:${index}`;
|
|
64463
64951
|
function sheetAxes(plan, issues) {
|
|
64464
64952
|
const sheet = str3(plan.sheet) ?? "";
|
|
64465
|
-
const g =
|
|
64953
|
+
const g = isObj4(plan.grid) ? plan.grid : null;
|
|
64466
64954
|
if (!g) {
|
|
64467
64955
|
issues.push({ code: "grid-missing", severity: "block", sheet, message: `sheet "${sheet}" has no grid, so it cannot be registered` });
|
|
64468
64956
|
return null;
|
|
@@ -64486,11 +64974,11 @@ function sheetAxes(plan, issues) {
|
|
|
64486
64974
|
function bootstrapGrid(v1) {
|
|
64487
64975
|
const issues = [];
|
|
64488
64976
|
const empty = { grid: null, authority: null, frames: {}, samples: {}, gridIdRemap: {}, issues };
|
|
64489
|
-
if (!
|
|
64977
|
+
if (!isObj4(v1)) {
|
|
64490
64978
|
issues.push({ code: "not-an-object", severity: "block", message: "contract must be an object" });
|
|
64491
64979
|
return empty;
|
|
64492
64980
|
}
|
|
64493
|
-
const plans = arr3(v1.plans).filter(
|
|
64981
|
+
const plans = arr3(v1.plans).filter(isObj4);
|
|
64494
64982
|
if (!plans.length) {
|
|
64495
64983
|
issues.push({ code: "no-plans", severity: "block", message: "contract has no plans" });
|
|
64496
64984
|
return empty;
|
|
@@ -64505,7 +64993,7 @@ function bootstrapGrid(v1) {
|
|
|
64505
64993
|
if (ppf === null || ppf <= 0) issues.push({ code: "sheet-scale-missing", severity: "block", sheet, message: `sheet "${sheet}" has no usable pt_per_ft, so its display geometry cannot be converted to mm` });
|
|
64506
64994
|
else if (a) frames[sheet] = { originPx: a.originPx, k: mmPerPx(ppf) };
|
|
64507
64995
|
}
|
|
64508
|
-
const rootDatum =
|
|
64996
|
+
const rootDatum = isObj4(v1.datum) ? v1.datum : null;
|
|
64509
64997
|
let authority = null;
|
|
64510
64998
|
const datumSheet = rootDatum ? str3(rootDatum.sheet) : null;
|
|
64511
64999
|
if (datumSheet && parsed.get(datumSheet)) {
|
|
@@ -64552,7 +65040,7 @@ function bootstrapGrid(v1) {
|
|
|
64552
65040
|
const zUnion = [];
|
|
64553
65041
|
const zSeen = /* @__PURE__ */ new Map();
|
|
64554
65042
|
for (const p of plans) {
|
|
64555
|
-
const g =
|
|
65043
|
+
const g = isObj4(p.grid) ? p.grid : {};
|
|
64556
65044
|
const zSheet = str3(p.sheet) ?? "";
|
|
64557
65045
|
const authoredLabels = arr3(g.labels_z).map(str3);
|
|
64558
65046
|
for (const l of parsed.get(zSheet)?.z ?? []) {
|
|
@@ -64577,7 +65065,7 @@ function bootstrapGrid(v1) {
|
|
|
64577
65065
|
const canonicalZ = new Map(zUnion.map((l) => [gridLevelKey(l.mm), l.mm]));
|
|
64578
65066
|
const hiddenPerSheet = plans.map((p) => ({
|
|
64579
65067
|
sheet: str3(p.sheet) ?? "",
|
|
64580
|
-
hidden: new Set(arr3((
|
|
65068
|
+
hidden: new Set(arr3((isObj4(p.grid) ? p.grid : {}).hidden_z).map(num3).filter((v) => v !== null).map((mm) => canonicalZ.get(gridLevelKey(mm))).filter((v) => v !== void 0))
|
|
64581
65069
|
}));
|
|
64582
65070
|
const hiddenZ = [...new Set(hiddenPerSheet.flatMap((h) => [...h.hidden]))].sort((a, b) => a - b);
|
|
64583
65071
|
for (const mm of hiddenZ) {
|
|
@@ -64596,7 +65084,7 @@ function bootstrapGrid(v1) {
|
|
|
64596
65084
|
issues.push({ code: "grid-authority-missing", severity: "block", message: `the chosen authority sheet "${authority.sheet}" is not resolvable among the plans` });
|
|
64597
65085
|
return empty;
|
|
64598
65086
|
}
|
|
64599
|
-
const ag =
|
|
65087
|
+
const ag = isObj4(authPlan.grid) ? authPlan.grid : {};
|
|
64600
65088
|
const grid = { origin: [-shift[0], -shift[1]], x: str3(ag.x) ?? "", y: str3(ag.y) ?? "", z: formatLevels(zUnion.map((l) => l.mm)), axes };
|
|
64601
65089
|
if (typeof ag.on === "boolean") grid.on = ag.on;
|
|
64602
65090
|
if (str3(ag.labels_x) !== null) grid.labels_x = str3(ag.labels_x);
|
|
@@ -64607,7 +65095,7 @@ function bootstrapGrid(v1) {
|
|
|
64607
65095
|
for (const p of plans) {
|
|
64608
65096
|
const sheet = str3(p.sheet) ?? "";
|
|
64609
65097
|
if (sheet === authority.sheet) continue;
|
|
64610
|
-
const og =
|
|
65098
|
+
const og = isObj4(p.grid) ? p.grid : {};
|
|
64611
65099
|
for (const key of ["on", "labels_x", "labels_y", "ext"]) {
|
|
64612
65100
|
if (og[key] === void 0) continue;
|
|
64613
65101
|
const emitted = grid[key];
|
|
@@ -64644,7 +65132,7 @@ function bootstrapGrid(v1) {
|
|
|
64644
65132
|
}
|
|
64645
65133
|
function sheetPointsLocalMm(plan, f) {
|
|
64646
65134
|
const pts = [];
|
|
64647
|
-
for (const m of arr3(plan.members).filter(
|
|
65135
|
+
for (const m of arr3(plan.members).filter(isObj4)) {
|
|
64648
65136
|
for (const p of arr3(m.wp)) {
|
|
64649
65137
|
const q = toLocalMm(f, p);
|
|
64650
65138
|
if (q) pts.push(q);
|
|
@@ -64655,8 +65143,8 @@ function sheetPointsLocalMm(plan, f) {
|
|
|
64655
65143
|
function registerSheets(v1, boot) {
|
|
64656
65144
|
const issues = [];
|
|
64657
65145
|
const registrations = [];
|
|
64658
|
-
if (!
|
|
64659
|
-
for (const p of arr3(v1.plans).filter(
|
|
65146
|
+
if (!isObj4(v1)) return { registrations, issues };
|
|
65147
|
+
for (const p of arr3(v1.plans).filter(isObj4)) {
|
|
64660
65148
|
const sheet = str3(p.sheet) ?? "";
|
|
64661
65149
|
const f = boot.frames[sheet];
|
|
64662
65150
|
const samples = boot.samples[sheet] ?? [];
|
|
@@ -64744,12 +65232,12 @@ function materializeMembers(v1, boot, regs) {
|
|
|
64744
65232
|
const members = [];
|
|
64745
65233
|
const pendingColMetadata = [];
|
|
64746
65234
|
let skipped = 0;
|
|
64747
|
-
if (!
|
|
65235
|
+
if (!isObj4(v1)) return { members, pendingColMetadata, skipped, issues };
|
|
64748
65236
|
const bySheet = new Map(regs.map((r) => [r.sheet, r]));
|
|
64749
|
-
arr3(v1.plans).filter(
|
|
65237
|
+
arr3(v1.plans).filter(isObj4).forEach((p, pi) => {
|
|
64750
65238
|
const sheet = str3(p.sheet) ?? "";
|
|
64751
65239
|
const reg2 = bySheet.get(sheet), f = boot.frames[sheet];
|
|
64752
|
-
const planMembers = arr3(p.members).filter(
|
|
65240
|
+
const planMembers = arr3(p.members).filter(isObj4);
|
|
64753
65241
|
if (!reg2?.transform || !f) {
|
|
64754
65242
|
skipped += planMembers.length;
|
|
64755
65243
|
return;
|
|
@@ -64766,7 +65254,7 @@ function materializeMembers(v1, boot, regs) {
|
|
|
64766
65254
|
return;
|
|
64767
65255
|
}
|
|
64768
65256
|
const a = applySimilarity(reg2.transform, la), b = applySimilarity(reg2.transform, lb);
|
|
64769
|
-
const col =
|
|
65257
|
+
const col = isObj4(m.col) ? m.col : null;
|
|
64770
65258
|
const role = str3(m.role);
|
|
64771
65259
|
const srcEnds = arr3(m.ends);
|
|
64772
65260
|
const ends = [clone(srcEnds[0] ?? {}), clone(srcEnds[1] ?? {})];
|
|
@@ -65079,29 +65567,29 @@ function enumerateDispositions(v1) {
|
|
|
65079
65567
|
counts.set(k, e);
|
|
65080
65568
|
};
|
|
65081
65569
|
const walk2 = (obj2, path) => {
|
|
65082
|
-
if (!
|
|
65570
|
+
if (!isObj4(obj2)) return;
|
|
65083
65571
|
const known = DISPOSITIONS[path];
|
|
65084
65572
|
if (!known) return;
|
|
65085
65573
|
for (const key of Object.keys(obj2)) bump(path, key, known[key] ?? "unmapped");
|
|
65086
65574
|
};
|
|
65087
65575
|
walk2(v1, "$");
|
|
65088
|
-
walk2(
|
|
65089
|
-
for (const j of arr3(v1.joints).filter(
|
|
65090
|
-
for (const v of arr3(v1.views).filter(
|
|
65576
|
+
walk2(isObj4(v1.prop_labels) ? v1.prop_labels : {}, "$.prop_labels");
|
|
65577
|
+
for (const j of arr3(v1.joints).filter(isObj4)) walk2(j, "$.joints[]");
|
|
65578
|
+
for (const v of arr3(v1.views).filter(isObj4)) {
|
|
65091
65579
|
walk2(v, "$.views[]");
|
|
65092
65580
|
walk2(v.camera, "$.views[].camera");
|
|
65093
65581
|
walk2(v.objects, "$.views[].objects");
|
|
65094
65582
|
walk2(v.clips, "$.views[].clips");
|
|
65095
65583
|
}
|
|
65096
|
-
for (const d of arr3(v1.detail_placements).filter(
|
|
65097
|
-
for (const p of arr3(v1.plans).filter(
|
|
65584
|
+
for (const d of arr3(v1.detail_placements).filter(isObj4)) walk2(d, "$.detail_placements[]");
|
|
65585
|
+
for (const p of arr3(v1.plans).filter(isObj4)) {
|
|
65098
65586
|
walk2(p, "$.plans[]");
|
|
65099
|
-
if (
|
|
65100
|
-
for (const d of arr3(p.dims).filter(
|
|
65101
|
-
for (const m of arr3(p.members).filter(
|
|
65587
|
+
if (isObj4(p.grid)) walk2(p.grid, "$.plans[].grid");
|
|
65588
|
+
for (const d of arr3(p.dims).filter(isObj4)) walk2(d, "$.plans[].dims[]");
|
|
65589
|
+
for (const m of arr3(p.members).filter(isObj4)) {
|
|
65102
65590
|
walk2(m, "$.plans[].members[]");
|
|
65103
|
-
if (
|
|
65104
|
-
for (const e of arr3(m.ends).filter(
|
|
65591
|
+
if (isObj4(m.col)) walk2(m.col, "$.plans[].members[].col");
|
|
65592
|
+
for (const e of arr3(m.ends).filter(isObj4)) walk2(e, "$.plans[].members[].ends[]");
|
|
65105
65593
|
}
|
|
65106
65594
|
}
|
|
65107
65595
|
return [...counts.values()].sort((a, b) => a.path.localeCompare(b.path) || a.key.localeCompare(b.key));
|
|
@@ -65129,16 +65617,16 @@ function blobDigest(s) {
|
|
|
65129
65617
|
function canonicalHash(doc) {
|
|
65130
65618
|
const norm = (v, key) => {
|
|
65131
65619
|
if (key === "raster_b64" || key === "bg_b64") return typeof v === "string" ? blobDigest(v) : v;
|
|
65132
|
-
if (key === "sheet_previews" &&
|
|
65620
|
+
if (key === "sheet_previews" && isObj4(v)) return Object.fromEntries(Object.keys(v).sort().map((k) => [k, blobDigest(String(v[k]))]));
|
|
65133
65621
|
if (Array.isArray(v)) return v.map((e) => norm(e));
|
|
65134
|
-
if (
|
|
65622
|
+
if (isObj4(v)) return Object.fromEntries(Object.keys(v).sort().map((k) => [k, norm(v[k], k)]));
|
|
65135
65623
|
return v;
|
|
65136
65624
|
};
|
|
65137
65625
|
return (0, import_node_crypto18.createHash)("sha256").update(JSON.stringify(norm(doc))).digest("hex");
|
|
65138
65626
|
}
|
|
65139
65627
|
var KNOWN_READ_KINDS = /* @__PURE__ */ new Set(["steel-filter-segment"]);
|
|
65140
65628
|
function previewMigration(v1, ctx) {
|
|
65141
|
-
const doc =
|
|
65629
|
+
const doc = isObj4(v1) ? v1 : {};
|
|
65142
65630
|
const boot = bootstrapGrid(v1);
|
|
65143
65631
|
const reg2 = registerSheets(v1, boot);
|
|
65144
65632
|
const mat = materializeMembers(v1, boot, reg2.registrations);
|
|
@@ -65159,13 +65647,13 @@ function previewMigration(v1, ctx) {
|
|
|
65159
65647
|
if (role) out.role = role;
|
|
65160
65648
|
if (str3(r.memberType)) out.memberType = str3(r.memberType);
|
|
65161
65649
|
if (num3(r.rot) !== null) out.rot = num3(r.rot);
|
|
65162
|
-
if (
|
|
65650
|
+
if (isObj4(r.section)) out.section = clone(r.section);
|
|
65163
65651
|
if (typeof r.bf === "boolean") out.bf = r.bf;
|
|
65164
65652
|
if (typeof r.rfi === "boolean") out.rfi = r.rfi;
|
|
65165
65653
|
if (typeof r.mf === "boolean") out.mf = r.mf;
|
|
65166
65654
|
if (typeof r.verified === "boolean") out.verified = r.verified;
|
|
65167
|
-
if (
|
|
65168
|
-
if (
|
|
65655
|
+
if (isObj4(r.source)) out.source = clone(r.source);
|
|
65656
|
+
if (isObj4(r.brace)) out.brace = clone(r.brace);
|
|
65169
65657
|
const position = enumOr(r.position, ["top", "middle", "bottom"], `$.members[${m.sheet}/${m.v1Id}].position`, issues, m.sheet);
|
|
65170
65658
|
if (position) out.position = position;
|
|
65171
65659
|
const ends = m.ends.map((e) => {
|
|
@@ -65179,7 +65667,7 @@ function previewMigration(v1, ctx) {
|
|
|
65179
65667
|
return out;
|
|
65180
65668
|
});
|
|
65181
65669
|
const docHash = canonicalHash(doc);
|
|
65182
|
-
const authoredDrawingHash = str3((
|
|
65670
|
+
const authoredDrawingHash = str3((isObj4(doc.source) ? doc.source : {}).sha256);
|
|
65183
65671
|
const drawingHash = authoredDrawingHash ?? docHash;
|
|
65184
65672
|
if (!authoredDrawingHash) {
|
|
65185
65673
|
issues.push({ code: "drawing-hash-substituted", severity: "decision", message: "this contract records no source.sha256, so observations cite the v1 document hash in place of a source drawing hash; confirm the provenance before commit" });
|
|
@@ -65199,9 +65687,9 @@ function previewMigration(v1, ctx) {
|
|
|
65199
65687
|
let provisionalLocators = 0;
|
|
65200
65688
|
const obsBySheet = /* @__PURE__ */ new Map();
|
|
65201
65689
|
const obsIds = /* @__PURE__ */ new Set();
|
|
65202
|
-
const planByS = new Map(arr3(doc.plans).filter(
|
|
65690
|
+
const planByS = new Map(arr3(doc.plans).filter(isObj4).map((p) => [str3(p.sheet) ?? "", p]));
|
|
65203
65691
|
for (const { rec, memberId } of contributions) {
|
|
65204
|
-
const src =
|
|
65692
|
+
const src = isObj4(rec.raw.source) ? rec.raw.source : {};
|
|
65205
65693
|
const kind = str3(src.kind);
|
|
65206
65694
|
if (!kind || !KNOWN_READ_KINDS.has(kind)) legacyProvenance++;
|
|
65207
65695
|
const ppf = num3(planByS.get(rec.sheet)?.pt_per_ft) ?? 0;
|
|
@@ -65218,7 +65706,7 @@ function previewMigration(v1, ctx) {
|
|
|
65218
65706
|
str3(rec.raw.material),
|
|
65219
65707
|
str3(rec.raw.memberType),
|
|
65220
65708
|
num3(rec.raw.rot),
|
|
65221
|
-
|
|
65709
|
+
isObj4(rec.raw.col) ? [rec.raw.col.bos, rec.raw.col.tos, rec.raw.col.tosDef] : null,
|
|
65222
65710
|
// num(), not str(): an end's `tos` is NUMERIC, so str() returned null for every one of them and
|
|
65223
65711
|
// an authored endpoint-elevation change left the observation id untouched.
|
|
65224
65712
|
rec.ends.map((e) => [num3(e.tos), e.tosDef ?? null])
|
|
@@ -65249,7 +65737,7 @@ function previewMigration(v1, ctx) {
|
|
|
65249
65737
|
if (legacyProvenance) {
|
|
65250
65738
|
issues.push({ code: "legacy-provenance-assumed", severity: "decision", message: `${legacyProvenance} record(s) carry no recognised source.kind; their observations are recorded as 'auto-read' because a steel.takeoff/v1 document is by definition reader output, but that assumption must be confirmed before commit` });
|
|
65251
65739
|
}
|
|
65252
|
-
const plans = arr3(doc.plans).filter(
|
|
65740
|
+
const plans = arr3(doc.plans).filter(isObj4).map((p) => {
|
|
65253
65741
|
const sheet = str3(p.sheet) ?? "";
|
|
65254
65742
|
const out = { sheet, memberObservations: obsBySheet.get(sheet) ?? [] };
|
|
65255
65743
|
if (str3(p.title)) out.title = str3(p.title);
|
|
@@ -65264,7 +65752,7 @@ function previewMigration(v1, ctx) {
|
|
|
65264
65752
|
if (Array.isArray(p.read_notes)) out.read_notes = clone(p.read_notes);
|
|
65265
65753
|
if (str3(p.raster_b64)) out.raster_b64 = str3(p.raster_b64);
|
|
65266
65754
|
if (Array.isArray(p.clip)) out.clip = clone(p.clip);
|
|
65267
|
-
if (
|
|
65755
|
+
if (isObj4(p.frame) || p.frame === null) out.frame = clone(p.frame);
|
|
65268
65756
|
for (const k of ["segments", "labels", "details", "callouts", "tos_callouts"]) {
|
|
65269
65757
|
if (Array.isArray(p[k])) out[k] = clone(p[k]);
|
|
65270
65758
|
}
|
|
@@ -65274,15 +65762,15 @@ function previewMigration(v1, ctx) {
|
|
|
65274
65762
|
if (str3(p.control2_ref)) out.control2_ref = str3(p.control2_ref);
|
|
65275
65763
|
return out;
|
|
65276
65764
|
});
|
|
65277
|
-
for (const p of arr3(doc.plans).filter(
|
|
65278
|
-
const g =
|
|
65765
|
+
for (const p of arr3(doc.plans).filter(isObj4)) {
|
|
65766
|
+
const g = isObj4(p.grid) ? p.grid : {};
|
|
65279
65767
|
const sheet = str3(p.sheet) ?? "";
|
|
65280
65768
|
if (arr3(g.lines).length) issues.push({ code: "grid-lines-unmigrated", severity: "block", sheet, message: `sheet "${sheet}" carries ${arr3(g.lines).length} free grid line(s); migrating them onto the model grid is not implemented in this unit, so the contract refuses rather than losing them` });
|
|
65281
65769
|
for (const k of ["ends_x", "ends_y"]) {
|
|
65282
|
-
if (
|
|
65770
|
+
if (isObj4(g[k]) && Object.keys(g[k]).length) issues.push({ code: "grid-ends-unmigrated", severity: "block", sheet, message: `sheet "${sheet}" carries per-axis grid extents (${k}); converting them to v2 world-mm grid.ends is not implemented in this unit` });
|
|
65283
65771
|
}
|
|
65284
65772
|
}
|
|
65285
|
-
const scratch = arr3(doc.plans).filter(
|
|
65773
|
+
const scratch = arr3(doc.plans).filter(isObj4).reduce((n, p) => n + arr3(p.undo).length + arr3(p.redo).length, 0);
|
|
65286
65774
|
if (scratch) issues.push({ code: "scratch-history-discarded", severity: "decision", message: `${scratch} undo/redo entries are discarded: the undo snapshot shape changes with this migration (epic \xA710), so the history cannot carry` });
|
|
65287
65775
|
const remap = {
|
|
65288
65776
|
v: 1,
|
|
@@ -65311,7 +65799,7 @@ function previewMigration(v1, ctx) {
|
|
|
65311
65799
|
const labelsOut = remapPropLabels(doc, refCtx);
|
|
65312
65800
|
const dims3dOut = remapDims3d(doc);
|
|
65313
65801
|
issues.push(...jointsOut.issues, ...placementsOut.issues, ...viewsOut.issues, ...labelsOut.issues, ...dims3dOut.issues);
|
|
65314
|
-
arr3(doc.plans).filter(
|
|
65802
|
+
arr3(doc.plans).filter(isObj4).forEach((p, i) => {
|
|
65315
65803
|
const r = remapPlanDims(p, refCtx);
|
|
65316
65804
|
issues.push(...r.issues);
|
|
65317
65805
|
if (r.dims.length && plans[i]) plans[i].dims = r.dims;
|
|
@@ -65367,7 +65855,7 @@ function previewMigration(v1, ctx) {
|
|
|
65367
65855
|
fields,
|
|
65368
65856
|
unmapped,
|
|
65369
65857
|
counts: {
|
|
65370
|
-
v1Records: arr3(doc.plans).filter(
|
|
65858
|
+
v1Records: arr3(doc.plans).filter(isObj4).reduce((n, p) => n + arr3(p.members).length, 0),
|
|
65371
65859
|
materialized: mat.members.length,
|
|
65372
65860
|
skipped: mat.skipped,
|
|
65373
65861
|
canonicalMembers: members.length,
|
|
@@ -65416,7 +65904,7 @@ function registerMigrationPreviewRoute(app, deps) {
|
|
|
65416
65904
|
const bad = deps.projectAppMismatch(req.params.appId, project);
|
|
65417
65905
|
if (bad) return reply.status(404).send({ ok: false, error: bad });
|
|
65418
65906
|
}
|
|
65419
|
-
const body =
|
|
65907
|
+
const body = isObj4(req.body) ? req.body : null;
|
|
65420
65908
|
const doc = body && "contract" in body ? body.contract : project ? deps.readContract(req.params.appId, project) : deps.readContractForApp(req.params.appId);
|
|
65421
65909
|
if (doc == null) return reply.status(404).send({ ok: false, error: "no contract to migrate" });
|
|
65422
65910
|
const v = validateSteelTakeoff(doc);
|
|
@@ -76037,6 +76525,7 @@ async function startServer() {
|
|
|
76037
76525
|
return { ok: true, version: row };
|
|
76038
76526
|
});
|
|
76039
76527
|
registerRevisionRoutes(app);
|
|
76528
|
+
registerSteelPrepassRoute(app, { getProject, clearApproval });
|
|
76040
76529
|
registerKnowledgeRoutes(app);
|
|
76041
76530
|
function projectAppMismatch(appId, project) {
|
|
76042
76531
|
const p = getProject(project);
|
|
@@ -77438,7 +77927,7 @@ async function startServer() {
|
|
|
77438
77927
|
app.post("/api/steel-favourites", async (req, reply) => {
|
|
77439
77928
|
const { name, category, kind, params, geometry, schemaVersion, emittedBy } = req.body ?? {};
|
|
77440
77929
|
if (!name || !name.trim()) return reply.status(400).send({ ok: false, error: "name required" });
|
|
77441
|
-
if (kind !== "base-plate" && kind !== "shear-plate" && kind !== "custom") {
|
|
77930
|
+
if (kind !== "base-plate" && kind !== "shear-plate" && kind !== "brace-gusset" && kind !== "custom") {
|
|
77442
77931
|
return reply.status(400).send({ ok: false, error: "valid kind required" });
|
|
77443
77932
|
}
|
|
77444
77933
|
if (kind === "custom" ? !Array.isArray(geometry) || geometry.length === 0 : params == null || typeof params !== "object") {
|