@floless/app 0.158.0 → 0.160.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 +140655 -117708
- package/dist/schemas/drawing-check.profile.v1.schema.json +33 -1
- package/dist/schemas/steel.model.v2.schema.json +1 -0
- package/dist/skills/floless-app-actions/SKILL.md +23 -5
- package/dist/skills/floless-app-bridge/SKILL.md +5 -3
- package/dist/skills/floless-app-onboarding/SKILL.md +69 -5
- package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +8 -6
- package/dist/skills/floless-app-queue/SKILL.md +3 -1
- package/dist/skills/floless-app-rfi/SKILL.md +29 -1
- package/dist/skills/floless-app-steel-model/SKILL.md +11 -5
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +28 -8
- package/dist/skills/floless-app-workflows/SKILL.md +6 -3
- package/dist/web/agents.js +12 -5
- package/dist/web/app.css +266 -159
- package/dist/web/app.js +23 -51
- package/dist/web/aware.js +533 -546
- package/dist/web/chat-question-card.js +24 -1
- package/dist/web/chat.css +170 -48
- package/dist/web/chat.js +1406 -208
- package/dist/web/commands-shell.js +1104 -177
- package/dist/web/commands-steel.js +2 -0
- package/dist/web/drawing-check-editor.html +10 -0
- package/dist/web/drawing-check-editor.js +44 -0
- package/dist/web/guide.js +12 -2
- package/dist/web/index.html +62 -48
- package/dist/web/instructor.js +33 -12
- package/dist/web/pages.js +186 -31
- package/dist/web/panels.js +19 -1
- package/dist/web/project-access.js +67 -8
- package/dist/web/project-modules.js +474 -0
- package/dist/web/project-rfis.js +715 -0
- package/dist/web/project-workflows.js +506 -0
- package/dist/web/run-history.js +198 -0
- package/dist/web/run-page-view.js +12 -2
- package/dist/web/steel-3d-core.js +75 -1
- package/dist/web/steel-3d-view.js +8 -38
- package/dist/web/steel-editor.html +263 -59
- package/dist/web/steel-model-v2-projection.js +7 -0
- package/dist/web/workspace-root-recovery.js +119 -0
- package/dist/web/workspaces.js +493 -161
- package/launch-starting-page.mjs +5 -2
- package/launch.mjs +136 -78
- package/package.json +6 -1
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflows → History (docs/superpowers/specs/2026-10-23-workflow-run-history-design.md): every run of every workflow,
|
|
3
|
+
* grouped per workflow, newest first. The server builds the list from AWARE's traces (GET /api/workflows/run-history);
|
|
4
|
+
* this file only renders it into the panel web/aware.js gives it, the way web/pages.js renders the Pages tab.
|
|
5
|
+
*/
|
|
6
|
+
(function () {
|
|
7
|
+
const bridge = window.flolessBridge || {};
|
|
8
|
+
const api = bridge.api || (async (path) => {
|
|
9
|
+
const res = await fetch(path);
|
|
10
|
+
const body = await res.json().catch(() => ({}));
|
|
11
|
+
if (!res.ok) throw Object.assign(new Error(body.error || 'request failed'), { status: res.status, body });
|
|
12
|
+
return body;
|
|
13
|
+
});
|
|
14
|
+
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
15
|
+
const toast = (msg, kind) => { if (typeof window.showToast === 'function') window.showToast(msg, kind); };
|
|
16
|
+
|
|
17
|
+
const OUTCOME = {
|
|
18
|
+
succeeded: 'Succeeded', failed: 'Failed', stopped: 'Stopped', running: 'Running', 'not-run': 'Didn’t run', simulated: 'Simulated',
|
|
19
|
+
};
|
|
20
|
+
const ENDED_EARLY = 'No end was recorded for this run: it was stopped, FloLess closed while it ran, or it is still running outside FloLess. Run it again to get a complete result.';
|
|
21
|
+
const failedTip = (step) => (step
|
|
22
|
+
? `This run stopped at the step “${step}”. Open the workflow to check that step, then run it again.`
|
|
23
|
+
: 'This run failed. Open the workflow to see what went wrong, then run it again.');
|
|
24
|
+
const DAMAGED = 'FloLess couldn’t read this workflow’s files, so it can’t be opened or run. Its earlier runs are still listed. Ask AI Chat to repair or reinstall it.';
|
|
25
|
+
const MISSING = 'This workflow’s compiled copy is missing, so it can’t run until it is compiled again. Its earlier runs are still listed; Open workflow opens it so you can compile it.';
|
|
26
|
+
const AI_TIP = 'An AI step answered part of this run, so its output can differ from run to run.';
|
|
27
|
+
const SIM_TIP = 'A simulated or trial run: FloLess checked the steps without changing your model, so it made nothing.';
|
|
28
|
+
const UNREADABLE = 'FloLess couldn’t read this workflow’s runs. Check that the files in your AWARE folder are available, then try again.';
|
|
29
|
+
|
|
30
|
+
/** What was last read, so a repaint (a search, coming back to the tab) shows it at once. */
|
|
31
|
+
let cache = null;
|
|
32
|
+
/** Which sections the person opened or closed, by workflow id, kept across repaints. A search opens its matches. */
|
|
33
|
+
const openState = new Map();
|
|
34
|
+
let clickedSection = null;
|
|
35
|
+
const lists = new Set();
|
|
36
|
+
|
|
37
|
+
const when = (iso) => {
|
|
38
|
+
const t = Date.parse(iso);
|
|
39
|
+
return Number.isFinite(t)
|
|
40
|
+
? new Date(t).toLocaleString(undefined, { day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit' }) : '';
|
|
41
|
+
};
|
|
42
|
+
function duration(ms) {
|
|
43
|
+
if (typeof ms !== 'number' || !Number.isFinite(ms)) return '';
|
|
44
|
+
const s = Math.round(ms / 1000);
|
|
45
|
+
if (s < 1) return 'under 1 s';
|
|
46
|
+
if (s < 60) return `${s} s`;
|
|
47
|
+
if (s < 3600) return `${Math.floor(s / 60)} min ${s % 60} s`;
|
|
48
|
+
return `${Math.floor(s / 3600)} h ${Math.floor((s % 3600) / 60)} min`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function rowHtml(w, r) {
|
|
52
|
+
const key = r.runId || `${r.routine?.id || 'routine'}@${r.startedAt}`;
|
|
53
|
+
const label = `${w.name}, ${when(r.startedAt)}`;
|
|
54
|
+
const tip = r.outcome === 'stopped' && r.endedEarly ? ENDED_EARLY : r.outcome === 'simulated' ? SIM_TIP
|
|
55
|
+
: r.outcome === 'failed' ? failedTip(r.failedStep) : '';
|
|
56
|
+
const detail = r.outcome === 'failed' && r.failedStep ? `At step “${r.failedStep}”` : r.outcome === 'not-run' ? (r.reason || '') : '';
|
|
57
|
+
const pills = [
|
|
58
|
+
r.routine ? `<span class="rh-pill" data-tip="${esc(`Started by the routine “${r.routine.name}”.`)}">Routine: ${esc(r.routine.name)}</span>` : '',
|
|
59
|
+
r.aiStep ? `<span class="pg-ai-badge rh-ai" tabindex="0" data-tip="${esc(AI_TIP)}">AI step</span>` : '',
|
|
60
|
+
r.simulated && r.outcome !== 'simulated' ? `<span class="rh-pill" data-tip="${esc(SIM_TIP)}">Simulated</span>` : '',
|
|
61
|
+
].join('');
|
|
62
|
+
const report = r.report && r.runId && !w.damaged && !w.missing
|
|
63
|
+
? `<button type="button" class="btn-mini rh-btn" data-rh-report="${esc(r.runId)}" data-rh-app="${esc(w.id)}" data-command-id="shell.workflows-history-report#${esc(r.runId)}" data-command-instance-label="${esc(label)}" aria-label="${esc(`View report: ${label}`)}" data-tip="Opens the report this run made">View report</button>` : '';
|
|
64
|
+
const rowClass = r.outcome === 'failed' ? ' is-failed' : r.outcome === 'not-run' ? ' is-not-run' : '';
|
|
65
|
+
return `<div class="rh-row${rowClass}" role="listitem" data-rh-run="${esc(key)}">`
|
|
66
|
+
+ `<time class="rh-when" datetime="${esc(r.startedAt)}">${esc(when(r.startedAt))}</time>`
|
|
67
|
+
+ `<span class="rh-outcome rh-${esc(r.outcome)}"${tip ? ` tabindex="0" data-tip="${esc(tip)}"` : ''}>${esc(OUTCOME[r.outcome] || r.outcome)}</span>`
|
|
68
|
+
+ `<span class="rh-dur">${esc(duration(r.durationMs))}</span>`
|
|
69
|
+
+ `<span class="rh-detail">${detail ? `<span class="rh-detail-text"${r.outcome === 'failed' ? ` data-tip="${esc(detail)}"` : ''}>${esc(detail)}</span>` : ''}${pills}</span>`
|
|
70
|
+
+ `<span class="rh-actions">${report}${w.damaged ? '' : `<button type="button" class="btn-mini rh-btn rh-open" data-rh-${w.missing ? 'draft' : 'open'}="${esc(w.id)}" data-command-id="shell.workflows-history-open#${esc(key)}" data-command-instance-label="${esc(label)}" aria-label="${esc(`Open workflow: ${label}`)}" data-tip="Opens this workflow">Open workflow</button>`}</span>`
|
|
71
|
+
+ `</div>`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function sectionHtml(w, open) {
|
|
75
|
+
const last = w.runs[0];
|
|
76
|
+
const summaryLast = last ? `Last run ${when(last.startedAt)}, ${(OUTCOME[last.outcome] || last.outcome).toLowerCase()}` : '';
|
|
77
|
+
const count = w.unreadable ? (w.runs.length ? `${w.total} runs, some couldn’t be read` : 'Runs couldn’t be read')
|
|
78
|
+
: `${w.total} run${w.total === 1 ? '' : 's'}`;
|
|
79
|
+
return `<details class="ws-archived wf-section rh-section" data-rh-workflow="${esc(w.id)}"${open ? ' open' : ''}>`
|
|
80
|
+
+ `<summary class="ws-archived-summary rh-summary" data-command-id="shell.workflows-history-section#${esc(w.id)}" data-command-instance-label="${esc(w.name)}">`
|
|
81
|
+
+ `<span class="ws-archived-caret hd-caret" aria-hidden="true">▸</span><span class="rh-sum-name">${esc(w.name)}</span>`
|
|
82
|
+
+ (w.ownerLabel ? `<span class="rh-sum-meta">${esc(w.ownerLabel)}</span>` : '')
|
|
83
|
+
+ `<span class="rh-sum-meta">${count}</span>`
|
|
84
|
+
+ (summaryLast ? `<span class="rh-sum-meta">${esc(summaryLast)}</span>` : '')
|
|
85
|
+
+ `</summary>`
|
|
86
|
+
+ (w.damaged ? `<p class="pg-wf-note" role="status">${esc(DAMAGED)}</p>` : '')
|
|
87
|
+
+ (w.missing ? `<p class="pg-wf-note" role="status">${esc(MISSING)}</p>` : '')
|
|
88
|
+
+ (w.unreadable ? `<p class="pg-wf-note" role="status">${esc(UNREADABLE)}</p>` : '')
|
|
89
|
+
+ (w.total > w.runs.length ? `<p class="rh-cut">Showing the newest ${w.runs.length} of ${w.total} runs.</p>` : '')
|
|
90
|
+
+ (w.runs.length ? `<div class="rh-list" role="list" aria-label="${esc(`Runs of ${w.name}`)}">${w.runs.map((r) => rowHtml(w, r)).join('')}</div>` : '')
|
|
91
|
+
+ `</details>`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const matches = (w, terms) => terms.every((t) => `${w.name} ${w.ownerLabel || ''}`.toLowerCase().includes(t));
|
|
95
|
+
|
|
96
|
+
function paint(container, opts) {
|
|
97
|
+
const query = String(opts?.getQuery?.() ?? '').trim();
|
|
98
|
+
const terms = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
99
|
+
const focused = container.contains(document.activeElement) ? document.activeElement?.getAttribute('data-command-id') : null;
|
|
100
|
+
container.dataset.rhState = 'ready';
|
|
101
|
+
if (!cache.length) {
|
|
102
|
+
container.innerHTML = `<div class="pg-empty"><p>No runs yet. Open a workflow and run it, and its runs will show here.</p>`
|
|
103
|
+
+ `<p><button type="button" class="ghost rh-act" data-rh-act="show-workflows" data-command-id="shell.workflows-history-show-workflows">Show workflows</button></p></div>`;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const shown = cache.filter((w) => matches(w, terms));
|
|
107
|
+
if (!shown.length) {
|
|
108
|
+
container.innerHTML = `<div class="pg-empty" role="status"><p class="rh-nomatch"></p>`
|
|
109
|
+
+ `<p><button type="button" class="ghost rh-act" data-rh-act="clear-search" data-command-id="shell.workflows-history-clear-search">Clear search</button></p></div>`;
|
|
110
|
+
container.querySelector('.rh-nomatch').textContent = `No workflow matches “${query}”.`; // text, never markup: it echoes what was typed
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
// An unreadable section starts open: its note is the thing to see.
|
|
114
|
+
container.innerHTML = shown.map((w, i) => sectionHtml(w, terms.length > 0
|
|
115
|
+
|| (openState.has(w.id) ? openState.get(w.id) : i === 0 || Boolean(w.unreadable)))).join('');
|
|
116
|
+
if (focused && document.activeElement === document.body) {
|
|
117
|
+
[...container.querySelectorAll('[data-command-id]')].find((el) => el.getAttribute('data-command-id') === focused)?.focus({ preventScroll: true });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Draw the list again from what was last read: nothing is fetched. */
|
|
122
|
+
function repaint(container) {
|
|
123
|
+
const entry = [...lists].find((e) => e.container === container);
|
|
124
|
+
if (entry && cache && container.dataset.rhState === 'ready') paint(container, entry.opts);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Render the run history into `container`. `opts.getQuery()` is the landing's search text; `opts.onAction(act)` hears the
|
|
129
|
+
* buttons that leave this list ('show-workflows', 'clear-search'); `opts.openWorkflow(appId)`, `opts.openDraft(workflowId)`
|
|
130
|
+
* (a workflow you own whose compiled copy is missing) and `opts.openReport(appId, runId)` open what a row points at.
|
|
131
|
+
*/
|
|
132
|
+
async function render(container, opts = {}) {
|
|
133
|
+
if (!container) return;
|
|
134
|
+
for (const e of [...lists]) if (e.container === container || !e.container.isConnected) lists.delete(e);
|
|
135
|
+
const entry = { container, opts };
|
|
136
|
+
lists.add(entry);
|
|
137
|
+
wire(container, entry);
|
|
138
|
+
const token = (container.dataset.rhToken = String(Math.random()));
|
|
139
|
+
if (cache) paint(container, opts);
|
|
140
|
+
else { container.dataset.rhState = 'loading'; container.innerHTML = '<p class="pg-loading-line" role="status">Reading runs…</p>'; }
|
|
141
|
+
const current = () => container.dataset.rhToken === token && container.isConnected;
|
|
142
|
+
let body;
|
|
143
|
+
try { body = await api('/api/workflows/run-history'); } catch (err) {
|
|
144
|
+
if (!current()) return;
|
|
145
|
+
console.warn('The run history could not be read', err);
|
|
146
|
+
cache = null;
|
|
147
|
+
container.dataset.rhState = 'error';
|
|
148
|
+
const said = typeof err?.body?.error === 'string' && err.body.error ? err.body.error
|
|
149
|
+
: 'FloLess couldn’t read the run history. Check that FloLess is running, then try again.';
|
|
150
|
+
container.innerHTML = `<div class="pg-empty" role="alert"><p>${esc(said)}</p>`
|
|
151
|
+
+ `<p><button type="button" class="ghost rh-act" data-rh-act="retry" data-command-id="shell.workflows-history-retry">Try again</button></p></div>`;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (!current()) return;
|
|
155
|
+
cache = (Array.isArray(body.workflows) ? body.workflows : []).filter((w) => w && typeof w.id === 'string' && Array.isArray(w.runs));
|
|
156
|
+
paint(container, opts);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** A run ended somewhere: read the history again for every list on screen. */
|
|
160
|
+
function refresh() {
|
|
161
|
+
for (const e of [...lists]) {
|
|
162
|
+
if (!e.container.isConnected) { lists.delete(e); continue; }
|
|
163
|
+
void render(e.container, e.opts);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const wired = new WeakSet();
|
|
168
|
+
function wire(container, entry) {
|
|
169
|
+
entry.container._rhEntry = entry;
|
|
170
|
+
if (wired.has(container)) return;
|
|
171
|
+
wired.add(container);
|
|
172
|
+
// A section drawn open fires `toggle` too, so only a toggle that follows a click on its heading is the person's.
|
|
173
|
+
container.addEventListener('toggle', (event) => {
|
|
174
|
+
const box = event.target.closest?.('.rh-section');
|
|
175
|
+
if (box && box.dataset.rhWorkflow === clickedSection) { openState.set(clickedSection, box.open); clickedSection = null; }
|
|
176
|
+
}, true);
|
|
177
|
+
container.addEventListener('click', (event) => {
|
|
178
|
+
const opts = container._rhEntry?.opts || {};
|
|
179
|
+
if (event.target.closest('.rh-summary')) clickedSection = event.target.closest('.rh-section')?.dataset.rhWorkflow ?? null;
|
|
180
|
+
const open = event.target.closest('[data-rh-open]');
|
|
181
|
+
if (open) { opts.openWorkflow?.(open.dataset.rhOpen); return; }
|
|
182
|
+
const draft = event.target.closest('[data-rh-draft]');
|
|
183
|
+
if (draft) { opts.openDraft?.(draft.dataset.rhDraft); return; }
|
|
184
|
+
const report = event.target.closest('[data-rh-report]');
|
|
185
|
+
if (report) {
|
|
186
|
+
Promise.resolve(opts.openReport?.(report.dataset.rhApp, report.dataset.rhReport))
|
|
187
|
+
.catch((err) => toast(err?.message || 'FloLess couldn’t open that run’s report. Open the workflow to see its latest results.', 'warn'));
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const act = event.target.closest('[data-rh-act]');
|
|
191
|
+
if (!act) return;
|
|
192
|
+
if (act.dataset.rhAct === 'retry') void render(container, opts);
|
|
193
|
+
else opts.onAction?.(act.dataset.rhAct);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
window.flolessRunHistory = { render, repaint, refresh };
|
|
198
|
+
})();
|
|
@@ -180,7 +180,8 @@
|
|
|
180
180
|
setNote(NOTES.none); stopPoll(v); return;
|
|
181
181
|
}
|
|
182
182
|
if (a.state === 'failed') {
|
|
183
|
-
|
|
183
|
+
// #2644: locked is not a failed save, so it never tells the person to run again: the module's sentence says what to do.
|
|
184
|
+
setNote(a.locked ? sentence(a.reason) : a.reason ? sentence(a.reason) + ' ' + FAILED_TAIL : 'This report could not be saved to the workflow’s Page. ' + FAILED_TAIL);
|
|
184
185
|
stopPoll(v); return;
|
|
185
186
|
}
|
|
186
187
|
// saved
|
|
@@ -235,9 +236,18 @@
|
|
|
235
236
|
catch (e) { /* the header link is a convenience; the frame below does not depend on it */ }
|
|
236
237
|
}
|
|
237
238
|
apply(v, a, false);
|
|
238
|
-
}).catch(function () {
|
|
239
|
+
}).catch(function (err) {
|
|
239
240
|
if (stale(v, g)) return;
|
|
240
241
|
if (v.lookupSeq === seq) v.lookupBusy = false;
|
|
242
|
+
// #2644: a Drawing Checker or Steel Model workflow this account's plan does not include. That is an answer, not a
|
|
243
|
+
// lookup that failed for now: say why, in the module's own words, and stop asking.
|
|
244
|
+
var locked = err && err.status === 403 && err.body && typeof err.body.userMessage === 'string' ? err.body.userMessage.trim() : '';
|
|
245
|
+
// Only the latest lookup may answer: an older one's refusal never overwrites a newer answer.
|
|
246
|
+
if (locked && v.lookupSeq !== seq) return;
|
|
247
|
+
if (locked) {
|
|
248
|
+
apply(v, { state: 'failed', locked: true, rev: v.held.rev + 1, epoch: v.held.epoch || 'locked', version: null, files: null, filesWithheld: '', reason: locked, frameUrl: '' }, false);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
241
251
|
// The question could not be answered (offline, slow): keep what is shown and ask again while it matters.
|
|
242
252
|
var a = v.held.answer;
|
|
243
253
|
if (!a || a.state === 'pending' || a.state === 'none' || (a.state === 'saved' && a.files > 0 && !a.frameUrl)) ensurePoll(v);
|
|
@@ -542,6 +542,52 @@ export function sectionOutlinePts(kind, w, d, thk) {
|
|
|
542
542
|
return { outer }; // BOX / unclassified → rectangle
|
|
543
543
|
}
|
|
544
544
|
|
|
545
|
+
/**
|
|
546
|
+
* The 3D section kind of one scene member: an explicit `section.shape` override wins, then the bake's
|
|
547
|
+
* `section.round` (a round HSS cannot be told from its designation — `sectionKindOf` answers TUBE for both
|
|
548
|
+
* `HSS6X6X3/8` and `HSS6.625X0.280`), then the designation through `sectionKindOf`. Shared by the 3D
|
|
549
|
+
* renderer (`steel-3d-view.js`) and the Page `.glb` exporter (`server/glb-export.ts`) so the two cannot
|
|
550
|
+
* draw the same member as different shapes.
|
|
551
|
+
*/
|
|
552
|
+
export function memberShapeKind(el) {
|
|
553
|
+
const explicit = (el && el.section && el.section.shape || '').toString().toUpperCase().trim();
|
|
554
|
+
if (/^(I|C|L|TUBE|BOX|ROUND)$/.test(explicit)) return explicit;
|
|
555
|
+
if (el && el.section && el.section.round === true) return 'ROUND';
|
|
556
|
+
return sectionKindOf((el && el.meta && el.meta.profile) || '');
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/** True when a member is drawn as an extruded section rather than a plain box. */
|
|
560
|
+
export function memberExtrudes(el) {
|
|
561
|
+
const display = el && el.meta && el.meta.displaySection;
|
|
562
|
+
const displayExtrudes = !!display && !/^(rect|joist|unsupported-custom)$/.test(String(display.shape));
|
|
563
|
+
return displayExtrudes || memberShapeKind(el) !== 'BOX';
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// A real thickness off the element's `xsection` (AISC table / designation) when there is one and it fits
|
|
567
|
+
// inside the section, else null so the caller keeps its estimate. The fit check matters: a metric
|
|
568
|
+
// designation's thickness token is parsed as inches, which would draw a leg thicker than the whole angle.
|
|
569
|
+
function xsectionThk(xs, key, half) {
|
|
570
|
+
const t = xs && typeof xs[key] === 'number' ? xs[key] : null;
|
|
571
|
+
return t != null && t > 0 && t < 2 * half ? t : null;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* The section topology a member is extruded from. `displaySection` (tee, double-angle, …) wins; without it
|
|
576
|
+
* the element's `xsection` supplies the real thicknesses. Without either every thickness is a GUESS off the
|
|
577
|
+
* envelope — an L4X4 leg came out 18.3mm against a real 9.5 — and the estimates in `sectionOutlinePts` are
|
|
578
|
+
* the fallback that lets a member be drawn at all.
|
|
579
|
+
*/
|
|
580
|
+
export function memberSectionTopology(kind, w, d, xs, displaySection) {
|
|
581
|
+
const fallback = xs ? {
|
|
582
|
+
...(xs.shape === 'i' ? { shape: 'i', d: xs.d, bf: xs.bf, tw: xsectionThk(xs, 'tw', w / 2), tf: xsectionThk(xs, 'tf', d / 2) } : {}),
|
|
583
|
+
...(xs.shape === 'channel' ? { shape: 'channel', d: xs.d, bf: xs.bf, tw: xsectionThk(xs, 'tw', w / 2), tf: xsectionThk(xs, 'tf', d / 2) } : {}),
|
|
584
|
+
...(xs.shape === 'angle' ? { shape: 'angle', d: xs.d, b: xs.b, t: xsectionThk(xs, 't', Math.min(w, d) / 2) } : {}),
|
|
585
|
+
...(xs.shape === 'rhs' ? { shape: 'rhs', d: xs.d, b: xs.b, t: xsectionThk(xs, 't', Math.min(w, d) / 2) } : {}),
|
|
586
|
+
...(xs.shape === 'chs' ? { shape: 'chs', od: xs.od, t: xsectionThk(xs, 't', Math.min(w, d) / 2) } : {}),
|
|
587
|
+
} : null;
|
|
588
|
+
return sectionTopology(displaySection || fallback, w, d, kind);
|
|
589
|
+
}
|
|
590
|
+
|
|
545
591
|
/** How many segments approximate a circle for the consumers that need a polygon. */
|
|
546
592
|
export const ROUND_SEGMENTS = 48;
|
|
547
593
|
|
|
@@ -1104,6 +1150,30 @@ export function sheetIncludesElevation(fromZ, toZ, elevMm, tol = MODEL_V2_TOL.CU
|
|
|
1104
1150
|
*/
|
|
1105
1151
|
export const COLUMN_BELOW_REACH_MM = FT_TO_MM; // 12" = one foot, from the one definition of the foot (steel-units.js), not a second 304.8
|
|
1106
1152
|
|
|
1153
|
+
/**
|
|
1154
|
+
* The same convention for a project built to a metric standard: a round 300 mm, not the 304.8 a
|
|
1155
|
+
* converted foot lands on (owner ruling, Pawel, 2026-10-23 — asked as "should the minimum column stub
|
|
1156
|
+
* be a round 300 mm instead of the imperial 304.8 mm it inherits today?", answered yes).
|
|
1157
|
+
*
|
|
1158
|
+
* The number a UK detailer reads off this setting is a drafting convention in their own units; 304.8
|
|
1159
|
+
* is an artefact of where the default came from, and it showed through verbatim — a BS/EN project's
|
|
1160
|
+
* Inspect pane read "Columns ending up to 304.8 mm under this level are drawn dashed".
|
|
1161
|
+
*
|
|
1162
|
+
* KEYED ON THE PROJECT'S ENVIRONMENT, NOT ITS DISPLAY UNITS, and that is the load-bearing choice.
|
|
1163
|
+
* `displayUnits` is a per-person VIEW preference that flips at any time, while this resolver decides
|
|
1164
|
+
* what a SHEET DRAWS and is asked by the server's `membersOnSheet` as well as the browser — where no
|
|
1165
|
+
* display preference exists at all. Tying it to the view toggle would make switching units silently
|
|
1166
|
+
* change which columns appear on a drawing, and would let the two callers disagree. `environment` is
|
|
1167
|
+
* immutable, is a property of the project rather than of the reader, and is exactly the question
|
|
1168
|
+
* "which standard is this built to".
|
|
1169
|
+
*/
|
|
1170
|
+
export const COLUMN_BELOW_REACH_MM_METRIC = 300;
|
|
1171
|
+
|
|
1172
|
+
/** The default reach for a project built to `environment` — metric standards get the round number. */
|
|
1173
|
+
export function defaultColumnBelowReach(environment) {
|
|
1174
|
+
return environment === 'UK' ? COLUMN_BELOW_REACH_MM_METRIC : COLUMN_BELOW_REACH_MM;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1107
1177
|
/**
|
|
1108
1178
|
* The most a person may set the reach to: 100 ft. A column that ends further under a floor than that is not "the
|
|
1109
1179
|
* column below" this floor in any building, so a larger number is a typing mistake (a bare 8839 in a project that
|
|
@@ -1127,7 +1197,11 @@ export function isValidColumnBelowReach(mm) {
|
|
|
1127
1197
|
*/
|
|
1128
1198
|
export function columnBelowReachOf(doc) {
|
|
1129
1199
|
const stored = doc && typeof doc === 'object' ? doc.column_below_reach_mm : undefined;
|
|
1130
|
-
|
|
1200
|
+
if (isValidColumnBelowReach(stored)) return stored;
|
|
1201
|
+
// Only the DEFAULT varies by standard. A stored reach is the person's own number and is returned
|
|
1202
|
+
// verbatim whatever the environment — converting it here would change a saved drawing convention
|
|
1203
|
+
// behind their back, and a project that switched standards cannot exist (environment is immutable).
|
|
1204
|
+
return defaultColumnBelowReach(doc && typeof doc === 'object' ? doc.environment : undefined);
|
|
1131
1205
|
}
|
|
1132
1206
|
|
|
1133
1207
|
/**
|
|
@@ -21,7 +21,7 @@ import { surfaceTextures, applyTriplanar, TILE_MM, DIRECTIONAL } from './steel-m
|
|
|
21
21
|
import { canvasToolGuidanceState } from './steel-canvas-guidance.js';
|
|
22
22
|
import { Brush, Evaluator, SUBTRACTION } from 'three-bvh-csg';
|
|
23
23
|
import { FT_TO_MM as FT_MM } from './steel-units.js';
|
|
24
|
-
import { snapPoint, planPointToWp, memberGeometry, snapElevation, dim3dGeom, dominantAxis3d, planeBasis, planeFrom3Points, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame, resolvePointEntry, offsetsFor, candidateOnPlane, projectToPlane, snapGridPoint, projectPointOnSegment2d, projectPointOnSegment3d, selectedFrontmostHit, worldEndpointCommit, SEG_DEGENERACY, segmentHitsRect2d, projectedFootprintHitsRect2d, pickGridLevel, selectedLengthLabelAnchors, sectionKindOf, sectionTopology, memberMeshAxes, positionSwingDelta, snapToStep, rollCommitNorm, unwrapAngleStep, translateEndpoints, livePositionState, swingBasis, swingEndpoint, swingBarriers, clampSwingTheta, POSITION_SWING_MARGIN_RAD, POSITION_OFFSET_SNAP_MM, POSITION_ROT_SNAP_DEG, POSITION_BASIS_CAPABILITY_VERSION } from './steel-3d-core.js';
|
|
24
|
+
import { snapPoint, planPointToWp, memberGeometry, snapElevation, dim3dGeom, dominantAxis3d, planeBasis, planeFrom3Points, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame, resolvePointEntry, offsetsFor, candidateOnPlane, projectToPlane, snapGridPoint, projectPointOnSegment2d, projectPointOnSegment3d, selectedFrontmostHit, worldEndpointCommit, SEG_DEGENERACY, segmentHitsRect2d, projectedFootprintHitsRect2d, pickGridLevel, selectedLengthLabelAnchors, sectionKindOf, sectionTopology, memberShapeKind, memberExtrudes, memberSectionTopology, memberMeshAxes, positionSwingDelta, snapToStep, rollCommitNorm, unwrapAngleStep, translateEndpoints, livePositionState, swingBasis, swingEndpoint, swingBarriers, clampSwingTheta, POSITION_SWING_MARGIN_RAD, POSITION_OFFSET_SNAP_MM, POSITION_ROT_SNAP_DEG, POSITION_BASIS_CAPABILITY_VERSION } from './steel-3d-core.js';
|
|
25
25
|
// `gridGeometry`, `gridCandidates3d` and `sheetScaleMm` live behind the host's model read boundary
|
|
26
26
|
// because their display-scale argument is meaningless on a world-mm model grid.
|
|
27
27
|
import { visibleGridLevels, gridTransientScopeSignature, reconcileGridTransientState, objectSelectionStatus } from './grid-core.js';
|
|
@@ -940,42 +940,13 @@ function lengthAxisOf(el) {
|
|
|
940
940
|
// finish across the nut's short axis instead of along its sweep.
|
|
941
941
|
if (kind === 'rod' || kind === 'bolt-shank' || kind === 'anchor' || kind === 'nut') return 'y'; // CylinderGeometry
|
|
942
942
|
if (kind === 'plate' || kind === 'washer' || kind === 'bolt-head') return 'z';
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
const explicit = (el.section && el.section.shape || '').toString().toUpperCase().trim();
|
|
949
|
-
if (/^(I|C|L|TUBE|BOX|ROUND)$/.test(explicit)) return explicit; // explicit section.shape override wins
|
|
950
|
-
// A ROUND section cannot be told from its designation here: `sectionKindOf` matches a literal prefix and
|
|
951
|
-
// answers TUBE for both `HSS6X6X3/8` (rectangular) and `HSS6.625X0.280` (round). The bake parses the
|
|
952
|
-
// numerics and says so on `section.round` — without it a pipe drew as a rectangle whose corner reaches
|
|
953
|
-
// 0.707·OD, putting a rolled pipe's flush face 23.7 mm off its reference line.
|
|
954
|
-
if (el.section && el.section.round === true) return 'ROUND';
|
|
955
|
-
// The designation itself goes to the shared classifier (steel-3d-core.js), which the 2D plan outline
|
|
956
|
-
// and the base-plate weld also use. The copy that lived here drew MC channels as I-sections (#647).
|
|
957
|
-
return sectionKindOf((el.meta && el.meta.profile) || '');
|
|
958
|
-
}
|
|
959
|
-
// A real thickness off the element's `xsection` (AISC table / designation) when there is one and it fits
|
|
960
|
-
// inside the section, else null so the caller keeps its estimate. The fit check matters: a metric
|
|
961
|
-
// designation's thickness token is parsed as inches, which would draw a leg thicker than the whole angle.
|
|
962
|
-
function realThk(xs, key, half) {
|
|
963
|
-
const t = xs && typeof xs[key] === 'number' ? xs[key] : null;
|
|
964
|
-
return t != null && t > 0 && t < 2 * half ? t : null;
|
|
965
|
-
}
|
|
966
|
-
// `xs` is the scene element's `xsection`. Without it every thickness here is a GUESS off the envelope —
|
|
967
|
-
// an L4X4 leg came out 18.3mm against a real 9.5, so a connection bearing on the real face rendered buried
|
|
968
|
-
// in a member that was drawn nearly twice too thick. The estimates remain as the fallback for sections we
|
|
969
|
-
// have no data for; they are the reason a member can still be drawn at all.
|
|
943
|
+
return !memberExtrudes(el) ? 'y' : 'z'; // Box vs Extrude
|
|
944
|
+
}
|
|
945
|
+
// The section kind and topology are steel-3d-core.js's (`memberShapeKind`, `memberSectionTopology`), shared
|
|
946
|
+
// with the Page .glb exporter so a shared 3D file draws every member as this view does.
|
|
947
|
+
const shapeOf = memberShapeKind;
|
|
970
948
|
function profileShape(kind, w, d, xs, displaySection) {
|
|
971
|
-
const
|
|
972
|
-
...(xs.shape === 'i' ? { shape: 'i', d: xs.d, bf: xs.bf, tw: realThk(xs, 'tw', w / 2), tf: realThk(xs, 'tf', d / 2) } : {}),
|
|
973
|
-
...(xs.shape === 'channel' ? { shape: 'channel', d: xs.d, bf: xs.bf, tw: realThk(xs, 'tw', w / 2), tf: realThk(xs, 'tf', d / 2) } : {}),
|
|
974
|
-
...(xs.shape === 'angle' ? { shape: 'angle', d: xs.d, b: xs.b, t: realThk(xs, 't', Math.min(w, d) / 2) } : {}),
|
|
975
|
-
...(xs.shape === 'rhs' ? { shape: 'rhs', d: xs.d, b: xs.b, t: realThk(xs, 't', Math.min(w, d) / 2) } : {}),
|
|
976
|
-
...(xs.shape === 'chs' ? { shape: 'chs', od: xs.od, t: realThk(xs, 't', Math.min(w, d) / 2) } : {}),
|
|
977
|
-
} : null;
|
|
978
|
-
const topology = sectionTopology(displaySection || fallback, w, d, kind);
|
|
949
|
+
const topology = memberSectionTopology(kind, w, d, xs, displaySection);
|
|
979
950
|
const trace = (path, descriptor) => {
|
|
980
951
|
if (descriptor.kind === 'circle') { path.absarc(descriptor.cx, descriptor.cy, descriptor.radius, 0, Math.PI * 2, false); return; }
|
|
981
952
|
descriptor.points.forEach(([x, y], i) => (i ? path.lineTo(x, y) : path.moveTo(x, y))); path.closePath();
|
|
@@ -989,8 +960,7 @@ function profileShape(kind, w, d, xs, displaySection) {
|
|
|
989
960
|
function memberGeom(el, w, d, len) {
|
|
990
961
|
const kind = shapeOf(el);
|
|
991
962
|
const display = el?.meta?.displaySection;
|
|
992
|
-
|
|
993
|
-
if (kind === 'BOX' && !displayExtrudes) return new THREE.BoxGeometry(w, len, d); // length on local Y
|
|
963
|
+
if (!memberExtrudes(el)) return new THREE.BoxGeometry(w, len, d); // length on local Y
|
|
994
964
|
const shapes = profileShape(kind, w, d, el && el.xsection, display);
|
|
995
965
|
const g = new THREE.ExtrudeGeometry(shapes, { depth: len, bevelEnabled: false, curveSegments: 32 });
|
|
996
966
|
g.translate(0, 0, -len / 2); return g; // extruded +Z, centred
|