@floless/app 0.111.3 → 0.112.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 +896 -60
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +25 -9
- package/dist/skills/reading-structural-drawings/SKILL.md +11 -1
- package/dist/web/app.css +65 -0
- package/dist/web/aware.js +1 -1
- package/dist/web/index.html +32 -0
- package/dist/web/steel-3d-view.js +87 -11
- package/dist/web/steel-editor.html +78 -13
- package/dist/web/workspaces.js +777 -3
- package/package.json +1 -1
|
@@ -55,7 +55,7 @@ each learned from a real failure:
|
|
|
55
55
|
mark / grid) or as **per-column size tags at each base**. That sheet is the biggest candidate; make
|
|
56
56
|
reading it for column sizes a REQUIRED step, not an afterthought. (Designers occasionally put the
|
|
57
57
|
schedule elsewhere — a general/schedule sheet, or sections/details through the column, or a general
|
|
58
|
-
note like "ALL COLS
|
|
58
|
+
note like "ALL COLS HSS6X6X3/8 UON" — so if the foundation plan doesn't have it, keep looking there.)
|
|
59
59
|
Match each plan column to its size by **grid mark** (+ story). Only when the size is genuinely
|
|
60
60
|
nowhere in the entire set — foundation plan checked FIRST — does the column stay `rfi:true`.
|
|
61
61
|
- **Column ROTATION (`rot`) is MANDATORY — and derive it from the FLANGE-SEGMENT INK, not the bounding
|
|
@@ -264,18 +264,27 @@ native/display coords):
|
|
|
264
264
|
**On a `steel.model/v2` model it takes less — `filter` plus per-sheet `{ datum_at, datum_ref,
|
|
265
265
|
control2_at, control2_ref, elevation_in }`, and no grid or datum at all.** Check the `type` in the
|
|
266
266
|
document you just GET-ed. A v2 model keeps ONE grid for the whole model instead of one per sheet, and
|
|
267
|
-
that grid is not writable from
|
|
268
|
-
|
|
267
|
+
that grid is not writable from THIS verb: the human moves it in the editor's Grid panel, and a
|
|
268
|
+
re-read proposes a move through its own contract (§1c). Sending a
|
|
269
|
+
`grid` or a `datum` HERE earns a `400` that says so. So on v2: **skip §1c's pre-read part, and in §1d skip only
|
|
269
270
|
the root `datum` block — the per-sheet registration in §1d is still yours to write**, and a migrated
|
|
270
271
|
model usually has none of it yet. Everything else in this section is unchanged.
|
|
271
272
|
|
|
272
273
|
### 1c. Grid lines — read the printed grid (quick, per sheet)
|
|
273
274
|
|
|
274
|
-
> **`steel.model/v2` models: SKIP this section
|
|
275
|
-
>
|
|
276
|
-
>
|
|
277
|
-
>
|
|
278
|
-
> so
|
|
275
|
+
> **`steel.model/v2` models: SKIP this section for the PRE-READ pass — but carry the grid in the
|
|
276
|
+
> contract you re-read.** Two different endpoints, and the difference matters:
|
|
277
|
+
>
|
|
278
|
+
> - **The pre-read verb (`/steel-prepass`) still refuses a grid.** A v2 model keeps ONE grid for the
|
|
279
|
+
> whole model, so there is no per-sheet `grid` to send. You will get a `400` saying so.
|
|
280
|
+
> - **The re-read contract (`POST /revision-read`) carries the model grid, at the root, as `grid`.**
|
|
281
|
+
> Copy the CURRENT model's `grid` through unchanged — do not drop the key. If the revised set
|
|
282
|
+
> genuinely shows the printed grid in a new place, write the new grid there instead: it is staged as
|
|
283
|
+
> a **proposal the user accepts** in the review, never a silent write.
|
|
284
|
+
>
|
|
285
|
+
> **Never omit `grid` to mean "I did not change it".** Omitting a key is not how you say that — copy
|
|
286
|
+
> it through. (A read that drops it is refused and reported, precisely so an omission can never be
|
|
287
|
+
> mistaken for "delete the model grid".) Removing the grid is a human edit in the editor, not a read.
|
|
279
288
|
|
|
280
289
|
With the filter elements in hand, populate each plan's **`plan.grid`** (Tekla-style grid lines the
|
|
281
290
|
editor renders in 2D + 3D and snaps to). The geometry is deterministic — the editor's Grid panel has
|
|
@@ -307,7 +316,8 @@ Skip silently only when the sheet genuinely has no grid bubbles (rare for framin
|
|
|
307
316
|
|
|
308
317
|
> **`steel.model/v2` models: the root `datum` part is SKIPPED, the per-sheet part is not.** A v2 model
|
|
309
318
|
> has no root `datum`: the "which intersection is 0,0,0" question was answered when the model was
|
|
310
|
-
> migrated, and the answer lives in the model grid's origin, which
|
|
319
|
+
> migrated, and the answer lives in the model grid's origin, which the pre-read verb may not move (a
|
|
320
|
+
> re-read may PROPOSE a new grid — see §1c). **The per-sheet
|
|
311
321
|
> registration below is still yours to write** — `datum_at`, `datum_ref`, `control2_at`, `control2_ref`
|
|
312
322
|
> — because those say something different: where that already-chosen origin falls on THIS sheet. A
|
|
313
323
|
> migrated model usually has none of them yet, so this is real work, not a no-op. Send them under
|
|
@@ -1128,6 +1138,12 @@ their `id`, scoped per `sheet`. So the re-read must keep identity stable:
|
|
|
1128
1138
|
3. Then compose the updated `steel.takeoff/v1` and `POST /api/projects/<projectId>/revision-read
|
|
1129
1139
|
{ contract, message, requestId }` (that POST clears the request — do **not** DELETE it).
|
|
1130
1140
|
|
|
1141
|
+
> **On a `steel.model/v2` project compose a `steel.model/v2` document instead** — check the `type`
|
|
1142
|
+
> of the contract you GET-ed in step 1. Members live in one root `members[]` in world millimetres,
|
|
1143
|
+
> and the root **`grid` comes across unchanged** unless the revised set shows the printed grid in a
|
|
1144
|
+
> new place, in which case write the new one and it becomes a proposal the user accepts (§1c).
|
|
1145
|
+
> Never drop the `grid` key to mean "unchanged" — a read that omits it is refused.
|
|
1146
|
+
|
|
1131
1147
|
If you renumber everything, the diff shows a misleading "all removed + all added" and the app warns
|
|
1132
1148
|
**"identity not preserved."** Carrying ids forward is what makes *"beam B12 was upsized"* come out
|
|
1133
1149
|
exact instead of a churn of the whole model.
|
|
@@ -265,7 +265,15 @@ any external count.
|
|
|
265
265
|
label ~20 px.
|
|
266
266
|
- Place each member by the **grid lines it spans** + its level. Read its size label; **confirm size
|
|
267
267
|
against the schedule** (column schedule = authoritative per tier/splice; beam schedule maps marks).
|
|
268
|
-
Map
|
|
268
|
+
Map W18X35 = wide-flange, 18" nominal depth, 35 lb/ft, etc.
|
|
269
|
+
- **Transcribe the designation as ASCII.** Drawing text and OCR routinely emit typographic
|
|
270
|
+
lookalikes — the multiplication sign in place of `X`, en/em dashes for the hyphen, primes for
|
|
271
|
+
inch marks, non-breaking spaces, Cyrillic characters that render identically. Downstream
|
|
272
|
+
lookups match the literal string, so ONE lookalike turns a known section into an unknown one:
|
|
273
|
+
no real dimensions, a placeholder solid in 3D/IFC/the host model, and a size that still reads
|
|
274
|
+
correct to a human on screen. Fold to ASCII at the point of extraction, then confirm the
|
|
275
|
+
normalised designation actually resolves against the section table — a designation that "looks
|
|
276
|
+
right" is not evidence it matched.
|
|
269
277
|
- **Use a structured schema that enforces the order** (vision agent or your own): fill
|
|
270
278
|
`coordinate_system → buildings(+roof) → grids_per_building → members`, every value carrying
|
|
271
279
|
`source_view`, `evidence_bbox`, `confidence`, plus mandatory `unreadable[]` and `contradictions[]`.
|
|
@@ -302,6 +310,8 @@ Only then build the scene / overlay / IFC. If unsure, present the **massing + gr
|
|
|
302
310
|
- [ ] A member spanning two levels emitted on both plans (doubles the tonnage).
|
|
303
311
|
- [ ] A size left as an RFI when the set does show it — a lazy RFI is as wrong as a fabricated number.
|
|
304
312
|
- [ ] A built-up shape (double angle, etc.) taken off as its single component (half the steel).
|
|
313
|
+
- [ ] A designation carrying a typographic lookalike (multiplication sign for `X`, en-dash for `-`,
|
|
314
|
+
prime for `"`) — it renders correctly and silently fails every downstream size lookup.
|
|
305
315
|
- [ ] Vector coordinates compared against a render without applying the page rotation — silently transposed
|
|
306
316
|
at 90/270, silently point-reflected at 180 (where the page shape gives no hint at all).
|
|
307
317
|
- [ ] Sheets identified by extracting text, on a set whose text layer is boilerplate only.
|
package/dist/web/app.css
CHANGED
|
@@ -4009,6 +4009,71 @@ table.hist tr.current td { background:var(--accent-soft); }
|
|
|
4009
4009
|
.rev-issue:last-child { border-bottom:none; }
|
|
4010
4010
|
.rev-issue-path { font-family:var(--mono); font-size:10.5px; color:var(--text-dim); display:block; margin-top:2px; }
|
|
4011
4011
|
|
|
4012
|
+
/* ── Convert to the model (steel.takeoff/v1 → steel.model/v2, unit 5, P7e) ────────────────────────
|
|
4013
|
+
`.migreview` rides on `.modal.revreview` and adds only the genuine deltas. Everything visual — the
|
|
4014
|
+
width, the themed inner scrollbar, the rows, the custom checkboxes at .rev-check — is inherited, so
|
|
4015
|
+
there is no second vocabulary to keep in step. */
|
|
4016
|
+
|
|
4017
|
+
/* The offer banner. Reuses `.ws-exports-gate` wholesale (neutral accent-dim rail, never --warn/--err:
|
|
4018
|
+
an older format is not an error) and only re-homes it, since it sits in the project column rather
|
|
4019
|
+
than the exports pane. */
|
|
4020
|
+
.ws-migrate-gate { margin:12px 20px 0; }
|
|
4021
|
+
/* `[hidden]` DOES NOTHING WITHOUT THIS, and the banner was visible on every project as a result.
|
|
4022
|
+
`.ws-exports-gate` sets `display:flex`, an author-origin rule that beats the UA's
|
|
4023
|
+
`[hidden] { display:none }` — and this stylesheet has no global `[hidden]` rule, only per-class ones
|
|
4024
|
+
(`.ws-drawings-bar[hidden]`, `.ws-revision-card[hidden]`, the `!important` list at :3551). Without it
|
|
4025
|
+
every `$migGate.hidden = true` was a no-op: an empty bordered strip painted under the step tabs for
|
|
4026
|
+
EVERY workspace project, a v1 project's banner followed the user onto Drawings and History, and it
|
|
4027
|
+
survived a successful conversion still offering to convert. Caught by review measuring computed
|
|
4028
|
+
`display`; the browser pass asserted the `hidden` PROPERTY, which was true the whole time. */
|
|
4029
|
+
.ws-migrate-gate[hidden] { display:none; }
|
|
4030
|
+
|
|
4031
|
+
/* AN UNTICKED BOX INSIDE A ROW WAS INVISIBLE, and this is a contrast fix, not a restyle.
|
|
4032
|
+
`.rev-check input` sets `border: var(--border-strong)` on `background: var(--surface-2)` — and those
|
|
4033
|
+
two tokens are THE SAME COLOUR (both hsl(217.2 32.6% 17.5%)). On `.modal-check` that is harmless,
|
|
4034
|
+
because the fork-consent checkbox sits on the darker modal surface where the fill itself reads as the
|
|
4035
|
+
box. Inside `.rev-row`, whose background is ALSO --surface-2, all three match: measured
|
|
4036
|
+
rgb(30,41,59) for the row, the fill and the border alike. The result is a 16×16 invisible square that
|
|
4037
|
+
only appears once focused.
|
|
4038
|
+
Pre-existing and shared with the revision-review modal, so this fixes that surface too — scoped to
|
|
4039
|
+
the row context, which is the only place the collision happens, rather than restyling every consent
|
|
4040
|
+
checkbox in the app. Found by measuring computed styles in the browser pass; a screenshot alone
|
|
4041
|
+
showed "a row with no checkbox" and could not say why. */
|
|
4042
|
+
.rev-row .rev-check input[type="checkbox"] { border-color: var(--text-dim); }
|
|
4043
|
+
.rev-row .rev-check input[type="checkbox"]:hover { border-color: var(--text-muted); }
|
|
4044
|
+
.rev-row .rev-check input[type="checkbox"]:checked { border-color: var(--accent); }
|
|
4045
|
+
|
|
4046
|
+
/* The kind heading — the OUTER grouping axis, above the topic groups. Load-bearing rather than
|
|
4047
|
+
decorative: a topic can carry decisions of both kinds ("Saved views" does), so without this the same
|
|
4048
|
+
title appears twice, one block with a bulk control and one without, and nothing says why. */
|
|
4049
|
+
.mig-section { display:flex; align-items:baseline; gap:8px; flex-wrap:wrap;
|
|
4050
|
+
margin:14px 0 6px; padding-bottom:5px; border-bottom:1px solid var(--border); }
|
|
4051
|
+
.mig-section:first-child { margin-top:2px; }
|
|
4052
|
+
.mig-section-title { font-size:12px; font-weight:600; color:var(--text); letter-spacing:0.01em; }
|
|
4053
|
+
.mig-section-sub { font-size:11px; color:var(--text-dim); }
|
|
4054
|
+
|
|
4055
|
+
/* The tick progress, distinct from `.rev-counts` above the body: that line says what you GET, this one
|
|
4056
|
+
says what is LEFT. Sits tight to the actions it gates, and right-aligned so the eye finds it on the
|
|
4057
|
+
way to the button rather than having to come back up the modal. */
|
|
4058
|
+
.mig-progress { margin:2px 0 8px; text-align:right; }
|
|
4059
|
+
.mig-progress[hidden] { display:none; }
|
|
4060
|
+
|
|
4061
|
+
/* Confirm while anything is unticked. `aria-disabled`, NEVER the `disabled` attribute — the same
|
|
4062
|
+
recipe `.kb-organize` and `.ecard .e-act` use, and for the same reason: a disabled button is neither
|
|
4063
|
+
hoverable nor focusable, so the `data-tip` saying WHY it will not go would never reach the person who
|
|
4064
|
+
needs it. Reads as inert to assistive tech; `confirmMigrate` checks the same attribute, so the gate
|
|
4065
|
+
is behaviour rather than styling. */
|
|
4066
|
+
.migreview .modal-actions button.primary[aria-disabled="true"] {
|
|
4067
|
+
opacity:0.55; cursor:default;
|
|
4068
|
+
background:var(--surface-2); border-color:var(--border-strong); color:var(--text-dim);
|
|
4069
|
+
}
|
|
4070
|
+
.migreview .modal-actions button.primary[aria-disabled="true"]:hover {
|
|
4071
|
+
background:var(--surface-2); border-color:var(--border-strong); color:var(--text-dim);
|
|
4072
|
+
}
|
|
4073
|
+
/* A REFUSED conversion renders no Confirm at all, so the attribute has to actually take: `.modal-actions
|
|
4074
|
+
button` sets a display, which beats the UA's `[hidden]` rule on its own. */
|
|
4075
|
+
.migreview .modal-actions button[hidden] { display:none; }
|
|
4076
|
+
|
|
4012
4077
|
/* ── Workspaces: revision re-read (Slice 4b) — attach band + pending/failed card ── */
|
|
4013
4078
|
.ws-drawings-bar { flex:none; display:flex; align-items:center; gap:10px; padding:8px 14px; border-bottom:1px solid var(--border); background:var(--surface); }
|
|
4014
4079
|
.ws-drawings-bar[hidden] { display:none !important; }
|
package/dist/web/aware.js
CHANGED
|
@@ -5921,7 +5921,7 @@
|
|
|
5921
5921
|
// fabricated elevation silently relocates steel; and what each SHEET showed is recorded as
|
|
5922
5922
|
// evidence on that plan's `memberObservations` instead of by owning the member.
|
|
5923
5923
|
if (req.contractType === 'steel.model/v2') {
|
|
5924
|
-
return `In floless project "${req.project}" (app "${req.appId}"), a REVISED drawing set was attached — re-read it into the SAME project as a new version (do NOT create a new project). This project holds a steel.model/v2 model, so compose a steel.model/v2 document, NOT a steel.takeoff/v1: members live in ONE root \`members[]\` array in WORLD MILLIMETRES (each with \`from\`/\`to\` as { x, y, z }), not per sheet in display pixels. Member ids are MODEL-GLOBAL — preserve the id of every member the revision still shows and mint a new one only for a genuinely new member; there is no sheet label to preserve alongside it. Where the drawing does not give an elevation, write \`{ unknown: true }\` for that z — never a substituted default, because a fabricated elevation moves steel. Record what each SHEET actually showed as evidence on that plan's \`memberObservations\` (with its \`binding.memberIds\`), and use \`plans[].memberRefs\` for members a sheet displays but never observed. Follow the floless-app-steel-takeoff skill's mandatory two-phase gate exactly as for v1: FIRST GET /api/contract/${req.appId}?project=${req.project} to read the CURRENT model and KEEP its ETag, do the deterministic PyMuPDF steel-filter pass only, send ONLY the pre-read blocks to PUT /api/projects/${req.project}/steel-prepass with { filter } and If-Match: <that ETag> — never the whole contract — then STOP and tell me to open Drawings → Steel Filter, review the facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. ${post}${snaps}${note}`;
|
|
5924
|
+
return `In floless project "${req.project}" (app "${req.appId}"), a REVISED drawing set was attached — re-read it into the SAME project as a new version (do NOT create a new project). This project holds a steel.model/v2 model, so compose a steel.model/v2 document, NOT a steel.takeoff/v1: members live in ONE root \`members[]\` array in WORLD MILLIMETRES (each with \`from\`/\`to\` as { x, y, z }), not per sheet in display pixels. Member ids are MODEL-GLOBAL — preserve the id of every member the revision still shows and mint a new one only for a genuinely new member; there is no sheet label to preserve alongside it. Where the drawing does not give an elevation, write \`{ unknown: true }\` for that z — never a substituted default, because a fabricated elevation moves steel. Record what each SHEET actually showed as evidence on that plan's \`memberObservations\` (with its \`binding.memberIds\`), and use \`plans[].memberRefs\` for members a sheet displays but never observed. COPY THE CURRENT MODEL'S ROOT \`grid\` THROUGH UNCHANGED into the document you post to /revision-read — never omit the key, because omitting it is not how you say "unchanged" and a read that drops it is refused. If the revised set genuinely shows the printed grid in a NEW place, write the new grid there instead: it is staged as a proposal the user accepts in the review, never a silent write. (The pre-read verb below still refuses a grid — that is a different endpoint.) Follow the floless-app-steel-takeoff skill's mandatory two-phase gate exactly as for v1: FIRST GET /api/contract/${req.appId}?project=${req.project} to read the CURRENT model and KEEP its ETag, do the deterministic PyMuPDF steel-filter pass only, send ONLY the pre-read blocks to PUT /api/projects/${req.project}/steel-prepass with { filter } and If-Match: <that ETag> — never the whole contract — then STOP and tell me to open Drawings → Steel Filter, review the facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. ${post}${snaps}${note}`;
|
|
5925
5925
|
}
|
|
5926
5926
|
if (isInitialRead) {
|
|
5927
5927
|
return `In floless project "${req.project}" (app "${req.appId}"), an initial drawing set was attached — read it into this project as its first steel model version (do NOT create a new project). Follow the floless-app-steel-takeoff skill's mandatory two-phase gate. FIRST, GET /api/contract/${req.appId}?project=${req.project} and KEEP its ETag response header. A 404 "no contract for this app yet" here is NORMAL and not an error — a project created by dropping a drawing starts empty; it simply means this is the create case, so you will send If-None-Match: * instead of an ETag. (A project seeded from an existing model does return a contract and an ETag.) Then do the deterministic PyMuPDF steel-filter pass only: identify the framing-plan sheets, enumerate the drawing elements by layer/thickness/color into contract.filter.sheets/facets, write it back — if that GET returned NO contract this is the create case, so PUT the whole document to /api/contract/${req.appId}?project=${req.project} with If-None-Match: * ; if it DID return one, send only the pre-read blocks to PUT /api/projects/${req.project}/steel-prepass with { filter } and If-Match: <that ETag>. The prepass verb takes filter, datum and per-sheet { grid, datum_at, datum_ref, control2_at, control2_ref, elevation_in } and REFUSES members, connections and joints by name, so it cannot replace the model you are about to read. Either write is refused with 428 if it carries no precondition, and If-Match must be the exact ETag — If-Match: * is refused, because this verb patches the document you read. On 412 re-GET, re-apply your changes to the new document, and retry rather than repeating the same body. Then STOP and tell me to open Drawings → Steel Filter, review/narrow the steel facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. AFTER that saved-filter checkpoint, read members from the saved filter selection and compose the steel.takeoff/v1 contract. ${post}${snaps}${note}`;
|
package/dist/web/index.html
CHANGED
|
@@ -193,6 +193,12 @@
|
|
|
193
193
|
<input type="file" id="ws-revision-file" accept=".pdf,image/*" multiple hidden>
|
|
194
194
|
</div>
|
|
195
195
|
<div class="ws-revision-card" id="ws-revision-card" hidden></div>
|
|
196
|
+
<!-- The v1 → v2 conversion offer (unit 5, P7e). A thin NEUTRAL gate-banner, the same register
|
|
197
|
+
.ws-exports-gate and .hist-working use for "there is a forward step you have not taken" —
|
|
198
|
+
deliberately not a card like #ws-revision-card above: that one is Drawings-scoped and
|
|
199
|
+
revision-shaped, and borrowing its weight for a one-time act would both misstate the
|
|
200
|
+
frequency and compete with an actual pending read on the same project. Model-step only. -->
|
|
201
|
+
<div class="ws-exports-gate ws-migrate-gate" id="ws-migrate-gate" hidden></div>
|
|
196
202
|
<!-- Two lazily-srced iframes so switching steps never reloads the editor's 3D state.
|
|
197
203
|
Same-origin like #contract-editor-frame (they call /api/contract directly). -->
|
|
198
204
|
<iframe id="ws-frame-model" class="ws-frame" title="Project model editor" hidden></iframe>
|
|
@@ -576,6 +582,32 @@
|
|
|
576
582
|
</div>
|
|
577
583
|
</div>
|
|
578
584
|
|
|
585
|
+
<!-- Convert to the model (steel.takeoff/v1 → steel.model/v2, unit 5, P7e).
|
|
586
|
+
A SEPARATE element from #revreview-modal rather than a reuse of it: the two have different
|
|
587
|
+
titles, different sub-copy and materially different Confirm semantics — that one applies a
|
|
588
|
+
SELECTION and is legitimately clickable with nothing ticked, this one is all-or-nothing. Sharing
|
|
589
|
+
the element would mean one Confirm handler with two meanings. It carries `revreview` so it
|
|
590
|
+
inherits the whole .rev-* vocabulary (width, scroll, rows, themed checkboxes) for free, and
|
|
591
|
+
`migreview` carries only the genuine deltas. -->
|
|
592
|
+
<div class="modal-backdrop" id="migrate-modal" role="dialog" aria-modal="true" aria-labelledby="migrate-title">
|
|
593
|
+
<div class="modal revreview migreview">
|
|
594
|
+
<div class="modal-title" id="migrate-title">Convert to the 3D model</div>
|
|
595
|
+
<div class="modal-sub" id="migrate-sub"></div>
|
|
596
|
+
<div class="rev-changed" id="migrate-changed" role="status" aria-live="polite" hidden></div>
|
|
597
|
+
<div class="rev-counts" id="migrate-counts"></div>
|
|
598
|
+
<div class="revreview-body" id="migrate-body"></div>
|
|
599
|
+
<!-- The tick progress, separate from the counts line above it: that one says what you GET, this
|
|
600
|
+
one says what is left to do. Live region so the count reaches a screen reader as it moves. -->
|
|
601
|
+
<div class="rev-counts mig-progress" id="migrate-progress" role="status" aria-live="polite" hidden></div>
|
|
602
|
+
<div class="modal-actions">
|
|
603
|
+
<button id="migrate-cancel">Cancel</button>
|
|
604
|
+
<!-- Hidden outright when the conversion is refused, never shown disabled: a blocked migration
|
|
605
|
+
is not something you can tick past, so an inert primary button would be an invitation. -->
|
|
606
|
+
<button id="migrate-confirm" class="primary">Convert</button>
|
|
607
|
+
</div>
|
|
608
|
+
</div>
|
|
609
|
+
</div>
|
|
610
|
+
|
|
579
611
|
<!-- Save-on-switch confirmation — shown when switching workflows with unsaved
|
|
580
612
|
input changes. Reuses the shared modal styling; no new backdrop look. -->
|
|
581
613
|
<div class="modal-backdrop" id="confirm-modal">
|
|
@@ -124,7 +124,7 @@ function candOnActiveWP(c, dragged, wp) {
|
|
|
124
124
|
return candidateOnPlane(c, dragged, wp.origin, wp.normal, WP_SNAP_TOL_MM);
|
|
125
125
|
}
|
|
126
126
|
let rightDownXY = null, rightMoved = false; // right button: dragged (= orbit/pan, no menu) vs clicked (= snap menu)
|
|
127
|
-
let teklaDrag = null; // Ctrl+Shift drag-out to
|
|
127
|
+
let teklaDrag = null; // Ctrl+Shift drag-out to a CAD host: { ids, stack, target } from the moment the gesture is armed until release
|
|
128
128
|
const dimLock = new Set(); // locked MEASURE axes (subset of x|y|z); empty = Free/aligned. Toggle+combine like Move/Copy's tfLock (measures along the resolved/dominant axis; the 2nd point still free-snaps).
|
|
129
129
|
let dims3dVisibleFlag = true; // show/hide placed dims
|
|
130
130
|
let dimDraft3d = null; // { a:[x,y,z] } once the first point is placed (awaiting the 2nd)
|
|
@@ -3743,12 +3743,25 @@ function onDown(e) {
|
|
|
3743
3743
|
// to the Ctrl-copy this modifier combination would otherwise mean, quietly duplicating members
|
|
3744
3744
|
// in the draft), it simply never becomes a drag-out.
|
|
3745
3745
|
if (ids.length) {
|
|
3746
|
-
teklaDrag = { ids, active: false, blocked: !!(api.teklaSendBusy && api.teklaSendBusy()) };
|
|
3747
|
-
// Capture the pointer so move/up keep arriving once the cursor is over
|
|
3748
|
-
// the whole gesture. (A native HTML5 drag would carry an image over other windows,
|
|
3749
|
-
// then paints its own "no drop here" cursor the entire way, because
|
|
3750
|
-
// data — it looks like a refusal while the send actually works.)
|
|
3746
|
+
teklaDrag = { ids, active: false, blocked: !!(api.teklaSendBusy && api.teklaSendBusy()), stack: null, running: [], target: null };
|
|
3747
|
+
// Capture the pointer so move/up keep arriving once the cursor is over the other app — that
|
|
3748
|
+
// stream is the whole gesture. (A native HTML5 drag would carry an image over other windows,
|
|
3749
|
+
// but the OS then paints its own "no drop here" cursor the entire way, because a CAD host
|
|
3750
|
+
// never accepts the data — it looks like a refusal while the send actually works.)
|
|
3751
3751
|
try { canvasEl.setPointerCapture(e.pointerId); teklaDrag.pointerId = e.pointerId; } catch { /* capture is an optimisation; window-level listeners still fire */ }
|
|
3752
|
+
// Snapshot where the CAD windows are, ONCE, so the badge can name what the cursor is over
|
|
3753
|
+
// without a round-trip per pointer-move (a live probe costs ~350ms). Advisory only: the
|
|
3754
|
+
// release re-resolves authoritatively, so a stale snapshot can mislabel the badge for an
|
|
3755
|
+
// instant but can never send members to the wrong application. Fire-and-forget — if it never
|
|
3756
|
+
// arrives the badge simply stays unnamed and the drop still works.
|
|
3757
|
+
const claimed = teklaDrag;
|
|
3758
|
+
if (api.hostWindows) {
|
|
3759
|
+
api.hostWindows().then((snap) => {
|
|
3760
|
+
if (teklaDrag !== claimed) return; // the gesture ended before the answer came back
|
|
3761
|
+
claimed.stack = Array.isArray(snap && snap.stack) ? snap.stack : [];
|
|
3762
|
+
claimed.running = Array.isArray(snap && snap.running) ? snap.running : [];
|
|
3763
|
+
}).catch(() => { /* no snapshot: the badge stays unnamed, the drop is unaffected */ });
|
|
3764
|
+
}
|
|
3752
3765
|
}
|
|
3753
3766
|
}
|
|
3754
3767
|
pending = {
|
|
@@ -3775,6 +3788,46 @@ function onDown(e) {
|
|
|
3775
3788
|
// keeps move/up flowing while the cursor is over Tekla, leaves the cursor alone, and makes Esc a real
|
|
3776
3789
|
// cancel (during a native drag the page never sees the key).
|
|
3777
3790
|
|
|
3791
|
+
/** Short display names for the drop targets. The badge has no room for "Tekla Structures". */
|
|
3792
|
+
const HOST_SHORT = { tekla: 'Tekla', revit: 'Revit', sketchup: 'SketchUp' };
|
|
3793
|
+
|
|
3794
|
+
/**
|
|
3795
|
+
* Which host is under this screen point, per the snapshot taken at dragstart?
|
|
3796
|
+
*
|
|
3797
|
+
* The topmost window containing the point decides, host or not — non-host windows are in the stack
|
|
3798
|
+
* precisely so an app sitting over Revit reads as "not Revit" rather than being ignored. Browser
|
|
3799
|
+
* screen coordinates are CSS pixels; the snapshot is in physical pixels, so they are scaled by the
|
|
3800
|
+
* device pixel ratio before comparison or the hit lands off by the display scale factor.
|
|
3801
|
+
*/
|
|
3802
|
+
function hostUnderPointer(drag, e) {
|
|
3803
|
+
if (!drag || !Array.isArray(drag.stack) || !drag.stack.length) return null;
|
|
3804
|
+
const dpr = window.devicePixelRatio || 1;
|
|
3805
|
+
const x = e.screenX * dpr, y = e.screenY * dpr;
|
|
3806
|
+
for (const w of drag.stack) {
|
|
3807
|
+
if (x >= w.left && x < w.right && y >= w.top && y < w.bottom) return w.host || null;
|
|
3808
|
+
}
|
|
3809
|
+
return null;
|
|
3810
|
+
}
|
|
3811
|
+
|
|
3812
|
+
/**
|
|
3813
|
+
* Keep the badge's words in step with what the cursor is actually over.
|
|
3814
|
+
*
|
|
3815
|
+
* A named target reads "3 members → Revit", so the promise is specific before the user commits.
|
|
3816
|
+
* Over something we do not recognise the badge must NOT name a host it is not going to reach — it
|
|
3817
|
+
* says where to go instead. Only the text node is rewritten, so the brand glyph is never rebuilt.
|
|
3818
|
+
*/
|
|
3819
|
+
function paintDragBadge(drag) {
|
|
3820
|
+
if (!drag || !drag.badge) return;
|
|
3821
|
+
const n = drag.ids.length, noun = n === 1 ? 'member' : 'members';
|
|
3822
|
+
const label = drag.target ? HOST_SHORT[drag.target] : null;
|
|
3823
|
+
// With no recognised target the arrow is DROPPED rather than pointed at a guess: the badge is
|
|
3824
|
+
// decorative (it clips at the window edge anyway), and the status chip below carries the sentence
|
|
3825
|
+
// that actually teaches where to go. A badge promising a destination it cannot reach is worse
|
|
3826
|
+
// than a badge that just counts.
|
|
3827
|
+
const node = drag.badge.lastChild;
|
|
3828
|
+
if (node && node.nodeType === 3) node.nodeValue = label ? `${n} ${noun} → ${label}` : `${n} ${noun}`;
|
|
3829
|
+
}
|
|
3830
|
+
|
|
3778
3831
|
/** The badge that follows the cursor while a drag-out is live (same recipe as the legend's drag ghost). */
|
|
3779
3832
|
function teklaBadge(n) {
|
|
3780
3833
|
const el = document.createElement('div');
|
|
@@ -3782,7 +3835,7 @@ function teklaBadge(n) {
|
|
|
3782
3835
|
el.innerHTML = '<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true" focusable="false">'
|
|
3783
3836
|
+ '<path d="M9.5 2.5H13.5V6.5M13.5 2.5 8 8M11 9.5V12a1.5 1.5 0 0 1-1.5 1.5h-6A1.5 1.5 0 0 1 2 12V6a1.5 1.5 0 0 1 1.5-1.5H6"'
|
|
3784
3837
|
+ ' fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
3785
|
-
el.append(document.createTextNode(`${n} ${n === 1 ? 'member' : 'members'}
|
|
3838
|
+
el.append(document.createTextNode(`${n} ${n === 1 ? 'member' : 'members'}`)); // paintDragBadge names the target
|
|
3786
3839
|
document.body.appendChild(el);
|
|
3787
3840
|
return el;
|
|
3788
3841
|
}
|
|
@@ -3837,7 +3890,14 @@ function onTeklaDragMove(e) {
|
|
|
3837
3890
|
// the message from there.
|
|
3838
3891
|
teklaDrag.badge.style.left = (e.clientX + 16) + 'px';
|
|
3839
3892
|
teklaDrag.badge.style.top = (e.clientY + 14) + 'px';
|
|
3840
|
-
|
|
3893
|
+
// Only name a target once the pointer has actually left FloLess. Inside our own window the answer
|
|
3894
|
+
// is always "release here to cancel", and naming a host underneath us would invite the user to
|
|
3895
|
+
// let go somewhere that abandons the gesture.
|
|
3896
|
+
const outside = pointerOutsideWindow(e);
|
|
3897
|
+
const nextTarget = outside ? hostUnderPointer(teklaDrag, e) : null;
|
|
3898
|
+
if (nextTarget !== teklaDrag.target) { teklaDrag.target = nextTarget; updateStatusChip(); }
|
|
3899
|
+
paintDragBadge(teklaDrag);
|
|
3900
|
+
if (canvasEl) canvasEl.style.cursor = outside ? 'default' : 'alias';
|
|
3841
3901
|
}
|
|
3842
3902
|
|
|
3843
3903
|
// Vertical (Alt) drag: raise/lower the member's elevation, snapping to other members' T.O.S levels.
|
|
@@ -4055,11 +4115,21 @@ function onUp(e) {
|
|
|
4055
4115
|
// or readout left over from before the gesture would otherwise sit on the canvas until the next
|
|
4056
4116
|
// hover. The send is deferred to just past that line for the same reason.
|
|
4057
4117
|
pending = dragging = null; downXY = null; if (controls) controls.enabled = true;
|
|
4058
|
-
|
|
4118
|
+
// Carry the RELEASE POINT, not the badge's guess. The badge reads a snapshot taken at
|
|
4119
|
+
// dragstart, which is advisory; the send re-resolves the window under this exact point so a
|
|
4120
|
+
// window that moved, or an app that came to the front mid-drag, cannot misdirect the members.
|
|
4121
|
+
// `hinted` is only what the badge promised, so the caller can tell a real change of target
|
|
4122
|
+
// from an unresolvable drop.
|
|
4123
|
+
if (pointerOutsideWindow(e) && api && api.onSendToHost) {
|
|
4124
|
+
// CSS screen pixels, plus OUR ratio. The physical conversion belongs to the server, which
|
|
4125
|
+
// knows about monitors; a mixed-DPI desktop makes this window's ratio a poor guide once the
|
|
4126
|
+
// cursor is over a differently-scaled screen.
|
|
4127
|
+
teklaSend = { ids: drag.ids, screenX: e.screenX, screenY: e.screenY, dpr: window.devicePixelRatio || 1, hinted: drag.target, running: drag.running };
|
|
4128
|
+
}
|
|
4059
4129
|
}
|
|
4060
4130
|
}
|
|
4061
4131
|
if (marker) marker.visible = false; if (readout) readout.style.display = 'none'; if (rubber) rubber.style.display = 'none'; if (epPreview) epPreview.visible = false; if (epMovedLine) epMovedLine.visible = false; clearCopyGhost(); dragEp = null; // always clear overlays
|
|
4062
|
-
if (teklaSend) { api.
|
|
4132
|
+
if (teklaSend) { api.onSendToHost(teklaSend); return; }
|
|
4063
4133
|
if (!renderer || !canvasEl || canvasEl.style.display === 'none') { downXY = null; boxSel = pending = dragging = null; if (controls) controls.enabled = true; return; } // 3D hidden mid-gesture → drop stale gesture state (no resume on re-show)
|
|
4064
4134
|
const bs = boxSel; boxSel = null;
|
|
4065
4135
|
if (bs) { // empty-space gesture: drag = box-select, click = clear selection
|
|
@@ -4284,7 +4354,13 @@ function updateStatusChip() {
|
|
|
4284
4354
|
const showId = hoverId || (selIds.size === 1 ? [...selIds][0] : null);
|
|
4285
4355
|
// The badge follows the cursor and so clips away at the window edge — from there this chip is the
|
|
4286
4356
|
// only thing still telling the user what releasing will do.
|
|
4287
|
-
if (teklaDrag && teklaDrag.active)
|
|
4357
|
+
if (teklaDrag && teklaDrag.active) {
|
|
4358
|
+
const n = teklaDrag.ids.length, noun = n === 1 ? 'member' : 'members';
|
|
4359
|
+
// Name the app the pointer is actually over, so the chip and the badge never disagree.
|
|
4360
|
+
txt = teklaDrag.target
|
|
4361
|
+
? `Release to insert ${n} ${noun} into ${HOST_SHORT[teklaDrag.target]} · release here or Esc to cancel`
|
|
4362
|
+
: `Release over Tekla, Revit or SketchUp to insert ${n} ${noun} · release here or Esc to cancel`;
|
|
4363
|
+
}
|
|
4288
4364
|
else if (wpMode === 'face') txt = 'Click a member face — the working plane lands on it · Esc to cancel';
|
|
4289
4365
|
else if (wpMode === '3pt') txt = ['Click the plane origin (snapped) · Esc to cancel', 'Click the local-X direction point · Esc to cancel', 'Click a point on the plane’s Y side · Esc to cancel'][(wpDraft || []).length] || '';
|
|
4290
4366
|
else if (addActive()) txt = drDraft ? 'Click the member end · X/Y/Z lock to the local axes, Shift straight · Esc drops the start' + lockChipTxt() : 'Draw a member on the working plane — click the start point · Esc exits';
|
|
@@ -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]{display:none}
|
|
404
|
+
#moreMenu #sendTeklaB[hidden],#moreMenu #sendRevitB[hidden],#moreMenu #sendSketchupB[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}
|
|
@@ -928,6 +928,8 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
928
928
|
<div class=msec-body>
|
|
929
929
|
<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>
|
|
930
930
|
<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>
|
|
931
|
+
<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>
|
|
932
|
+
<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>
|
|
931
933
|
<button id=exp>Export contract…</button>
|
|
932
934
|
</div>
|
|
933
935
|
<hr id=revertSep>
|
|
@@ -5957,9 +5959,10 @@ function closeMore(){moreMenu.classList.remove('open');moreBtn.setAttribute('ari
|
|
|
5957
5959
|
moreBtn.onclick=e=>{e.stopPropagation();if(moreOpen())closeMore();else{
|
|
5958
5960
|
// "Send selection to Tekla" is hidden, not disabled, with nothing selected — there is no action to
|
|
5959
5961
|
// offer yet, and a greyed row would read as a broken feature rather than an empty state.
|
|
5960
|
-
|
|
5962
|
+
{const anySel=!selArr().length;for(const bid of ['sendTeklaB','sendRevitB','sendSketchupB']){const b=document.getElementById(bid);if(b)b.hidden=anySel;}}
|
|
5961
5963
|
moreMenu.classList.add('open');moreBtn.setAttribute('aria-expanded','true');document.addEventListener('mousedown',moreOutside,true);}};
|
|
5962
|
-
|
|
5964
|
+
for(const [bid,host] of [['sendTeklaB','tekla'],['sendRevitB','revit'],['sendSketchupB','sketchup']]){
|
|
5965
|
+
const b=document.getElementById(bid);if(b)b.onclick=()=>{closeMore();sendSelectionToHost(host,teklaSelectionIds());};}
|
|
5963
5966
|
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)
|
|
5964
5967
|
// "Snapping" is collapsible to save menu space — the header expands the running-snap switches below it
|
|
5965
5968
|
// Every ⋯ section is a collapse/expand accordion (Snapping + Display + Detailing + …); state persists in localStorage.
|
|
@@ -6095,12 +6098,63 @@ let copesByMember={}, partsById={};
|
|
|
6095
6098
|
// insert, so sending the same members twice puts them in twice (undo/delete in Tekla). ---
|
|
6096
6099
|
let teklaSendBusy=false;
|
|
6097
6100
|
const teklaSelectionIds=()=>selArr().map(m=>m.id); // members only: grid lines, dimensions and connection parts are never sent (selArr matches against real members)
|
|
6098
|
-
|
|
6101
|
+
// What the user calls each application. Copy NEVER says "sketchup-2026" or an agent id.
|
|
6102
|
+
const HOST_NAME={tekla:'Tekla',revit:'Revit',sketchup:'SketchUp'};
|
|
6103
|
+
// Tekla keeps its original route (its readiness probe can tell "open but no model loaded", which the
|
|
6104
|
+
// generic one cannot); Revit and SketchUp share the newer one. Same request body either way.
|
|
6105
|
+
const hostSendUrl=(host)=>'/api/contract/'+encodeURIComponent(APP_ID)+(host==='tekla'?'/export-tekla':'/export-host/'+encodeURIComponent(host))+PROJECT_QS;
|
|
6106
|
+
|
|
6107
|
+
/* Resolve where a drag-out was released and send there.
|
|
6108
|
+
The badge that followed the cursor read a snapshot taken when the drag STARTED, so it is a hint,
|
|
6109
|
+
not a decision — this asks the server what is under the release point right now. When that
|
|
6110
|
+
resolves nothing (the desktop, a taskbar, a window we don't know) we do not guess between two
|
|
6111
|
+
open applications: with exactly one running there is no ambiguity worth interrupting for, and
|
|
6112
|
+
with several the user is told to drop on the one they meant rather than having one picked. */
|
|
6113
|
+
async function resolveAndSend(payload){
|
|
6114
|
+
const ids=Array.isArray(payload&&payload.ids)?payload.ids:[];
|
|
6115
|
+
if(!ids.length){toast('Select the members you want to send first.');return;}
|
|
6116
|
+
let host=null,proc=null,pid=null,resolved=false,running=Array.isArray(payload.running)?payload.running:[];
|
|
6117
|
+
try{
|
|
6118
|
+
const r=await fetch('/api/host-at-point',{method:'POST',headers:{'content-type':'application/json'},
|
|
6119
|
+
body:JSON.stringify({screenX:payload.screenX,screenY:payload.screenY,dpr:payload.dpr})});
|
|
6120
|
+
const j=await r.json().catch(()=>({}));
|
|
6121
|
+
// The PID is the WINDOW the user released over. Two Revit sessions can be open, so sending only
|
|
6122
|
+
// "revit" would let the bridge pick the other one — the members would appear, just not where
|
|
6123
|
+
// they were dropped, which is the one promise this gesture makes.
|
|
6124
|
+
if(j&&j.ok){host=j.host||null;proc=j.processName||null;pid=(typeof j.pid==='number'?j.pid:null);
|
|
6125
|
+
resolved=j.resolved!==false;if(Array.isArray(j.running))running=j.running;}
|
|
6126
|
+
}catch(e){/* could not ask at all — treated as an unreadable desktop below */}
|
|
6127
|
+
if(!host){
|
|
6128
|
+
// A drop we READ as "nothing recognised" is the user's aim, and it is refused. "Release over the
|
|
6129
|
+
// app" is the promise this gesture makes, and someone who overshoots onto the desktop while a CAD
|
|
6130
|
+
// app happens to sit open from unrelated work must not get an insert into a model they never
|
|
6131
|
+
// pointed at. Refusing costs a re-drag; guessing costs a wrong model.
|
|
6132
|
+
if(resolved){
|
|
6133
|
+
toast(proc?('Released over '+proc+' — nothing sent. Drag it out again over Tekla, Revit or SketchUp.')
|
|
6134
|
+
:'Released over the desktop — nothing sent. Drag it out again over Tekla, Revit or SketchUp.');
|
|
6135
|
+
return;
|
|
6136
|
+
}
|
|
6137
|
+
// A drop we could NOT READ is a different fact — our failure, not their aim. With exactly one CAD
|
|
6138
|
+
// app open there is no choice to get wrong, so the send goes there rather than making the user pay
|
|
6139
|
+
// for our miss. With none or several we still refuse: a guess is only safe when there is nothing
|
|
6140
|
+
// to guess between.
|
|
6141
|
+
if(running.length!==1){
|
|
6142
|
+
toast(running.length>1
|
|
6143
|
+
?'Couldn’t tell which app you dropped on — try again, or use ⋯ → Session to pick one.'
|
|
6144
|
+
:'Couldn’t tell what you dropped on — open Tekla, Revit or SketchUp and try again.');
|
|
6145
|
+
return;
|
|
6146
|
+
}
|
|
6147
|
+
host=running[0];pid=null;
|
|
6148
|
+
}
|
|
6149
|
+
return sendSelectionToHost(host,ids,pid);
|
|
6150
|
+
}
|
|
6151
|
+
|
|
6152
|
+
async function sendSelectionToHost(host,ids,hostPid){
|
|
6099
6153
|
if(teklaSendBusy)return;
|
|
6100
6154
|
const list=[...new Set((Array.isArray(ids)?ids:[]).filter(Boolean))];
|
|
6101
6155
|
if(!list.length){toast('Select the members you want to send first.');return;}
|
|
6102
|
-
const n=list.length,noun=n===1?'member':'members';
|
|
6103
|
-
teklaSendBusy=true;toast('Sending '+n+' '+noun+' to
|
|
6156
|
+
const n=list.length,noun=n===1?'member':'members',NAME=HOST_NAME[host]||host;
|
|
6157
|
+
teklaSendBusy=true;toast('Sending '+n+' '+noun+' to '+NAME+'…',true);
|
|
6104
6158
|
try{
|
|
6105
6159
|
// Push the on-screen edits first, or a just-moved beam lands at its old place. NOT in a project:
|
|
6106
6160
|
// there the server exports the APPROVED snapshot (not this draft), while every contract PUT clears
|
|
@@ -6112,8 +6166,9 @@ async function sendSelectionToTekla(ids){
|
|
|
6112
6166
|
if(PROJECT){
|
|
6113
6167
|
if(saveT!==null){toast('Approve this version before sending — your latest edits aren’t in the approved model yet.');return;}
|
|
6114
6168
|
} else await window.flushContract();
|
|
6115
|
-
const res=await fetch(
|
|
6116
|
-
{method:'POST',headers:{'content-type':'application/json'},
|
|
6169
|
+
const res=await fetch(hostSendUrl(host),
|
|
6170
|
+
{method:'POST',headers:{'content-type':'application/json'},
|
|
6171
|
+
body:JSON.stringify(hostPid?{memberIds:list,hostPid:hostPid}:{memberIds:list})});
|
|
6117
6172
|
const j=await res.json().catch(()=>({}));
|
|
6118
6173
|
if(!res.ok||!j.ok)throw new Error(j.error||('send failed ('+res.status+')'));
|
|
6119
6174
|
// Report what TEKLA received, never what we asked for: the server legitimately drops members it
|
|
@@ -6124,14 +6179,21 @@ async function sendSelectionToTekla(ids){
|
|
|
6124
6179
|
const em=(j.receipt&&Array.isArray(j.receipt.emitted))?j.receipt.emitted:null;
|
|
6125
6180
|
const got=em?em.filter(r=>r&&r.kind==='member').length:n;
|
|
6126
6181
|
const gotNoun=got===1?'member':'members',missed=n-got;
|
|
6182
|
+
// A member can land as a generic placeholder solid when its section isn't loaded in the host —
|
|
6183
|
+
// report that rather than let the user find a grey block and assume the export is broken.
|
|
6184
|
+
// One sentence shape across all three hosts — "Inserted {got} of {n} … into {Host} — {why}." —
|
|
6185
|
+
// so only the reason clause varies by host, never the voice.
|
|
6186
|
+
const fell=em?em.filter(r=>r&&r.kind==='member'&&r.fallback).length:0;
|
|
6127
6187
|
toast(missed>0
|
|
6128
|
-
?'Inserted '+got+' of '+n+' '+noun+' into
|
|
6129
|
-
:
|
|
6188
|
+
?'Inserted '+got+' of '+n+' '+noun+' into '+NAME+' — '+missed+' had no size to build yet.'
|
|
6189
|
+
:(fell>0
|
|
6190
|
+
?'Inserted '+got+' of '+n+' '+noun+' into '+NAME+' — '+fell+' used a placeholder shape (their section isn’t loaded in '+NAME+').'
|
|
6191
|
+
:'Inserted '+got+' '+gotNoun+' into '+NAME+'.'));
|
|
6130
6192
|
}catch(e){
|
|
6131
|
-
console.error('send to
|
|
6193
|
+
console.error('send to '+host+' failed',e);
|
|
6132
6194
|
// The server's own messages are plain English; a transport failure ("Failed to fetch") is not.
|
|
6133
6195
|
const msg=e&&e.message?e.message:'';
|
|
6134
|
-
toast(/failed to fetch|networkerror|load failed/i.test(msg)?'Couldn’t reach the app to send — is it still running?':(msg||'Couldn’t insert into
|
|
6196
|
+
toast(/failed to fetch|networkerror|load failed/i.test(msg)?'Couldn’t reach the app to send — is it still running?':(msg||('Couldn’t insert into '+NAME+'.')));
|
|
6135
6197
|
}finally{teklaSendBusy=false;}
|
|
6136
6198
|
}
|
|
6137
6199
|
|
|
@@ -6363,7 +6425,10 @@ const view3dApi={
|
|
|
6363
6425
|
toast:(m)=>toast(m),
|
|
6364
6426
|
teklaSelectionIds, // Ctrl+Shift drag-out: the sendable member ids (the badge count and the payload are the same list)
|
|
6365
6427
|
teklaSendBusy:()=>teklaSendBusy, // one drop at a time — the view refuses to start a second drag mid-send
|
|
6366
|
-
|
|
6428
|
+
onSendToHost:(payload)=>resolveAndSend(payload),
|
|
6429
|
+
// The z-ordered window stack, fetched ONCE when a drag-out starts so the badge can name the
|
|
6430
|
+
// app under the cursor without a round-trip per pointer move. Advisory: the release re-resolves.
|
|
6431
|
+
hostWindows:async()=>{try{const r=await fetch('/api/host-windows');return await r.json();}catch(e){return null;}},
|
|
6367
6432
|
// 3D Move/Copy: the 3D view reads the armed tool + counts, and hands commit offsets back in scene mm.
|
|
6368
6433
|
cmState:()=>cmTool?{tool:cmTool,array:cmArrayMode,count:cmCount,countA:cmCountA,countB:cmCountB}:null,
|
|
6369
6434
|
// mm → plan px (Y FLIPPED) + inches for dz, now owned by the model boundary. toDisplayOffsets MUTATES
|