@floless/app 0.113.0 → 0.113.2

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.
@@ -401,7 +401,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
401
401
  body.in-workspace #moreMenu #revertB,body.in-workspace #moreMenu #revertSep{display:block}
402
402
  /* Same trap: "Send selection to Tekla" is hidden with an empty selection, and plain [hidden] loses
403
403
  to the #moreMenu rule above — without this it ships as a visible row that only scolds you. */
404
- #moreMenu #sendTeklaB[hidden],#moreMenu #sendRevitB[hidden],#moreMenu #sendSketchupB[hidden]{display:none}
404
+ #moreMenu #sendTeklaB[hidden],#moreMenu #sendRevitB[hidden],#moreMenu #sendSketchupB[hidden],#moreMenu #sendRhinoB[hidden]{display:none}
405
405
  #moreMenu button:disabled{opacity:.4;cursor:default;background:transparent}
406
406
  #moreMenu button.on{color:var(--brand)}
407
407
  button:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
@@ -964,7 +964,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
964
964
  <button id=dimToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide all placed dimensions on the plan"><span class=mck aria-hidden=true></span>Dimensions</button>
965
965
  <button id=calloutToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide the clickable callout bubbles (section / elevation / detail references) on the plan"><span class=mck aria-hidden=true></span>Callouts</button>
966
966
  <button id=gridToggleB class=dtog role=menuitemcheckbox aria-checked=false data-tip="Show or hide the grid lines in 2D and 3D"><span class=mck aria-hidden=true></span>Grid lines</button>
967
- <button id=lenToggleB class=dtog role=menuitemcheckbox aria-checked=false data-tip="Show each selected member's length on the canvas"><span class=mck aria-hidden=true></span>Member length</button>
967
+ <button id=lenToggleB class=dtog role=menuitemcheckbox aria-checked=false data-tip="Show the length of each selected member in 2D and 3D"><span class=mck aria-hidden=true></span>Member length</button>
968
968
  <button id=plToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide property labels in the 2D plan (the property selection is shared with 3D — this hides them here only)"><span class=mck aria-hidden=true></span>Property labels</button>
969
969
  <button id=refToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide the traced reference sheet (the PDF/SVG drawing under the model). Hidden, it also stops contributing snap points."><span class=mck aria-hidden=true></span>Reference sheet</button>
970
970
  <button id=gridEditB data-tip="Grid lines — a plan reference with structural bay spacings (n*d repeats a bay). Shows in 2D and 3D; drawing and drags snap to its lines and intersections.">Grid lines…</button>
@@ -1002,12 +1002,13 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
1002
1002
  </div>
1003
1003
  <button id=csResetB data-tip="Return to the global X/Y axes (default)" disabled>Reset to global axes</button>
1004
1004
  </div>
1005
- <button class=msec-hdr data-sec=session aria-expanded=false data-tip="Reload from the server, or export the data">Session<span class=chev aria-hidden=true>▸</span></button>
1005
+ <button class=msec-hdr data-sec=session aria-expanded=false data-tip="Reload from the server, send selected members to an open CAD app, or export the data.">Session<span class=chev aria-hidden=true>▸</span></button>
1006
1006
  <div class=msec-body>
1007
1007
  <button id=reloadB data-tip="Reloads this page and pulls in any changes your terminal AI made since you last opened it.">↻ Reload from server</button>
1008
1008
  <button id=sendTeklaB data-tip="Creates the selected members as native parts in the open Tekla model, at their real model coordinates. Same as Ctrl+Shift-dragging the selection out of the 3D view onto the Tekla window.">Send selection to Tekla</button>
1009
1009
  <button id=sendRevitB data-tip="Creates the selected members as native Revit framing and columns in the open document, at their real model coordinates. Same as Ctrl+Shift-dragging the selection out of the 3D view onto the Revit window.">Send selection to Revit</button>
1010
1010
  <button id=sendSketchupB data-tip="Creates the selected members as native groups in the open SketchUp model, at their real model coordinates. Same as Ctrl+Shift-dragging the selection out of the 3D view onto the SketchUp window.">Send selection to SketchUp</button>
1011
+ <button id=sendRhinoB data-tip="Creates the selected members as Rhino objects in the open document, at their real model coordinates. Same as Ctrl+Shift-dragging the selection out of the 3D view onto the Rhino window.">Send selection to Rhino</button>
1011
1012
  <button id=exp>Export contract…</button>
1012
1013
  </div>
1013
1014
  <hr id=revertSep>
@@ -1156,6 +1157,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
1156
1157
  <div id=selFly role=menu aria-label="Selectable types"></div>
1157
1158
  </div>
1158
1159
  <div id=panelResizer role=separator aria-orientation=vertical aria-label="Resize properties panel" tabindex=0 data-tip="Drag to resize · double-click to reset"></div>
1160
+ <span id=connectionTruthStatus class=sr-only role=status aria-live=polite aria-atomic=true></span>
1159
1161
  <aside id=panel></aside>
1160
1162
  </main>
1161
1163
  <datalist id=conntypes><option>moment</option><option>drag</option><option>shear</option><option>braced</option><option>pinned</option><option>fixed</option></datalist>
@@ -1489,20 +1491,25 @@ const queueWrite = (fn) => (writeQueue = writeQueue.then(fn, fn));
1489
1491
  */
1490
1492
  function showEmpty(icon, headline, bodyText, appIdText, opts) {
1491
1493
  const wrap = document.createElement('div');
1492
- wrap.style.cssText = 'display:flex;flex-direction:column;align-items:center;justify-content:center;height:100vh;text-align:center;color:#e7ecf3;font:13px system-ui,sans-serif;gap:10px;padding:24px;background:#070a0f';
1493
- const ic = document.createElement('div'); ic.style.cssText = 'font-size:28px;opacity:.5'; ic.textContent = icon;
1494
- const h = document.createElement('div'); h.style.cssText = 'font-size:15px;font-weight:600';
1494
+ wrap.style.cssText = 'display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100vh;box-sizing:border-box;text-align:center;color:#e7ecf3;font:13px system-ui,sans-serif;gap:10px;padding:24px;background:#070a0f';
1495
+ wrap.setAttribute('role', 'alert');
1496
+ wrap.setAttribute('aria-labelledby', 'empty-state-heading');
1497
+ wrap.setAttribute('aria-describedby', 'empty-state-body');
1498
+ const ic = document.createElement('div'); ic.style.cssText = 'font-size:28px;opacity:.5'; ic.textContent = icon; ic.setAttribute('aria-hidden', 'true');
1499
+ const h = document.createElement('h1'); h.id = 'empty-state-heading'; h.style.cssText = 'font-size:15px;font-weight:600;margin:0';
1495
1500
  if (appIdText != null) { h.append(headline + ' '); const b = document.createElement('strong'); b.textContent = appIdText; h.append(b); }
1496
1501
  else { h.textContent = headline; }
1497
- const body = document.createElement('div'); body.style.cssText = 'font-size:12.5px;color:#9aa5b6;max-width:340px;line-height:1.55'; body.textContent = bodyText;
1502
+ const body = document.createElement('div'); body.id = 'empty-state-body'; body.style.cssText = 'font-size:12.5px;color:#9aa5b6;max-width:340px;line-height:1.55'; body.textContent = bodyText;
1503
+ // Insert the live region before populating it so assistive technology reliably announces this async
1504
+ // terminal state. The visual result is unchanged: all children are appended in the same microtask.
1505
+ document.body.replaceChildren(wrap);
1498
1506
  wrap.append(ic, h, body);
1499
1507
  if (opts && opts.detail) {
1500
1508
  const det = document.createElement('div');
1501
1509
  det.style.cssText = 'font-size:10.5px;color:#9aa5b6;opacity:.65;margin-top:-2px';
1502
- det.textContent = opts.detail; // textContent, not innerHTML: this string comes from the stored document
1510
+ det.textContent = opts.detail; // textContent, not innerHTML: detail may include stored/server-authored text
1503
1511
  wrap.append(det);
1504
1512
  }
1505
- document.body.replaceChildren(wrap);
1506
1513
  }
1507
1514
  /*
1508
1515
  * A 2D/3D click that lands while boot() is still loading.
@@ -1557,31 +1564,82 @@ function armEarlyViewToggle() {
1557
1564
  }
1558
1565
 
1559
1566
  /**
1560
- * The `code` on an error response, or null when there isn't one to be had.
1567
+ * The useful fields on an error response, or nulls when there aren't any.
1561
1568
  *
1562
1569
  * GUARDED, because this reads a body that is not guaranteed to be ours. A 404 can come from a proxy,
1563
1570
  * a dev-server error page, or any body-less error response — `res.json()` rejects on every one of
1564
1571
  * those, and an unhandled rejection here would replace a styled empty state with a raw `boot().catch`
1565
- * message. Any failure means "no code", which lands the caller on the generic copy that was correct
1566
- * before this field existed.
1572
+ * message. Any failure means "no details", which lands the caller on a safe generic state.
1567
1573
  *
1568
1574
  * The FALLBACK is silent-by-design; the DIAGNOSIS is not. Returning null for an unparseable body and
1569
1575
  * returning null for our own ordinary "no contract yet" body are the same value and very different
1570
1576
  * events, and without a line here the first leaves no trace anywhere. So the unparseable case warns
1571
1577
  * and the ordinary one does not — `body.code` simply being absent is the normal `none` answer.
1572
1578
  */
1573
- async function errorCodeOf(res) {
1579
+ async function contractErrorOf(res) {
1574
1580
  try {
1575
1581
  const body = await res.json();
1576
- return body && typeof body.code === 'string' ? body.code : null;
1582
+ return {
1583
+ code: body && typeof body.code === 'string' ? body.code : null,
1584
+ error: body && typeof body.error === 'string' && body.error.trim() ? body.error.trim() : null,
1585
+ };
1577
1586
  } catch (_) {
1578
1587
  // Not JSON, empty, or already consumed. The generic state is the safe answer, but this is a
1579
1588
  // response that did not come from us at all — say so rather than letting it look ordinary.
1580
- console.warn('errorCodeOf: ' + res.status + ' body was not readable JSON — falling back to the generic empty state');
1581
- return null;
1589
+ console.warn('contractErrorOf: ' + res.status + ' body was not readable JSON — falling back to the generic empty state');
1590
+ return { code: null, error: null };
1582
1591
  }
1583
1592
  }
1584
1593
 
1594
+ /**
1595
+ * Plain-English recovery for a contract read the server explicitly refused.
1596
+ *
1597
+ * The exact server error remains quiet support detail for policy refusals, while the primary copy stays
1598
+ * in product vocabulary. Unknown failures use the server's own sentence rather than inventing a claim
1599
+ * that the server is offline — receiving an HTTP response proves the opposite.
1600
+ */
1601
+ function contractFailureState(status, code, serverError, projectScoped) {
1602
+ // The subscription middleware answers before the contract route, so 402 is authoritative even if a
1603
+ // proxy or future server happens to attach a contract-shaped code to the body.
1604
+ if (status === 402) {
1605
+ return {
1606
+ headline: 'Check your FloLess account',
1607
+ body: 'Close this editor, follow the sign-in or subscription prompt in FloLess, then reopen the model.',
1608
+ };
1609
+ }
1610
+ if (code === 'contract-not-activated') {
1611
+ return projectScoped
1612
+ ? {
1613
+ headline: 'This model’s conversion isn’t complete',
1614
+ body: 'Open the project in Workspaces and complete its conversion to the 3D model, then try again.',
1615
+ detail: 'Error ' + status + ' · ' + code,
1616
+ }
1617
+ : {
1618
+ headline: 'This model isn’t ready to open',
1619
+ body: 'FloLess blocked this model because its 3D conversion wasn’t completed in a project. Return to FloLess and report the error code below.',
1620
+ detail: 'Error ' + status + ' · ' + code,
1621
+ };
1622
+ }
1623
+ if (code === 'contract-type-wrong-app') {
1624
+ return {
1625
+ headline: 'This workflow can’t open this model',
1626
+ body: 'This workflow isn’t allowed to use the saved model. Open the Steel Model workflow or project the model came from; if that isn’t available, report the error below.',
1627
+ detail: 'Error ' + status + ' · ' + code,
1628
+ };
1629
+ }
1630
+ if (code === 'contract-type-unknown') {
1631
+ return {
1632
+ headline: 'This model format isn’t supported',
1633
+ body: 'A newer FloLess version may be required. Check for updates, then open the model again.',
1634
+ detail: 'Error ' + status + ' · ' + code,
1635
+ };
1636
+ }
1637
+ return {
1638
+ headline: 'Couldn’t load this model',
1639
+ body: serverError || ('The server returned error ' + status + '. Reopen the editor and try again.'),
1640
+ };
1641
+ }
1642
+
1585
1643
  async function boot() {
1586
1644
  if (!APP_ID) { showEmpty('⊞', 'No workflow selected', 'Open a workflow in the FloLess canvas, then open the contract editor from that workflow’s node.'); return; }
1587
1645
  armEarlyViewToggle(); // BEFORE the first await — that is the whole point; see above
@@ -1598,8 +1656,16 @@ async function boot() {
1598
1656
  // exists, and reading another drawing is not what gets the user to it.
1599
1657
  //
1600
1658
  // The CODE, never the sentence — the sentence is copy and copy gets edited.
1601
- const code = await errorCodeOf(res);
1602
- if (code === 'project-publication') {
1659
+ const { code } = await contractErrorOf(res);
1660
+ if (code === 'project-publication-missing-project') {
1661
+ showEmpty('⊞', 'The project for this model isn’t available',
1662
+ 'It may be archived, deleted, or stored on another computer. Check Archived in Workspaces; if you have a project archive, import it.',
1663
+ null);
1664
+ } else if (code === 'project-publication-availability-unknown') {
1665
+ showEmpty('⊞', 'Couldn’t check project availability',
1666
+ 'Open Workspaces to check for a project, then try again.',
1667
+ null);
1668
+ } else if (code === 'project-publication') {
1603
1669
  // NO `appIdText` HERE, and that is the fix for a real defect rather than a style choice.
1604
1670
  //
1605
1671
  // `showEmpty` BOLDS its 4th argument and appends it after the headline, so the sibling states
@@ -1612,8 +1678,8 @@ async function boot() {
1612
1678
  //
1613
1679
  // The workflow id is low-information here anyway: the user opened this editor from that very
1614
1680
  // workflow. The body says what is true about it in prose instead.
1615
- showEmpty('⊞', 'This model belongs to a project',
1616
- 'It was approved inside that project, and this workflow doesn’t hold its own copy of it. Open Workspaces and look for the project it came from to see the model there.',
1681
+ showEmpty('⊞', 'Open a project from Workspaces',
1682
+ 'This model was published from a project, and a project using this workflow is available in Workspaces. Open Workspaces to continue with a project.',
1617
1683
  null);
1618
1684
  } else {
1619
1685
  // A code this build has never heard of falls here on purpose — inventing copy for it would be
@@ -1623,7 +1689,12 @@ async function boot() {
1623
1689
  showEmpty('⊞', 'No model for', 'Read a structural drawing first — ask your terminal AI to run the workflow, then open this editor again.', APP_ID);
1624
1690
  }
1625
1691
  } else {
1626
- showEmpty('⚠', 'Couldn’t load the contract', 'The server returned an error. Check that the FloLess server is running, then reopen the editor.');
1692
+ const failure = await contractErrorOf(res);
1693
+ // This is unconditional for every non-404 refusal: even a known, well-explained state needs one
1694
+ // stable support breadcrumb, and a body parse failure must not erase the HTTP status.
1695
+ console.error('steel-editor: contract read failed (' + res.status + ', ' + (failure.code || 'no code') + ')');
1696
+ const state = contractFailureState(res.status, failure.code, failure.error, !!PROJECT);
1697
+ showEmpty('⚠', state.headline, state.body, null, { detail: state.detail });
1627
1698
  }
1628
1699
  return;
1629
1700
  }
@@ -2333,7 +2404,7 @@ function apply(json){
2333
2404
  if(window.Steel3DView&&window.Steel3DView.setClipState&&'clips' in d)window.Steel3DView.setClipState(d.clips); // restore clips + work area alongside the contract
2334
2405
  if('member_types' in d)C.member_types=sanitizeMemberTypes(d.member_types);
2335
2406
  if('member_styles' in d)C.member_styles=(d.member_styles&&typeof d.member_styles==='object'&&!Array.isArray(d.member_styles))?d.member_styles:{}; // F5: model-global per-type line styles ride the undo stack (like dim_style) so a setMemberLineStyle() edit() is undoable
2336
- scheduleSave();render();sync3D();}
2407
+ scheduleSave();render();sync3D();}
2337
2408
  function doUndo(){if(!undo.length)return;redo.push(snapshotLike());apply(undo.pop());}
2338
2409
  function doRedo(){if(!redo.length)return;undo.push(snapshotLike());apply(redo.pop());}
2339
2410
  /**
@@ -4013,7 +4084,7 @@ function render(){
4013
4084
  // force-closes, so they are unreachable; updConf yields an empty report that leaves #confStat at the
4014
4085
  // display:none its markup already carries; and updCS is already called from every path that can change
4015
4086
  // the axes on a v2 document (csArm3dB, onFrame3dChange, the view switch), so it would add nothing.
4016
- if(MODEL_RO){svg.replaceChildren();stats();panel();updUR();syncDisplayRows();return;} // stats() here only RETIRES the per-sheet readouts — see its v2 branch
4087
+ if(MODEL_RO){svg.replaceChildren();stats();panel();updUR();syncDisplayRows();refreshSelLen3d();return;} // stats() here only RETIRES the per-sheet readouts — see its v2 branch; selected length is a 3D overlay and must follow every v2 selection repaint
4017
4088
  document.body.classList.remove('snapping'); // a wholesale svg rebuild drops any #snapMark → clear the cursor-hide flag too (the next pointermove re-adds it if still snapping)
4018
4089
  buildColorRank(); // refresh the model-global colour rank before any colorFor() call below (B2 — keeps 2D hues stable across plans + matched to 3D)
4019
4090
  reanchorAllPlans(); // F9: glue magnetic dims to their members BEFORE anything reads P.dims — covers every mutation path that ends in a render()
@@ -4620,11 +4691,28 @@ function panel(){
4620
4691
  // about, so an un-annotated end gains no clutter. A refusal is never a dead end: it says what is missing
4621
4692
  // and offers the action that fixes it, because "Apply is greyed out and I don't know why" is the failure
4622
4693
  // this whole surface exists to avoid.
4623
- const dStat=(id,o,which)=>{
4624
- if(!o.detail&&!o.conn)return '';
4625
- const r=resolveDetail(m,which), cap=captureEligible(m,which);
4626
- const capBtn=cap?`<button id=${id}_cap class=ghost data-tip="Remember what this connection means, so every end with the same callout can be built from it">Remember as ${esc(o.detail)}</button>`:'';
4627
- if(r.ok){
4694
+ const dStat=(id,o,which)=>{
4695
+ const r=resolveDetail(m,which), cap=captureEligible(m,which);
4696
+ const capBtn=cap?`<button id=${id}_cap class=ghost data-tip="Remember what this connection means, so every end with the same callout can be built from it">Remember as ${esc(o.detail)}</button>`:'';
4697
+ const joint=jointAtEnd(m.id,which), truthId=(joint&&joint.id)||connectionPreviewJointByEnd.get(o), diag=truthId&&connectionDiagnostics.find(d=>d&&d.jointId===truthId);
4698
+ if(truthId&&connectionDiagnosticsStatus!=='ready'){
4699
+ const unavailable=connectionDiagnosticsStatus==='unavailable';
4700
+ return `<div class=drow aria-busy="${unavailable?'false':'true'}"><div style="flex:1 1 100%;min-width:0"><div class="dmsg warn">${unavailable?'Build status unavailable':'Checking connection build status…'}</div><div class=hint role=note style="margin-top:3px">${unavailable?'The connection engine could not verify this detail. No build action is offered until verification succeeds.':'The connection engine is checking the current model before offering a build action.'}</div></div>${unavailable?`<button id=${id}_retry class=ghostw data-tip="Check this connection against the current model again">Check again</button>`:''}</div>`;
4701
+ }
4702
+ if(diag&&diag.severity==='error'){
4703
+ const truth=connectionRefusalCopy(diag,m);
4704
+ return `<div class=drow><div style="flex:1 1 100%;min-width:0"><div class="dmsg warn">${esc(truth.head)}</div><div class=hint role=note style="margin-top:3px">${esc(truth.detail)}</div></div></div>`;
4705
+ }
4706
+ if(diag&&diag.code==='bolt-gauge-adjusted'){
4707
+ const authored=fmtFtIn(Number(diag.authored)/25.4),built=fmtFtIn(Number(diag.built)/25.4);
4708
+ const preview=!joint;
4709
+ return `<div class=drow><div style="flex:1 1 100%;min-width:0"><div class="dmsg warn">${preview?'Would build':'Built'} with adjusted bolt gauge</div>`
4710
+ +`<div class=hint role=note style="margin-top:3px"><div>Authored bolt gauge <b>${esc(authored)}</b></div><div>Bolt gauge (${preview?'after build / in exports':'built / exported'}) <b>${esc(built)}</b></div>`
4711
+ +`<div style="margin-top:3px">The bolted region cannot fit the authored gauge. ${preview?'Building this detail would make':'The 3D model, IFC, and Tekla export use'} ${esc(built)}${preview?' the gauge used by the 3D model, IFC, and Tekla export.':'.'}</div></div></div>`
4712
+ +(r.ok?`<button id=${id}_ap class=ghostw data-tip="${preview?'Build this connection from the detail':'Build it again from the detail, replacing what is here'}">${preview?'Build it':'Rebuild it'}</button>`:'')+`${capBtn}</div>`;
4713
+ }
4714
+ if(!o.detail&&!o.conn)return '';
4715
+ if(r.ok){
4628
4716
  // `built` also requires the joint to CITE this row: an identical-looking connection that came from a
4629
4717
  // different detail is not this detail's work, and saying "Built" for it would misreport provenance.
4630
4718
  const j=jointAtEnd(m.id,which), built=!!j&&j.kind===r.kind&&j.conn===r.rowId&&!recipeParamsDiffer(j.params,r.params);
@@ -4664,17 +4752,19 @@ function panel(){
4664
4752
  const spAllAuto=spjs.length>0&&spjs.every(x=>x.j.source==='auto');
4665
4753
  // DOM ids key on the END INDEX (0/1), NEVER the joint id (a free-string schema field) — so a crafted
4666
4754
  // joints[].id can't inject into an attribute position; the handlers below close over the real joint.
4667
- const spF=(e,j,key,label,ph,unit)=>{const raw=j&&j.params&&j.params[key]!=null?j.params[key]:null;const val=raw==null?'':(unit==='mm'?esc(fmtFtIn(Number(raw)/25.4)):esc(String(raw)));
4668
- return `<div class=elab>${label}</div><input id="spf_e${e}_${key}" inputmode=decimal placeholder="${esc(ph)}" value="${val}" autocomplete=off>${unit&&unit!=='mm'?`<span class=edec>${unit}</span>`:''}`;}; // mm params shown/entered in ft-in
4669
- const spBlock=({e,j})=>{const dot=e===1?dotE:dotS,lbl=e===1?'End':'Start',st=!!(j.params&&j.params.stiffener);const gus=j.kind==='brace-gusset';
4670
- return `<div class=divrow><hr><span class=sect style="margin:0">${dot}${lbl} · ${gus?'Gusset plate':'Shear plate'}</span><hr></div>
4755
+ const spF=(e,j,key,label,ph,unit)=>{const raw=j&&j.params&&j.params[key]!=null?j.params[key]:null;const val=raw==null?'':(unit==='mm'?esc(fmtFtIn(Number(raw)/25.4)):esc(String(raw)));
4756
+ return `<div class=elab>${label}</div><input id="spf_e${e}_${key}" inputmode=decimal placeholder="${esc(ph)}" value="${val}" autocomplete=off>${unit&&unit!=='mm'?`<span class=edec>${unit}</span>`:''}`;}; // mm params shown/entered in ft-in
4757
+ const spBlock=({e,j})=>{const dot=e===1?dotE:dotS,lbl=e===1?'End':'Start',st=!!(j.params&&j.params.stiffener);const gus=j.kind==='brace-gusset';
4758
+ const gaugeDiag=connectionDiagnostics.find(d=>d&&d.jointId===j.id&&d.code==='bolt-gauge-adjusted');
4759
+ const builtGauge=gaugeDiag?`<div style="display:flex;justify-content:space-between;gap:8px;font-size:12px;margin:3px 0" role=note><span style="color:var(--mut)">Bolt gauge (built / exported)</span><span style="font-variant-numeric:tabular-nums">${esc(fmtFtIn(Number(gaugeDiag.built)/25.4))}</span></div>`:'';
4760
+ return `<div class=divrow><hr><span class=sect style="margin:0">${dot}${lbl} · ${gus?'Gusset plate':'Shear plate'}</span><hr></div>
4671
4761
  ${spF(e,j,'plateWidth','Plate width','auto','mm')}${spF(e,j,'plateHeight','Plate height','auto','mm')}${spF(e,j,'plateThickness','Thickness','3/8"','mm')}${spF(e,j,'weldLeg','Weld leg','1/4"','mm')}${gus?spF(e,j,'plateCount','Plates (1 or 2)','2',''):spF(e,j,'clearance','Clearance (beam gap)','1/2"','mm')}
4672
4762
  <div class=elabrow><span class=elab>${gus?'Lapped side':'Web side'}</span></div>
4673
4763
  <div class=seg2 style="margin-top:0"><button id="spside_e${e}_n" class="${(j.params&&j.params.webSide<0)?'':'on'}">Near</button><button id="spside_e${e}_f" class="${(j.params&&j.params.webSide<0)?'on':''}">Far</button></div>
4674
4764
  ${gus?'':`<div class=elabrow><span class=elab>Weld sides</span></div>
4675
4765
  <div class=seg2 style="margin-top:0"><button id="spw_e${e}_n" class="${(j.params&&j.params.weldSide==='near')?'on':''}">Near</button><button id="spw_e${e}_f" class="${(j.params&&j.params.weldSide==='far')?'on':''}">Far</button><button id="spw_e${e}_b" class="${(!j.params||!j.params.weldSide||j.params.weldSide==='both')?'on':''}">Both</button></div>`}
4676
4766
  <div class=elab style="margin-top:7px;opacity:.7">Bolts</div>
4677
- ${spF(e,j,'boltCols','Bolt columns','1','')}${spF(e,j,'boltRows','Bolt rows','3','')}${spF(e,j,'boltDia','Bolt ⌀','3/4"','mm')}${spF(e,j,'boltPitch','Row spacing','2 3/4"','mm')}${(Number(j.params&&j.params.boltCols)>1)?spF(e,j,'boltColPitch','Column spacing',(j.params&&j.params.boltPitch!=null?fmtFtIn(Number(j.params.boltPitch)/25.4):'2 3/4"'),'mm'):''}
4767
+ ${spF(e,j,'boltCols','Bolt columns','1','')}${spF(e,j,'boltRows','Bolt rows','3','')}${spF(e,j,'boltDia','Bolt ⌀','3/4"','mm')}${spF(e,j,'boltPitch','Row spacing','2 3/4"','mm')}${(Number(j.params&&j.params.boltCols)>1)?spF(e,j,'boltColPitch','Authored bolt gauge',(j.params&&j.params.boltPitch!=null?fmtFtIn(Number(j.params.boltPitch)/25.4):'2 3/4"'),'mm'):''}${builtGauge}
4678
4768
  <div class=elabrow><span class=elab>Bolt grade</span></div>
4679
4769
  <div class=seg2 style="margin-top:0"><button id="spg_e${e}_325" class="${(j.params&&j.params.boltGrade==='A490')?'':'on'}">A325</button><button id="spg_e${e}_490" class="${(j.params&&j.params.boltGrade==='A490')?'on':''}">A490</button></div>
4680
4770
  <div class=hint style="margin:4px 0 0">Bolt length auto-sizes from the grip (AISC) → shown on the bolt callout.</div>
@@ -4841,6 +4931,8 @@ function panel(){
4841
4931
  if(cap)cap.onclick=()=>openCaptureModal(m,which);
4842
4932
  const fx=document.getElementById(id+'_fx');
4843
4933
  if(fx)fx.onclick=()=>openDetailPick(m,which);
4934
+ const retry=document.getElementById(id+'_retry');
4935
+ if(retry)retry.onclick=()=>{invalidateConnectionDiagnostics(true);panel();};
4844
4936
  };
4845
4937
  const wireConn=(id,o)=>{const i=document.getElementById(id);if(!i)return;i.onchange=e=>edit(()=>{const v=(e.target.value||'').trim();o.conn=(!v||v==='— none —')?'':v.split(' · ')[0];});};
4846
4938
  if(col){
@@ -5124,7 +5216,7 @@ function _len3dFt(m,ppf,dTos){
5124
5216
  else{z0=eff(m.ends&&m.ends[0]); z1=eff(m.ends&&m.ends[1]);} // start TOS → end TOS
5125
5217
  const dz=((z1==null?0:z1)-(z0==null?0:z0))/12; // vertical rise, feet
5126
5218
  return Math.hypot(dx,dy,dz);}
5127
- function _lenFt(m){return _len3dFt(m,FT,defaultTOS);}
5219
+ function _lenFt(m){return MODEL_RO?modelReadsV2().lengthFt(m):_len3dFt(m,FT,defaultTOS);}
5128
5220
  const PROP_DEFS=[
5129
5221
  {key:'id', label:'Mark', get:m=>m.id, fmt:v=>v==null?'':String(v)},
5130
5222
  {key:'profile', label:'Profile', get:m=>m.profile, fmt:v=>v==null?'':String(v)},
@@ -5995,6 +6087,7 @@ function updCS(){const s=document.getElementById('csStat');const r=document.getE
5995
6087
  // (the Tekla send takes seconds); the next plain toast() replaces the text and re-arms the timer.
5996
6088
  function toast(msg,sticky){let t=document.getElementById('toast');
5997
6089
  if(!t){t=document.createElement('div');t.id='toast';t.style.cssText='position:fixed;left:50%;bottom:18px;transform:translateX(-50%);background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:8px;padding:8px 14px;box-shadow:0 6px 20px rgba(0,0,0,.5);z-index:60;font:13px system-ui;opacity:0;transition:opacity .2s;pointer-events:none';document.body.appendChild(t);}
6090
+ t.setAttribute('role','status');t.setAttribute('aria-live','polite');t.setAttribute('aria-atomic','true');
5998
6091
  t.textContent=msg;t.style.opacity='1';clearTimeout(t._h);if(!sticky)t._h=setTimeout(()=>{t.style.opacity='0';},2600);}
5999
6092
  // --- pointer: select(+ctrl toggle / box) + group-move + endpoint (Shift = ortho) ---
6000
6093
  svg.addEventListener('pointerdown',e=>{if(e.button!==0)return;const t=e.target;
@@ -6293,13 +6386,11 @@ document.getElementById('csArm3dB').onclick=()=>{const d3=window.Steel3DView;if(
6293
6386
  * markup has no updater in this function, because a hand-maintained second copy is exactly how the v2
6294
6387
  * rows came to be skipped in the first place.
6295
6388
  *
6296
- * WHAT A ROW ON A READ-ONLY DOCUMENT REPORTS. Each of these paints one surface and one only: Dimensions
6297
- * and Callouts draw onto the 2D plan, Reference sheet draws the traced sheet under it, Member length
6298
- * needs a length v2 cannot yet produce (below). A v2 document has no 2D plan — render() returns before
6299
- * drawing one and the 2D tab is permanently the #ro2d empty state — so on v2 all four are OFF, and they
6300
- * say so: `!MODEL_RO && flag` rather than the raw flag. Reporting the raw flag is what the first version
6301
- * of this repair did, and it shipped `aria-checked=true` on a DISABLED row — "on, and you cannot turn it
6302
- * off", which is the very defect this repair exists to remove, just moved to different rows.
6389
+ * WHAT A ROW ON A READ-ONLY DOCUMENT REPORTS. Dimensions and Callouts draw onto the 2D plan, and
6390
+ * Reference sheet draws the traced sheet under it. A v2 document has no 2D plan — render() returns before
6391
+ * drawing one and the 2D tab is permanently the #ro2d empty state — so those three are OFF and disabled.
6392
+ * Member length is deliberately different: it is a model-space read that paints in 3D, the view a v2
6393
+ * document opens in. It therefore reports the shared preference and remains live in read-only mode.
6303
6394
  *
6304
6395
  * (The equivalent v1 case — Reference sheet checked-and-disabled on a plan with no traced sheet — is
6305
6396
  * pre-existing and deliberately untouched here; this change is scoped to the read-only regression.)
@@ -6313,17 +6404,11 @@ document.getElementById('csArm3dB').onclick=()=>{const d3=window.Steel3DView;if(
6313
6404
  function syncDisplayRows(){updGridToggle();updLenToggle();updDimToggle();updCalloutToggle();updPlToggle();updRefToggle();}
6314
6405
  function updDimToggle(){const b=document.getElementById('dimToggleB');if(!b)return;const on=!MODEL_RO&&dimsVisible;b.disabled=MODEL_RO;b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));}
6315
6406
  document.getElementById('dimToggleB').onclick=e=>{e.stopPropagation();if(MODEL_RO)return;dimsVisible=!dimsVisible;updDimToggle();render();}; // the guard is the enforcement, the disable is only the UX — same split canWriteViews makes
6316
- // Member length is OFF on v2 for a DIFFERENT reason than its plan-only neighbours, and the difference
6317
- // matters to whoever re-enables it. This one is not conceptually 2D — it pushes labels to 3D too
6318
- // (refreshSelLen3d), and 3D is the view a v2 document opens in, so it OUGHT to apply here. It cannot
6319
- // produce a label at all today, twice over: refreshSelLen3d is reached only via
6320
- // syncPropLabelsAfterRender(), whose two callers (render()'s trailing sync and reflect2dGridSelection)
6321
- // are both skipped or unreachable on v2; and _len3dFt measures `m.wp`, which a v2 member does not have
6322
- // (it carries from/to), so every length comes back 0 and is dropped as degenerate. Wiring the call alone
6323
- // would therefore NOT fix it. Delete this disable when v2 gets a real length — it describes a gap, it
6324
- // does not declare the row inapplicable.
6325
- function updLenToggle(){const b=document.getElementById('lenToggleB');if(!b)return;const on=!MODEL_RO&&showSelLen;b.disabled=MODEL_RO;b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));}
6326
- document.getElementById('lenToggleB').onclick=e=>{e.stopPropagation();if(MODEL_RO)return;showSelLen=!showSelLen;try{localStorage.setItem('steel:selLen:v1',showSelLen?'1':'0');}catch(_){}updLenToggle();render();}; // render() repaints the 2D chips + pushes labels to 3D
6407
+ // Member length is a READ, not an edit: it remains live for a read-only v2 model and resolves its text
6408
+ // behind modelReadsV2's world-mm geometry boundary. render() repaints 2D chips on v1 and pushes the same
6409
+ // selected-member payload to 3D on both formats.
6410
+ function updLenToggle(){const b=document.getElementById('lenToggleB');if(!b)return;const on=showSelLen;b.disabled=false;b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));}
6411
+ document.getElementById('lenToggleB').onclick=e=>{e.stopPropagation();showSelLen=!showSelLen;try{localStorage.setItem('steel:selLen:v1',showSelLen?'1':'0');}catch(_){}updLenToggle();render();}; // render() repaints the 2D chips + pushes/clears labels in 3D
6327
6412
  function updCalloutToggle(){const b=document.getElementById('calloutToggleB');if(!b)return;const on=!MODEL_RO&&calloutsVisible;b.disabled=MODEL_RO;b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));} // plan-only, like Dimensions
6328
6413
  document.getElementById('calloutToggleB').onclick=e=>{e.stopPropagation();if(MODEL_RO)return;calloutsVisible=!calloutsVisible;updCalloutToggle();render();};
6329
6414
  // NOTE FOR THE NEXT EDITOR: do NOT add `b.disabled=MODEL_RO` here to match the five rows around it.
@@ -6587,9 +6672,9 @@ function closeMore(){moreMenu.classList.remove('open');moreBtn.setAttribute('ari
6587
6672
  moreBtn.onclick=e=>{e.stopPropagation();if(moreOpen())closeMore();else{
6588
6673
  // "Send selection to Tekla" is hidden, not disabled, with nothing selected — there is no action to
6589
6674
  // offer yet, and a greyed row would read as a broken feature rather than an empty state.
6590
- {const anySel=!selArr().length;for(const bid of ['sendTeklaB','sendRevitB','sendSketchupB']){const b=document.getElementById(bid);if(b)b.hidden=anySel;}}
6675
+ {const anySel=!selArr().length;for(const bid of ['sendTeklaB','sendRevitB','sendSketchupB','sendRhinoB']){const b=document.getElementById(bid);if(b)b.hidden=anySel;}}
6591
6676
  moreMenu.classList.add('open');moreBtn.setAttribute('aria-expanded','true');document.addEventListener('mousedown',moreOutside,true);}};
6592
- for(const [bid,host] of [['sendTeklaB','tekla'],['sendRevitB','revit'],['sendSketchupB','sketchup']]){
6677
+ for(const [bid,host] of [['sendTeklaB','tekla'],['sendRevitB','revit'],['sendSketchupB','sketchup'],['sendRhinoB','rhino']]){
6593
6678
  const b=document.getElementById(bid);if(b)b.onclick=()=>{closeMore();sendSelectionToHost(host,teklaSelectionIds());};}
6594
6679
  moreMenu.addEventListener('click',e=>{if(e.target.closest('button')&&!e.target.closest('.msnap')&&!e.target.closest('.dtog')&&!e.target.closest('.msec-hdr')&&!e.target.closest('.ins-in-menu'))closeMore();}); // an item's own handler runs (bubble) before this closes the menu; the snap toggles, section headers, and the Insert picker keep the menu open (settings, not one-shot actions)
6595
6680
  // "Snapping" is collapsible to save menu space — the header expands the running-snap switches below it
@@ -6718,7 +6803,100 @@ document.getElementById('cpLevelB').onclick=()=>openLevelModal('copy');
6718
6803
  // fetches the SAME scene the bake uses (/api/contract/:id/scene) so 2D and 3D show one contract. ---
6719
6804
  // Coped beams (auto, clash-driven) — cache the cut labels per member as the scene is fetched so the
6720
6805
  // member Inspector can show a read-only "Cope (auto)" note (a coped beam otherwise looks like an error).
6721
- let copesByMember={}, partsById={};
6806
+ let copesByMember={}, partsById={}, connectionDiagnostics=[], connectionDiagnosticsStatus='pending', connectionDiagnosticsSeq=0, connectionDiagnosticsTimer=null, connectionPreviewJointByEnd=new WeakMap(), shownConnectionDiagnosticSignatures=new Set();
6807
+ const connectionDiagnosticSignature=d=>[d.jointId,d.code,d.severity,d.field||'',d.authored==null?'':d.authored,d.built==null?'':d.built,d.supportId||''].join('|');
6808
+ function announceConnectionTruth(message,busy){
6809
+ const p=document.getElementById('panel'),s=document.getElementById('connectionTruthStatus');
6810
+ if(p){if(busy)p.setAttribute('aria-busy','true');else p.removeAttribute('aria-busy');}
6811
+ if(s){s.setAttribute('role','status');s.setAttribute('aria-live','polite');s.setAttribute('aria-atomic','true');s.textContent=message||'';}
6812
+ }
6813
+ function connectionRefusalCopy(d,m){
6814
+ const support=d.supportId||'the named support',main=d.mainId||m.id,profile=d.profile||m.profile||'This profile';
6815
+ if(d.code==='closed-section-unsupported'){
6816
+ return d.kind==='brace-gusset'
6817
+ ? {head:'Not built · This gusset does not support closed sections',detail:profile+' needs a slotted-tube or other welded detail; this through-bolted detail created no geometry.'}
6818
+ : {head:'Not built · This shear plate does not support closed sections',detail:profile+' needs a compatible welded detail; this through-bolted detail created no geometry.'};
6819
+ }
6820
+ const byCode={
6821
+ 'named-support-out-of-reach':{head:'Not built · Named support is out of reach',detail:main+' does not meet '+support+'. No gusset or brace trim was created.'},
6822
+ 'main-axis-unusable':{head:'Not built · Member direction cannot be resolved',detail:main+' has no usable plan run for this connection. No geometry was created.'},
6823
+ 'main-not-brace':{head:'Not built · This detail requires a brace',detail:main+' is not classified as a brace. No gusset or member trim was created.'},
6824
+ 'main-geometry-unusable':{head:'Not built · Brace geometry is incomplete',detail:main+' has no usable body for this connection. No gusset or member trim was created.'},
6825
+ 'named-support-missing':{head:'Not built · Named support is missing',detail:main+' names '+support+', but that member is not in the model. No gusset or brace trim was created.'},
6826
+ 'named-support-is-brace':{head:'Not built · Named support is another brace',detail:support+' cannot support this gusset. No gusset or brace trim was created.'},
6827
+ 'named-support-unusable':{head:'Not built · Named support has no usable body',detail:support+' cannot support this gusset. No gusset or brace trim was created.'},
6828
+ 'brace-axis-unusable':{head:'Not built · Brace direction cannot be resolved',detail:main+' has no usable plan run for a vertical gusset. No geometry or trim was created.'},
6829
+ 'brace-slope-unsupported':{head:'Not built · This gusset requires a level brace',detail:main+' needs a connection aligned to its slope; this vertical detail created no geometry or trim.'},
6830
+ 'support-not-found':{head:'Not built · No support meets this brace end',detail:'No support face could be proved for '+main+'. No gusset or brace trim was created.'},
6831
+ 'setback-unprovable':{head:'Not built · Brace setback cannot be proved',detail:'The support face and '+main+' do not define a safe setback. No gusset or brace trim was created.'},
6832
+ 'trim-exceeds-member':{head:'Not built · The required trim is too long',detail:main+' cannot safely give up enough length for this gusset. No geometry or trim was created.'},
6833
+ 'bearing-face-unresolved':{head:'Not built · Bearing face cannot be resolved',detail:profile+' has no provable face for this through-bolted detail. No geometry or trim was created.'},
6834
+ 'bolt-region-too-small':{head:'Not built · The bolt group does not fit',detail:'The authored plate cannot hold the required bolt group and edge distances. No geometry or trim was created.'}
6835
+ };
6836
+ return byCode[d.code]||{head:'Not built · Connection was refused',detail:'The connection engine refused '+(d.jointId||'this joint')+' ('+(d.code||'unknown reason')+'). No geometry or member trim was created.'};
6837
+ }
6838
+ function updateConnectionDiagnostics(raw,announce=true){
6839
+ const unique=[],seen=new Set();
6840
+ for(const d of (Array.isArray(raw)?raw:[])){if(!d||typeof d!=='object'||!d.jointId||!d.code)continue;const sig=connectionDiagnosticSignature(d);if(seen.has(sig))continue;seen.add(sig);unique.push(d);}
6841
+ for(const sig of [...shownConnectionDiagnosticSignatures])if(!seen.has(sig))shownConnectionDiagnosticSignatures.delete(sig);
6842
+ const fresh=unique.filter(d=>!shownConnectionDiagnosticSignatures.has(connectionDiagnosticSignature(d)));
6843
+ connectionDiagnostics=unique;connectionDiagnosticsStatus='ready';announceConnectionTruth('Connection build status checked.',false);
6844
+ for(const d of fresh)shownConnectionDiagnosticSignatures.add(connectionDiagnosticSignature(d));
6845
+ if(announce&&fresh.length){
6846
+ const refused=fresh.filter(d=>d.severity==='error').length,adjusted=fresh.filter(d=>d.code==='bolt-gauge-adjusted').length;
6847
+ const bits=[];if(refused)bits.push(refused+' connection'+(refused>1?'s':'')+' not built');if(adjusted)bits.push(adjusted+' built with an adjusted bolt gauge');
6848
+ toast(bits.join(' · ')+' — see the member inspector.');
6849
+ }
6850
+ return {count:fresh.length,refused:fresh.filter(d=>d.severity==='error').length,adjusted:fresh.filter(d=>d.code==='bolt-gauge-adjusted').length};
6851
+ }
6852
+ function applyConnectionBakeTruth(j,announce=true){
6853
+ const fresh=updateConnectionDiagnostics(j&&j.diagnostics,false),sk=Array.isArray(j&&j.skipped)?j.skipped:[];
6854
+ const diagnosed=new Set(connectionDiagnostics.map(d=>d.jointId));
6855
+ const legacy=sk.filter(s=>String(s).startsWith('joint:')&&!diagnosed.has(String(s).slice(6))).length;
6856
+ if(sk.length)console.warn('3D bake skipped '+sk.length+' item(s):',sk);
6857
+ if(announce&&(fresh.count||legacy)){
6858
+ const bits=[];
6859
+ if(fresh.refused)bits.push(fresh.refused+' connection'+(fresh.refused>1?'s':'')+' not built');
6860
+ if(fresh.adjusted)bits.push(fresh.adjusted+' built with an adjusted bolt gauge');
6861
+ if(legacy)bits.push(legacy+' connection'+(legacy>1?'s':'')+' not shown in 3D');
6862
+ toast(bits.join(' · ')+' — '+(legacy?'see the member inspector and console.':'see the member inspector.'));
6863
+ }
6864
+ }
6865
+ async function fetchScenePayload(contract=C){
6866
+ const r=await fetch('/api/contract/'+encodeURIComponent(APP_ID)+'/scene'+PROJECT_QS,{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({contract})});
6867
+ const j=await r.json();if(!j.ok)throw new Error(j.error||'scene render failed');return j;
6868
+ }
6869
+ function connectionTruthRequest(){
6870
+ const contract=JSON.parse(JSON.stringify(C)),previewByEnd=new WeakMap();
6871
+ if(!Array.isArray(contract.joints))contract.joints=[];
6872
+ const ids=new Set(contract.joints.map(j=>j&&j.id).filter(Boolean));let n=0;
6873
+ for(const m of allMembers()){
6874
+ if(!m)continue;
6875
+ const ends=m&&m.role==='column'?[{o:m.col,which:'col'}]:[{o:m&&m.ends&&m.ends[0],which:0},{o:m&&m.ends&&m.ends[1],which:1}];
6876
+ for(const t of ends){
6877
+ if(!t.o||(!t.o.detail&&!t.o.conn)||jointAtEnd(m.id,t.which))continue;
6878
+ const r=resolveDetail(m,t.which);if(!r.ok)continue;
6879
+ let id;do{id='preview-connection-'+(++n);}while(ids.has(id));ids.add(id);
6880
+ const joint={id,kind:r.kind,main:m.id,at:jointAtFor(t.which),params:Object.assign({},r.params),source:'preview',conn:r.rowId};
6881
+ if(r.kind==='shear-plate'&&t.which!=='col'){const sup=spInferSupport(m,t.which);joint.secondaries=sup?[sup.id]:[];}
6882
+ contract.joints.push(joint);previewByEnd.set(t.o,id);
6883
+ }
6884
+ }
6885
+ return {contract,previewByEnd,count:n};
6886
+ }
6887
+ function invalidateConnectionDiagnostics(immediate=false){
6888
+ const seq=++connectionDiagnosticsSeq,truth=connectionTruthRequest();
6889
+ if(connectionDiagnosticsTimer){clearTimeout(connectionDiagnosticsTimer);connectionDiagnosticsTimer=null;}
6890
+ connectionPreviewJointByEnd=truth.previewByEnd;
6891
+ if((!Array.isArray(C&&C.joints)||!C.joints.length)&&!truth.count){connectionDiagnostics=[];connectionDiagnosticsStatus='ready';announceConnectionTruth('',false);return;}
6892
+ connectionDiagnostics=[];connectionDiagnosticsStatus='pending';
6893
+ announceConnectionTruth('Checking connection build status.',true);
6894
+ connectionDiagnosticsTimer=setTimeout(async()=>{
6895
+ connectionDiagnosticsTimer=null;
6896
+ try{const j=await fetchScenePayload(truth.contract);if(seq!==connectionDiagnosticsSeq)return;applyConnectionBakeTruth(j,true);panel();}
6897
+ catch(e){if(seq!==connectionDiagnosticsSeq)return;connectionDiagnostics=[];connectionDiagnosticsStatus='unavailable';announceConnectionTruth('Connection build status unavailable. Use Check again to retry.',false);panel();console.warn('Connection build status unavailable:',(e&&e.message)||e);}
6898
+ },immediate?0:150);
6899
+ }
6722
6900
 
6723
6901
  // --- Send the selection to Tekla (Ctrl+Shift-drag it out of the 3D view, or ⋯ → Session). The
6724
6902
  // server bakes just these members as native parts in the OPEN model, at their real model
@@ -6727,9 +6905,9 @@ let copesByMember={}, partsById={};
6727
6905
  let teklaSendBusy=false;
6728
6906
  const teklaSelectionIds=()=>selArr().map(m=>m.id); // members only: grid lines, dimensions and connection parts are never sent (selArr matches against real members)
6729
6907
  // What the user calls each application. Copy NEVER says "sketchup-2026" or an agent id.
6730
- const HOST_NAME={tekla:'Tekla',revit:'Revit',sketchup:'SketchUp'};
6908
+ const HOST_NAME={tekla:'Tekla',revit:'Revit',sketchup:'SketchUp',rhino:'Rhino'};
6731
6909
  // Tekla keeps its original route (its readiness probe can tell "open but no model loaded", which the
6732
- // generic one cannot); Revit and SketchUp share the newer one. Same request body either way.
6910
+ // generic one cannot); Revit, SketchUp, and Rhino share the newer one. Same request body either way.
6733
6911
  const hostSendUrl=(host)=>'/api/contract/'+encodeURIComponent(APP_ID)+(host==='tekla'?'/export-tekla':'/export-host/'+encodeURIComponent(host))+PROJECT_QS;
6734
6912
 
6735
6913
  /* Resolve where a drag-out was released and send there.
@@ -6758,8 +6936,8 @@ async function resolveAndSend(payload){
6758
6936
  // app happens to sit open from unrelated work must not get an insert into a model they never
6759
6937
  // pointed at. Refusing costs a re-drag; guessing costs a wrong model.
6760
6938
  if(resolved){
6761
- toast(proc?('Released over '+proc+' — nothing sent. Drag it out again over Tekla, Revit or SketchUp.')
6762
- :'Released over the desktop — nothing sent. Drag it out again over Tekla, Revit or SketchUp.');
6939
+ toast(proc?('Released over '+proc+' — nothing sent. Drag it out again over Tekla, Revit, SketchUp or Rhino.')
6940
+ :'Released over the desktop — nothing sent. Drag it out again over Tekla, Revit, SketchUp or Rhino.');
6763
6941
  return;
6764
6942
  }
6765
6943
  // A drop we could NOT READ is a different fact — our failure, not their aim. With exactly one CAD
@@ -6769,7 +6947,7 @@ async function resolveAndSend(payload){
6769
6947
  if(running.length!==1){
6770
6948
  toast(running.length>1
6771
6949
  ?'Couldn’t tell which app you dropped on — try again, or use ⋯ → Session to pick one.'
6772
- :'Couldn’t tell what you dropped on — open Tekla, Revit or SketchUp and try again.');
6950
+ :'Couldn’t tell what you dropped on — open Tekla, Revit, SketchUp or Rhino and try again.');
6773
6951
  return;
6774
6952
  }
6775
6953
  host=running[0];pid=null;
@@ -6809,14 +6987,19 @@ async function sendSelectionToHost(host,ids,hostPid){
6809
6987
  const gotNoun=got===1?'member':'members',missed=n-got;
6810
6988
  // A member can land as a generic placeholder solid when its section isn't loaded in the host —
6811
6989
  // report that rather than let the user find a grey block and assume the export is broken.
6812
- // One sentence shape across all three hosts — "Inserted {got} of {n} … into {Host} — {why}." —
6990
+ // One sentence shape across all four hosts — "Inserted {got} of {n} … into {Host} — {why}." —
6813
6991
  // so only the reason clause varies by host, never the voice.
6814
6992
  const fell=em?em.filter(r=>r&&r.kind==='member'&&r.fallback).length:0;
6815
- toast(missed>0
6993
+ let insertedMessage=missed>0
6816
6994
  ?'Inserted '+got+' of '+n+' '+noun+' into '+NAME+' — '+missed+' had no size to build yet.'
6817
6995
  :(fell>0
6818
6996
  ?'Inserted '+got+' of '+n+' '+noun+' into '+NAME+' — '+fell+' used a placeholder shape (their section isn’t loaded in '+NAME+').'
6819
- :'Inserted '+got+' '+gotNoun+' into '+NAME+'.'));
6997
+ :'Inserted '+got+' '+gotNoun+' into '+NAME+'.');
6998
+ const receiptWarnings=j.receipt&&Array.isArray(j.receipt.warnings)?j.receipt.warnings:[];
6999
+ if(got>0&&host==='rhino'&&receiptWarnings.some(w=>w&&w.code==='view-frame-failed')){
7000
+ insertedMessage+=' Rhino couldn’t frame the view — switch to a model view, then use Zoom Extents to find the inserted members.';
7001
+ }
7002
+ toast(insertedMessage);
6820
7003
  }catch(e){
6821
7004
  console.error('send to '+host+' failed',e);
6822
7005
  // The server's own messages are plain English; a transport failure ("Failed to fetch") is not.
@@ -6887,8 +7070,10 @@ function modelReadsV1(){
6887
7070
  const planList=()=>((C&&Array.isArray(C.plans))?C.plans:[]).map(p=>({members:p.members||[],ptPerFt:(p.pt_per_ft>0?p.pt_per_ft:1),defaultTosMm:(p.default_tos!=null?p.default_tos:0)*25.4})); // every sheet WITH its OWN px→ft scale AND its OWN default T.O.S, exactly as the server bake resolves them (contract-to-scene). Guards a not-yet-loaded contract so a hover can't throw out of the pointer handler.
6888
7071
  const scaleIndex=()=>{if(!scaleIdx){try{scaleIdx=SteelCore.planScaleIndex(planList(),activeScale());}catch(_){return new Map();}}return scaleIdx;}; // a transient failure returns an empty index WITHOUT caching it — caching one would silently downgrade every member to the active scale until the next rebuild
6889
7072
  return {
7073
+ memberEditing:true, // the view may build drag geometry as well as selection state
6890
7074
  invalidate(){scaleIdx=null;},
6891
7075
  geometryOf:m=>SteelCore.memberGeometryInOwnPlan(m,scaleIndex(),activeScale()),
7076
+ lengthFt(m){const s=SteelCore.planScaleOf(scaleIndex(),m,activeScale());return _len3dFt(m,s.ptPerFt,s.defaultTosMm/25.4);},
6892
7077
  scaleOf:m=>SteelCore.planScaleOf(scaleIndex(),m,activeScale()), // keyed by the member OBJECT — ids are only sheet-unique
6893
7078
  defaultPlaneZ:()=>activeScale().defaultTosMm,
6894
7079
  memberCandidates(excludeId){const dtos=activeScale().defaultTosMm;
@@ -6904,9 +7089,13 @@ function modelReadsV1(){
6904
7089
  function modelReadsV2(){
6905
7090
  const mem=()=>(C&&Array.isArray(C.members))?C.members:[]; // v2 holds ONE root member array — not a plan property at all
6906
7091
  const refuse=(what)=>{throw new Error('steel.model/v2: '+what);};
7092
+ const geometryOf=m=>SteelCore.memberGeometryV2(m);
6907
7093
  return {
7094
+ memberEditing:false, // selection stays live; member drag/copy/edit remains refused in this release
6908
7095
  invalidate(){}, // nothing is cached: a v2 member carries its own world-mm coordinates, so there is no per-plan scale to index
6909
- geometryOf:m=>SteelCore.memberGeometryV2(m),
7096
+ geometryOf,
7097
+ lengthFt(m){const g=geometryOf(m),a=g&&g.line&&g.line[0],b=g&&g.line&&g.line[1];
7098
+ return (a&&b)?Math.hypot(b[0]-a[0],b[1]-a[1],b[2]-a[2])/V2_PT_PER_FT:0;}, // stored world mm → true 3D feet; unknown/malformed elevations stay an absent label, never a fabricated length
6910
7099
  // A v2 member has no owning plan and no scale. This is only ever asked by a WRITE path (the member
6911
7100
  // drag, the endpoint drag, split), every one of which is refused — so reaching it is a bug, and a
6912
7101
  // throw says so instead of inverting a commit through a fabricated scale.
@@ -6940,7 +7129,7 @@ const view3dApi={
6940
7129
  // PROJECT_QS is threaded so the server can resolve this project's activation grant — without it a
6941
7130
  // steel.model/v2 draft posts app-scoped, no grant resolves, and the render is refused as "not
6942
7131
  // activated" for a project that IS activated (P7d). Harmless for v1, which needs no grant.
6943
- fetchScene:async()=>{const r=await fetch('/api/contract/'+encodeURIComponent(APP_ID)+'/scene'+PROJECT_QS,{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({contract:C})});const j=await r.json();if(!j.ok)throw new Error(j.error||'scene render failed');
7132
+ fetchScene:async()=>{const j=await fetchScenePayload();
6944
7133
  // The bake reports everything it could NOT emit in `skipped[]`, and we used to discard it entirely — so a
6945
7134
  // connection the engine refused (e.g. a shear plate whose main became a brace) vanished from 3D silently.
6946
7135
  // Always log the full list. TOAST only for `joint:<id>` entries: a refused connection is unambiguous and
@@ -6954,11 +7143,7 @@ const view3dApi={
6954
7143
  // v2 drops no foundation columns at all. What remains on v2 is (a) no resolvable section and (b) a
6955
7144
  // genuinely zero-LENGTH member — and (b) is never expected, so the "would nag" argument no longer
6956
7145
  // covers it. Widening `skipped` to carry reasons is the fix; it is not this change.
6957
- {const sk=Array.isArray(j.skipped)?j.skipped:[];
6958
- if(sk.length){
6959
- const jn=sk.filter(s=>String(s).startsWith('joint:')).length;
6960
- console.warn('3D bake skipped '+sk.length+' item(s):',sk);
6961
- if(jn)toast(jn+' connection'+(jn>1?'s':'')+' not shown in 3D — see the console');}}const cm={},pb={};const sc=j.scene||{};sc.elements=Array.isArray(sc.elements)?sc.elements:[];for(const el of sc.elements){if(!el)continue;if(el.id)pb[el.id]=el;if(el.kind==='cut'&&el.member){(cm[el.member]||(cm[el.member]=[])).push((el.meta&&el.meta.label)||'Cope');}}
7146
+ const cm={},pb={};const sc=j.scene||{};sc.elements=Array.isArray(sc.elements)?sc.elements:[];for(const el of sc.elements){if(!el)continue;if(el.id)pb[el.id]=el;if(el.kind==='cut'&&el.member){(cm[el.member]||(cm[el.member]=[])).push((el.meta&&el.meta.label)||'Cope');}}
6962
7147
  // Slice 4: append placed detail images as CLIENT-SIDE scene elements (kind:'image'), resolving each
6963
7148
  // placement's detailName → custom_details base64 in the browser. The server's contract-to-scene never
6964
7149
  // emits these, so they stay out of the reconstructed scene / IFC / Tekla export and the baked lock.
@@ -7221,7 +7406,7 @@ const view3dApi={
7221
7406
  // Re-extrude the 3D model after a structural edit (keeps the camera where it is). Selection-only
7222
7407
  // changes go through render()'s setSelection — only geometry mutations need a rebuild.
7223
7408
  let pendingConnSel=null; // a just-baked connection whose parts exist only AFTER the next rebuild → select the whole thing there (a recognized base-plate import, whose part ids aren't known ahead of expansion)
7224
- function sync3D(){if(view3d&&view3dReady&&window.Steel3DView){window.Steel3DView.rebuild(false).then(()=>{
7409
+ function sync3D(){invalidateConnectionDiagnostics();panel();if(view3d&&view3dReady&&window.Steel3DView){window.Steel3DView.rebuild(false).then(()=>{
7225
7410
  if(pendingConnSel&&window.Steel3DView.selectWholeConn){const c=pendingConnSel;pendingConnSel=null;window.Steel3DView.selectWholeConn(c);} // whole-connection select (envelope + "Parametric — editable" inspector), same as a 3D click
7226
7411
  else window.Steel3DView.setSelection(selIds);
7227
7412
  build3DLegend();panel();}).catch(()=>{pendingConnSel=null;});}} // rebuild also refreshes the legend (an edit may add/remove a profile) + re-renders the inspector so a selection of just-created parts (e.g. a placed custom connection) resolves against the freshly-fetched partsById, not the pre-rebuild stale copy
@@ -8196,7 +8381,7 @@ function applyLegendFilter(){
8196
8381
  }
8197
8382
  // Resolve a row to the member/connection ids it represents. A member row's data-key is a profile key; a connection
8198
8383
  // row carries its part ids on row._ids. Used by legend click-to-select + the box/isolate SELECTION actions below.
8199
- function legRowIds(row){if(!row)return [];if(row.dataset.connkey)return (row._ids||[]).slice();const k=row.dataset.key;if(!k)return [];return (P.members||[]).filter(m=>profileKeyOf(m)===k).map(m=>m.id);}
8384
+ function legRowIds(row){if(!row)return [];if(row.dataset.connkey)return (row._ids||[]).slice();const k=row.dataset.key;if(!k)return [];return allMembers().filter(m=>profileKeyOf(m)===k).map(m=>m.id);} // v2's Objects list shows root members, so its selection lookup must use the same format-aware model list rather than the active plan's intentionally empty members[]
8200
8385
  let bar3dWired=false;
8201
8386
  function seg3dActive(sel,attr,val){document.querySelectorAll(sel+' button').forEach(b=>b.classList.toggle('on',b.getAttribute(attr)===val));}
8202
8387
  // Reflect the live projection / display mode into the Camera + Display dropdowns: tick the active menu item AND label the trigger button, so the current mode shows without opening the menu.
@@ -9907,6 +10092,7 @@ if(canWriteModel()){
9907
10092
  for(const _p of (C.plans||[]))sanitizePlanGrid(_p);
9908
10093
  }
9909
10094
  setPlan(C.active==null?0:C.active);
10095
+ invalidateConnectionDiagnostics(); // 2D asks the same server bake as 3D before it promises a connection will build
9910
10096
  applyReadOnlyChrome(); // …after setPlan, so the controls it touches are the ones the render just wired
9911
10097
  // ONE WORD FOR BOTH MODES. This said "Grid restored ✓" on a read-only document, on the premise that the
9912
10098
  // grid is the only thing such a draft can hold — which review disproved (see RO_DRAFT_KEYS: the overlay