@floless/app 0.135.1 → 0.136.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 +309 -151
- package/dist/schemas/steel.model.v2.schema.json +11 -11
- package/dist/skills/floless-app-report-issue/SKILL.md +46 -9
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +57 -59
- package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +92 -0
- package/dist/templates/steel-model.flo +44 -4
- package/dist/web/commands-steel.js +6 -0
- package/dist/web/instructor.js +1 -0
- package/dist/web/steel-editor.html +238 -13
- package/dist/web/steel-model-v2-client-validation.js +20 -14
- package/dist/web/steel-model-v2-commands.js +8 -23
- package/dist/web/steel-model-v2-projection.js +96 -3
- package/dist/web/steel-plan-transform.js +51 -12
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* control to a world point. Nothing here infers a view kind or substitutes missing registration data.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { parseSpacings,
|
|
9
|
+
import { parseSpacings, mmPerPx } from './grid-core.js';
|
|
10
10
|
|
|
11
11
|
const ROUND = 1e9;
|
|
12
12
|
const clean = (n) => {
|
|
@@ -14,6 +14,15 @@ const clean = (n) => {
|
|
|
14
14
|
return Object.is(q, -0) ? 0 : q;
|
|
15
15
|
};
|
|
16
16
|
const finite2 = (p) => Array.isArray(p) && p.length === 2 && p.every(Number.isFinite);
|
|
17
|
+
const round2 = (n) => Math.round(n * 100) / 100;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* How far the drawn control span may differ from the span its grid intersections imply, in POINTS of
|
|
21
|
+
* drawn distance. The takeoff skill has always told the reader to check exactly this by hand ("verify
|
|
22
|
+
* that their display span differs by at most 2 pt from `worldSpanMm * pt_per_ft / 304.8`"); #935 is
|
|
23
|
+
* what happens when only the prose enforces it.
|
|
24
|
+
*/
|
|
25
|
+
export const REGISTRATION_SPAN_TOLERANCE_PT = 2;
|
|
17
26
|
|
|
18
27
|
export class PlanTransformError extends Error {
|
|
19
28
|
constructor(code, message, viewKind = null) {
|
|
@@ -66,8 +75,16 @@ export const clipQuoted = (value, max = MAX_QUOTED_CHARS) => {
|
|
|
66
75
|
const quote = (value) => clipQuoted(value);
|
|
67
76
|
|
|
68
77
|
/**
|
|
69
|
-
* Resolve one
|
|
70
|
-
*
|
|
78
|
+
* Resolve one model-grid intersection from a pair of AXIS IDS.
|
|
79
|
+
*
|
|
80
|
+
* It resolved LABELS until #935, and that was a silent-metres-wrong bug: `axisLabelsFor` falls back to
|
|
81
|
+
* a positional auto-name (`1,2,3…` across X, `A,B,C…` up Y) for any axis carrying no label of its own,
|
|
82
|
+
* so a contract that identified its gridlines only by `id` still resolved `1`/`C` — against the FIRST
|
|
83
|
+
* and THIRD authored axes. Both refs resolved uniquely, nothing complained, and a 250-member model
|
|
84
|
+
* landed a median of 18 m from where it belonged. An id is the field the schema already calls identity;
|
|
85
|
+
* a label is editable display text and stays out of this.
|
|
86
|
+
*
|
|
87
|
+
* A duplicate id is still ambiguous and still refuses rather than quietly taking the first match.
|
|
71
88
|
*/
|
|
72
89
|
function gridIntersection(grid, ref, plan, field) {
|
|
73
90
|
if (!grid || typeof grid !== 'object') {
|
|
@@ -84,8 +101,8 @@ function gridIntersection(grid, ref, plan, field) {
|
|
|
84
101
|
plan,
|
|
85
102
|
);
|
|
86
103
|
}
|
|
87
|
-
if (!ref || typeof ref !== 'object' || typeof ref.
|
|
88
|
-
return refuse('control-ref-invalid', `sheet "${quote(plan.sheet)}" has an unreadable ${field}: a registration control needs string
|
|
104
|
+
if (!ref || typeof ref !== 'object' || typeof ref.xAxisId !== 'string' || typeof ref.yAxisId !== 'string') {
|
|
105
|
+
return refuse('control-ref-invalid', `sheet "${quote(plan.sheet)}" has an unreadable ${field}: a registration control needs string xAxisId and yAxisId grid axis ids`, plan);
|
|
89
106
|
}
|
|
90
107
|
|
|
91
108
|
const X = parseSpacings(grid.x), Y = parseSpacings(grid.y);
|
|
@@ -93,18 +110,22 @@ function gridIntersection(grid, ref, plan, field) {
|
|
|
93
110
|
const bad = X.err ? '$.grid.x' : '$.grid.y';
|
|
94
111
|
return refuse('grid-spacing-invalid', `sheet "${quote(plan.sheet)}" cannot use ${bad}: ${quote(X.err || Y.err)}`, plan);
|
|
95
112
|
}
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
113
|
+
// Authored order per direction, which is the order `parseSpacings` produces offsets in — the axis at
|
|
114
|
+
// slot i owns offset i. A direction whose axis rows and offsets disagree in count is not describable,
|
|
115
|
+
// so no id in it resolves; `checkModelReferences` (`grid-axis-count`) refuses such a document upstream.
|
|
116
|
+
const idsFor = (dir) => (Array.isArray(grid.axes) ? grid.axes.filter((a) => a && a.dir === dir) : [])
|
|
117
|
+
.map((a) => typeof a.id === 'string' ? a.id : null);
|
|
118
|
+
const xs = idsFor('x'), ys = idsFor('y');
|
|
119
|
+
const uniqueIndex = (ids, wanted, count) => {
|
|
120
|
+
if (ids.length !== count) return -1;
|
|
121
|
+
const hits = ids.map((id, i) => id === wanted ? i : -1).filter((i) => i >= 0);
|
|
101
122
|
return hits.length === 1 ? hits[0] : -1;
|
|
102
123
|
};
|
|
103
|
-
const xi = uniqueIndex(xs, ref.
|
|
124
|
+
const xi = uniqueIndex(xs, ref.xAxisId, X.offsets.length), yi = uniqueIndex(ys, ref.yAxisId, Y.offsets.length);
|
|
104
125
|
if (xi < 0 || yi < 0) {
|
|
105
126
|
return refuse(
|
|
106
127
|
'control-ref-unresolved',
|
|
107
|
-
`sheet "${quote(plan.sheet)}" ${field} names ${quote(ref.
|
|
128
|
+
`sheet "${quote(plan.sheet)}" ${field} names ${quote(ref.xAxisId)}/${quote(ref.yAxisId)}, which is not exactly one x and one y axis id on the model grid`,
|
|
108
129
|
plan,
|
|
109
130
|
);
|
|
110
131
|
}
|
|
@@ -168,6 +189,24 @@ export function planTransform(plan) {
|
|
|
168
189
|
: '$.control2_ref resolves to the model origin, which is where an absent $.datum_ref already puts the datum';
|
|
169
190
|
return refuse('registration-degenerate', `sheet "${quote(plan.sheet)}" has coincident registration controls: ${datum}`, plan);
|
|
170
191
|
}
|
|
192
|
+
// THE SPAN INVARIANT. `fitScale` corrects a sub-point pick error; it is not evidence the registration
|
|
193
|
+
// is right, and a RATIO band cannot be made into that evidence. On a 14-axis grid there are 13 bays,
|
|
194
|
+
// so resolving a control one bay out moves the run by ~7.7% — inside any band loose enough for real
|
|
195
|
+
// drawings, and #935's own defect would have passed it. Meanwhile a short but perfectly good
|
|
196
|
+
// registration can be several percent off from one pixel of pick error. So compare an ABSOLUTE
|
|
197
|
+
// distance, in the units the drawing is in: the drawn span between the two controls against the span
|
|
198
|
+
// their grid intersections imply, within 2 pt. That is the check the takeoff skill already tells the
|
|
199
|
+
// reader to do by hand — it was simply never enforced, so a whole-bay misresolution sailed through
|
|
200
|
+
// and put a 250-member model a median of 18 m out with no error at any layer.
|
|
201
|
+
const actualSpanPt = localLen / scale;
|
|
202
|
+
const expectedSpanPt = worldLen / scale;
|
|
203
|
+
if (Math.abs(actualSpanPt - expectedSpanPt) > REGISTRATION_SPAN_TOLERANCE_PT) {
|
|
204
|
+
return refuse(
|
|
205
|
+
'registration-span-mismatch',
|
|
206
|
+
`sheet "${quote(plan.sheet)}" registration controls span ${round2(actualSpanPt)} pt on the sheet, but ${plan.datum_ref ? '$.datum_ref' : 'the model origin'} and $.control2_ref are ${round2(worldLen)} mm apart, which at ${plan.pt_per_ft} pt/ft is ${round2(expectedSpanPt)} pt — a difference of ${round2(Math.abs(actualSpanPt - expectedSpanPt))} pt, past the ${REGISTRATION_SPAN_TOLERANCE_PT} pt allowed. Either a control names the wrong grid axis or $.pt_per_ft is wrong`,
|
|
207
|
+
plan,
|
|
208
|
+
);
|
|
209
|
+
}
|
|
171
210
|
const fitScale = worldLen / localLen;
|
|
172
211
|
const rotation = Math.atan2(worldDelta[1], worldDelta[0]) - Math.atan2(local1[1], local1[0]);
|
|
173
212
|
const c = Math.cos(rotation) * fitScale;
|