@floless/app 0.132.1 → 0.132.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.
- package/dist/floless-server.cjs +362 -37
- package/dist/web/commands-steel.js +18 -0
- package/dist/web/instructor.js +2 -2
- package/dist/web/steel-3d-core.js +71 -11
- package/dist/web/steel-3d-view.js +56 -25
- package/dist/web/steel-catalog-picker.js +624 -0
- package/dist/web/steel-editor.html +146 -34
- package/package.json +1 -1
|
@@ -1690,6 +1690,22 @@
|
|
|
1690
1690
|
def('steel.dimension-chain', { label: 'Chain', actsOn: 'Keeps placing dimensions from the previous endpoint', group: 'In the Inspect panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Enter or Esc ends the chain while leaving the dimensions already placed.' });
|
|
1691
1691
|
def('steel.dimension-pin', { label: 'Pin to steel', actsOn: 'Links or unlinks the selected dimension from its member or grid anchors', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Unpinning keeps the link dormant, so it can be restored without picking the anchors again.' });
|
|
1692
1692
|
def('steel.add-profile', { label: 'Current profile', actsOn: 'Sets the profile future members will use', group: 'In the Inspect panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'This changes the Add tool preset; it does not re-profile members already in the model.' });
|
|
1693
|
+
def('steel.add-material', { label: 'Material grade', actsOn: 'Sets the material future members will use', group: 'In the Inspect panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'This changes the Add tool preset; it does not alter members already in the model.' });
|
|
1694
|
+
def('steel.browse-profile-catalog', { label: 'Browse profiles', actsOn: 'Opens the active environment\'s profile catalog', group: 'In the Inspect panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Choosing a supported row applies its designation to the current member scope; unsupported rows remain visible but cannot be applied.' });
|
|
1695
|
+
def('steel.browse-material-catalog', { label: 'Browse materials', actsOn: 'Opens the active environment\'s material catalog', group: 'In the Inspect panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Choosing a row applies that grade to the current member scope.' });
|
|
1696
|
+
def('steel.catalog-search', { label: 'Search catalog', actsOn: 'Filters the open catalog to names and aliases matching {instance}', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1697
|
+
def('steel.catalog-category', { label: 'Catalog category', actsOn: 'Shows or hides the catalog rows under {instance}', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1698
|
+
def('steel.catalog-profile', { label: 'Profile choice', actsOn: 'Stages {instance} and shows its section facts before anything is applied', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'The model stays unchanged until Apply is pressed; unsupported joists can be inspected but not applied.' });
|
|
1699
|
+
def('steel.catalog-material', { label: 'Material choice', actsOn: 'Stages {instance} and shows its provider facts before anything is applied', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'The model stays unchanged until Apply is pressed.' });
|
|
1700
|
+
def('steel.catalog-material-default', { label: 'Use profile default', actsOn: 'Stages omission of an explicit grade so each member follows its profile', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'The model stays unchanged until the choice is applied.' });
|
|
1701
|
+
def('steel.catalog-material-current', { label: 'Keep current material', actsOn: 'Stages the project material that is not present in this provider catalog', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1702
|
+
def('steel.catalog-custom', { label: 'Custom designation', actsOn: 'Edits a catalog-independent {instance} value for this choice', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1703
|
+
def('steel.catalog-use-custom', { label: 'Stage custom value', actsOn: 'Stages the typed {instance} designation without changing the model yet', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1704
|
+
def('steel.catalog-apply', { label: 'Apply catalog choice', actsOn: 'Writes {instance} to the member scope named at the top of this picker', group: 'In the steel editor dialogs', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1705
|
+
def('steel.catalog-cancel', { label: 'Cancel catalog choice', actsOn: 'Closes the picker and leaves the model unchanged', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1706
|
+
def('steel.catalog-clear-search', { label: 'Clear catalog search', actsOn: 'Restores every available {instance} row in this picker', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1707
|
+
def('steel.catalog-retry', { label: 'Retry catalog load', actsOn: 'Requests the {instance} provider again after a load failure', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1708
|
+
def('steel.catalog-show-more', { label: 'Show more catalog rows', actsOn: 'Reveals the next page of matching {instance}', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1693
1709
|
def('steel.detail-placement-coordinate', { label: 'Detail coordinate', actsOn: 'Moves the selected reference detail along {instance}', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1694
1710
|
def('steel.detail-placement-rotation', { label: 'Detail rotation', actsOn: 'Rotates the selected reference detail on its image plane', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1695
1711
|
def('steel.detail-placement-size', { label: 'Detail size', actsOn: 'Sets the displayed size of the selected reference detail', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'The placed image is reference-only; changing its size does not build steel.' });
|
|
@@ -1718,6 +1734,7 @@
|
|
|
1718
1734
|
def('steel.end-connection', { label: 'Connection recipe', actsOn: 'Chooses the connection-library row for {instance}', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Once chosen, the library row supplies the type and detail instead of the fallback text fields.' });
|
|
1719
1735
|
def('steel.ends-match', { label: 'Match both ends', actsOn: 'Copies the start-end settings to the other end of each selected beam', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Braces are skipped because matching their elevations would flatten the slope.' });
|
|
1720
1736
|
def('steel.selection-profile', { label: 'Profile', actsOn: 'Sets one profile on every selected member', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1737
|
+
def('steel.selection-material', { label: 'Material grade', actsOn: 'Sets one material on every selected member', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1721
1738
|
def('steel.selection-verified', { label: 'Verify selected members', actsOn: 'Marks or unmarks every selected member as human-confirmed', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Human confirmation contributes full confidence but does not invent a missing AISC size.' });
|
|
1722
1739
|
def('steel.ends-swap', { label: 'Swap start and end', actsOn: 'Reverses the eligible selected beam members', group: 'In the Inspect panel', key: 'Also: P', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Columns stay base-to-top, and braces use their separate lower-end display control.' });
|
|
1723
1740
|
def('steel.quick-dimension-anchor', { label: 'Spacing point', actsOn: 'Measures each selected beam at its {instance}', group: 'In the Inspect panel', persistence: 'local', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
@@ -1744,6 +1761,7 @@
|
|
|
1744
1761
|
def('steel.member-line-weight', { label: 'Line weight', actsOn: 'Draws this member type with {instance}', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'This is a 2D style shared by every member of the same type.' });
|
|
1745
1762
|
def('steel.member-line-dash', { label: 'Line pattern', actsOn: 'Draws this member type as {instance}', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'This is a 2D style shared by every member of the same type.' });
|
|
1746
1763
|
def('steel.member-profile', { label: 'Profile', actsOn: 'Changes the profile of the selected member', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Unlike Current profile in Add mode, this edits steel already in the model.' });
|
|
1764
|
+
def('steel.member-material', { label: 'Material grade', actsOn: 'Changes the selected member\'s explicit material', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Unlike the Add preset, this edits steel already in the model.' });
|
|
1747
1765
|
def('steel.member-verified', { label: 'Mark verified', actsOn: 'Marks or unmarks the selected member as human-confirmed', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
1748
1766
|
def('steel.member-profile-suggestion', { label: 'Moment-frame profile', actsOn: 'Applies the scheduled profile for {instance}', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'The suggestion comes from the imported moment-frame schedule and records that provenance.' });
|
|
1749
1767
|
def('steel.properties-pin', { label: 'Pin Properties', actsOn: 'Keeps the Properties popup open while the selection changes', group: 'In the Properties popup', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
package/dist/web/instructor.js
CHANGED
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
|
|
238
238
|
function focusFor(el) {
|
|
239
239
|
if (!el || el === document.body) return null;
|
|
240
|
-
var target = el.closest('button, [role="button"], a[href], input, select, textarea');
|
|
240
|
+
var target = el.closest('button, [role="button"], [role="treeitem"], a[href], input, select, textarea');
|
|
241
241
|
if (!target) return null;
|
|
242
242
|
|
|
243
243
|
var tip = target.getAttribute('data-tip') || '';
|
|
@@ -765,7 +765,7 @@
|
|
|
765
765
|
live.focus();
|
|
766
766
|
/* FALLS THROUGH when the control cannot be described, rather than returning.
|
|
767
767
|
focusFor() resolves upward through
|
|
768
|
-
`closest('button, [role="button"], a[href], input, select, textarea')`, and
|
|
768
|
+
`closest('button, [role="button"], [role="treeitem"], a[href], input, select, textarea')`, and
|
|
769
769
|
three registered commands carry their id on a <label> whose <input> is a
|
|
770
770
|
DESCENDANT — filter.match-on and vector.show-kind — so the walk finds
|
|
771
771
|
nothing and it returns null. (That shape is deliberate: the id sits on the
|
|
@@ -315,6 +315,62 @@ export function sectionOutlinePts(kind, w, d, thk) {
|
|
|
315
315
|
/** How many segments approximate a circle for the consumers that need a polygon. */
|
|
316
316
|
export const ROUND_SEGMENTS = 48;
|
|
317
317
|
|
|
318
|
+
/**
|
|
319
|
+
* Editor display topology. A component owns one outer path and zero or more holes; multiple components
|
|
320
|
+
* still belong to one logical member (2L), so the Three adapter can extrude them into one mesh.
|
|
321
|
+
*/
|
|
322
|
+
export function sectionTopology(displaySection, w, d, fallbackKind = 'BOX') {
|
|
323
|
+
const polygon = (points) => ({ kind: 'polygon', points });
|
|
324
|
+
const circle = (radius) => ({ kind: 'circle', cx: 0, cy: 0, radius });
|
|
325
|
+
const component = (outer, holes = []) => ({ outer, holes });
|
|
326
|
+
const xs = displaySection || null;
|
|
327
|
+
|
|
328
|
+
if (xs?.shape === 'chs') {
|
|
329
|
+
const od = Number(xs.od) > 0 ? Number(xs.od) : Math.min(w, d);
|
|
330
|
+
const t = Number(xs.t);
|
|
331
|
+
const radius = od / 2;
|
|
332
|
+
return [component(circle(radius), t > 0 && t < radius ? [circle(radius - t)] : [])];
|
|
333
|
+
}
|
|
334
|
+
if (xs?.shape === 'solid-circle') {
|
|
335
|
+
const diameter = Number(xs.diameter) > 0 ? Number(xs.diameter) : Math.min(w, d);
|
|
336
|
+
return [component(circle(diameter / 2))];
|
|
337
|
+
}
|
|
338
|
+
if (xs?.shape === 'tee') {
|
|
339
|
+
const hw = w / 2, hd = d / 2;
|
|
340
|
+
const tf = Math.min(Math.max(Number(xs.tf) || d * 0.1, 0.1), d);
|
|
341
|
+
const tw = Math.min(Math.max(Number(xs.tw) || w * 0.1, 0.1), w);
|
|
342
|
+
return [component(polygon([[-hw, hd], [hw, hd], [hw, hd - tf], [tw / 2, hd - tf], [tw / 2, -hd], [-tw / 2, -hd], [-tw / 2, hd - tf], [-hw, hd - tf]]))];
|
|
343
|
+
}
|
|
344
|
+
if (xs?.shape === 'double-angle') {
|
|
345
|
+
const longBack = String(xs.orientation).toLowerCase() !== 'slbb';
|
|
346
|
+
const legDepth = Number(xs.d);
|
|
347
|
+
const legWidth = Number(xs.b);
|
|
348
|
+
const t = Math.min(Number(xs.t), legDepth, legWidth);
|
|
349
|
+
const gap = Math.max(Number(xs.gap) || 0, 0);
|
|
350
|
+
if (!(legDepth > 0 && legWidth > 0 && t > 0)) return [];
|
|
351
|
+
const hd = d / 2, hg = gap / 2;
|
|
352
|
+
if (longBack) {
|
|
353
|
+
const left = [[-hg - legWidth, hd - t], [-hg - t, hd - t], [-hg - t, -hd], [-hg, -hd], [-hg, hd], [-hg - legWidth, hd]];
|
|
354
|
+
const right = [[hg, -hd], [hg + t, -hd], [hg + t, hd - t], [hg + legWidth, hd - t], [hg + legWidth, hd], [hg, hd]];
|
|
355
|
+
return [component(polygon(left)), component(polygon(right))];
|
|
356
|
+
}
|
|
357
|
+
const hw = w / 2;
|
|
358
|
+
const lower = [[-hw, -hd], [-hw + t, -hd], [-hw + t, -hg - t], [hw, -hg - t], [hw, -hg], [-hw, -hg]];
|
|
359
|
+
const upper = [[hw, hd], [hw - t, hd], [hw - t, hg + t], [-hw, hg + t], [-hw, hg], [hw, hg]];
|
|
360
|
+
return [component(polygon(lower)), component(polygon(upper))];
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
const shapeKind = xs?.shape === 'i' ? 'I'
|
|
364
|
+
: xs?.shape === 'channel' ? 'C'
|
|
365
|
+
: xs?.shape === 'angle' ? 'L'
|
|
366
|
+
: xs?.shape === 'rhs' ? 'TUBE'
|
|
367
|
+
: fallbackKind;
|
|
368
|
+
const outlined = sectionOutlinePts(shapeKind, w, d, {
|
|
369
|
+
tw: xs?.tw, tf: xs?.tf, t: xs?.t,
|
|
370
|
+
});
|
|
371
|
+
return [component(polygon(outlined.outer), outlined.hole ? [polygon(outlined.hole)] : [])];
|
|
372
|
+
}
|
|
373
|
+
|
|
318
374
|
/**
|
|
319
375
|
* Place a section outline (local px, centred on the origin, section x = width / y = depth) into a plan
|
|
320
376
|
* sheet's display px, for a member rolled `rotDeg`.
|
|
@@ -1167,9 +1223,10 @@ export function dim3dGeom(a, b, axis, axisDir) {
|
|
|
1167
1223
|
// above already ended the CLASSIFIER's copies, and these end the OUTLINE's.
|
|
1168
1224
|
|
|
1169
1225
|
/**
|
|
1170
|
-
* AWARE's inclusive
|
|
1171
|
-
*
|
|
1172
|
-
* the
|
|
1226
|
+
* AWARE's inclusive raw cross-multiplied near-vertical predicate,
|
|
1227
|
+
* `|d − dot(d, up) up|² ≤ 1e−6 |d|²`. The literal operation shape is part of the floating-point contract:
|
|
1228
|
+
* normalizing `d`, subtracting from one, or dividing the sides moves the seam. Its visible `sin θ`
|
|
1229
|
+
* boundary is 1e−3.
|
|
1173
1230
|
*/
|
|
1174
1231
|
export const FRAME_DEGENERATE_SQ = 1e-6;
|
|
1175
1232
|
export const FRAME_DEGENERATE = Math.sqrt(FRAME_DEGENERATE_SQ);
|
|
@@ -1307,8 +1364,8 @@ export function faceOffset(named, lo, hi) {
|
|
|
1307
1364
|
* `memberMeshAxes` below, which is this frame with the axes reordered into the geometry's local order. It
|
|
1308
1365
|
* agreed with this rule for every ordinary member — which is why the divergence shipped unnoticed — and
|
|
1309
1366
|
* differed by a full 180° for a member stored top→base, where three.js's arbitrary antiparallel tie-break
|
|
1310
|
-
* yielded (−x̂, +ŷ) against this rule's (+x̂, −ŷ).
|
|
1311
|
-
*
|
|
1367
|
+
* yielded (−x̂, +ŷ) against this rule's (+x̂, −ŷ). A second band at the near-plumb cut is kept closed by
|
|
1368
|
+
* the shared literal raw cross-multiplied predicate.
|
|
1312
1369
|
*
|
|
1313
1370
|
* WHAT THAT COST WHILE IT LASTED, since it bounds what the fix can change. The renderer centres the mesh
|
|
1314
1371
|
* on the line the BAKE already offset (`placeMember`: `mesh.position` is the midpoint of `el.from`/
|
|
@@ -1326,9 +1383,8 @@ export function faceOffset(named, lo, hi) {
|
|
|
1326
1383
|
*/
|
|
1327
1384
|
export function partFrame(from, to, up = [0, 0, 1], upX = [1, 0, 0]) {
|
|
1328
1385
|
const d = [to[0] - from[0], to[1] - from[1], to[2] - from[2]];
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
const len = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
|
|
1386
|
+
const dSq = (d[0] * d[0] + d[1] * d[1]) + d[2] * d[2];
|
|
1387
|
+
const len = Math.sqrt(dSq);
|
|
1332
1388
|
if (!(len > 0) || !isFinite(len)) return null;
|
|
1333
1389
|
const x = [d[0] / len, d[1] / len, d[2] / len];
|
|
1334
1390
|
const unit = (v, label, min = 0) => {
|
|
@@ -1337,9 +1393,12 @@ export function partFrame(from, to, up = [0, 0, 1], upX = [1, 0, 0]) {
|
|
|
1337
1393
|
return [v[0] / l, v[1] / l, v[2] / l];
|
|
1338
1394
|
};
|
|
1339
1395
|
const u = unit(up, 'up');
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
const
|
|
1396
|
+
// Match AWARE #435 literally. These raw operands and the cross-multiplied comparison are deliberate:
|
|
1397
|
+
// algebraically equivalent normalized/cancelling/quotient forms disagree in the IEEE-754 seam.
|
|
1398
|
+
const rawUpDot = (u[0] * d[0] + u[1] * d[1]) + u[2] * d[2];
|
|
1399
|
+
const q = [d[0] - rawUpDot * u[0], d[1] - rawUpDot * u[1], d[2] - rawUpDot * u[2]];
|
|
1400
|
+
const qSq = (q[0] * q[0] + q[1] * q[1]) + q[2] * q[2];
|
|
1401
|
+
const degenerate = qSq <= FRAME_DEGENERATE_SQ * dSq;
|
|
1343
1402
|
if (degenerate) {
|
|
1344
1403
|
// Same projected +X seed rule as AWARE's scene_roll::member_frame. `upX` is intentionally validated
|
|
1345
1404
|
// only here: an ordinary +X beam legitimately has an unused +X seed with a zero member-plane projection.
|
|
@@ -1348,6 +1407,7 @@ export function partFrame(from, to, up = [0, 0, 1], upX = [1, 0, 0]) {
|
|
|
1348
1407
|
return { x, y, z: cross3(x, y), degenerate };
|
|
1349
1408
|
}
|
|
1350
1409
|
// Canonical ordinary branch: depth is projected up; width is depth × member axis (not its sign reverse).
|
|
1410
|
+
const upDot = u[0] * x[0] + u[1] * x[1] + u[2] * x[2];
|
|
1351
1411
|
const z = unit([u[0] - upDot * x[0], u[1] - upDot * x[1], u[2] - upDot * x[2]], 'up projection');
|
|
1352
1412
|
return { x, y: cross3(z, x), z, degenerate };
|
|
1353
1413
|
}
|
|
@@ -20,7 +20,7 @@ import { RoomEnvironment } from 'three/addons/RoomEnvironment.js';
|
|
|
20
20
|
import { surfaceTextures, applyTriplanar, TILE_MM, DIRECTIONAL } from './steel-materials.js';
|
|
21
21
|
import { canvasToolGuidanceState } from './steel-canvas-guidance.js';
|
|
22
22
|
import { Brush, Evaluator, SUBTRACTION } from 'three-bvh-csg';
|
|
23
|
-
import { snapPoint, planPointToWp, memberGeometry, snapElevation, dim3dGeom, dominantAxis3d, planeBasis, planeFrom3Points, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame, resolvePointEntry, offsetsFor, candidateOnPlane, snapGridPoint, clipSegmentToPlanes, pointSegmentDistance2d, perspectiveSegmentParameter, gridDepthWins, segmentHitsRect2d, projectedFootprintHitsRect2d, pickGridLevel, selectedLengthLabelAnchors, sectionKindOf,
|
|
23
|
+
import { snapPoint, planPointToWp, memberGeometry, snapElevation, dim3dGeom, dominantAxis3d, planeBasis, planeFrom3Points, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame, resolvePointEntry, offsetsFor, candidateOnPlane, snapGridPoint, clipSegmentToPlanes, pointSegmentDistance2d, perspectiveSegmentParameter, gridDepthWins, segmentHitsRect2d, projectedFootprintHitsRect2d, pickGridLevel, selectedLengthLabelAnchors, sectionKindOf, sectionTopology, memberMeshAxes } from './steel-3d-core.js';
|
|
24
24
|
// `gridGeometry`, `gridCandidates3d` and `mmPerPx` live behind the host's model read boundary because
|
|
25
25
|
// their display-scale argument is meaningless on a world-mm model grid.
|
|
26
26
|
import { visibleGridLevels, gridTransientScopeSignature, reconcileGridTransientState, objectSelectionStatus } from './grid-core.js';
|
|
@@ -460,7 +460,9 @@ function lengthAxisOf(el) {
|
|
|
460
460
|
// finish across the nut's short axis instead of along its sweep.
|
|
461
461
|
if (kind === 'rod' || kind === 'bolt-shank' || kind === 'anchor' || kind === 'nut') return 'y'; // CylinderGeometry
|
|
462
462
|
if (kind === 'plate' || kind === 'washer' || kind === 'bolt-head') return 'z';
|
|
463
|
-
|
|
463
|
+
const display = el?.meta?.displaySection;
|
|
464
|
+
const displayExtrudes = display && !/^(rect|joist|unsupported-custom)$/.test(String(display.shape));
|
|
465
|
+
return !displayExtrudes && shapeOf(el) === 'BOX' ? 'y' : 'z'; // Box vs Extrude
|
|
464
466
|
}
|
|
465
467
|
function shapeOf(el) {
|
|
466
468
|
const explicit = (el.section && el.section.shape || '').toString().toUpperCase().trim();
|
|
@@ -485,25 +487,32 @@ function realThk(xs, key, half) {
|
|
|
485
487
|
// an L4X4 leg came out 18.3mm against a real 9.5, so a connection bearing on the real face rendered buried
|
|
486
488
|
// in a member that was drawn nearly twice too thick. The estimates remain as the fallback for sections we
|
|
487
489
|
// have no data for; they are the reason a member can still be drawn at all.
|
|
488
|
-
function profileShape(kind, w, d, xs) {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
490
|
+
function profileShape(kind, w, d, xs, displaySection) {
|
|
491
|
+
const fallback = xs ? {
|
|
492
|
+
...(xs.shape === 'i' ? { shape: 'i', d: xs.d, bf: xs.bf, tw: realThk(xs, 'tw', w / 2), tf: realThk(xs, 'tf', d / 2) } : {}),
|
|
493
|
+
...(xs.shape === 'channel' ? { shape: 'channel', d: xs.d, bf: xs.bf, tw: realThk(xs, 'tw', w / 2), tf: realThk(xs, 'tf', d / 2) } : {}),
|
|
494
|
+
...(xs.shape === 'angle' ? { shape: 'angle', d: xs.d, b: xs.b, t: realThk(xs, 't', Math.min(w, d) / 2) } : {}),
|
|
495
|
+
...(xs.shape === 'rhs' ? { shape: 'rhs', d: xs.d, b: xs.b, t: realThk(xs, 't', Math.min(w, d) / 2) } : {}),
|
|
496
|
+
...(xs.shape === 'chs' ? { shape: 'chs', od: xs.od, t: realThk(xs, 't', Math.min(w, d) / 2) } : {}),
|
|
497
|
+
} : null;
|
|
498
|
+
const topology = sectionTopology(displaySection || fallback, w, d, kind);
|
|
499
|
+
const trace = (path, descriptor) => {
|
|
500
|
+
if (descriptor.kind === 'circle') { path.absarc(descriptor.cx, descriptor.cy, descriptor.radius, 0, Math.PI * 2, false); return; }
|
|
501
|
+
descriptor.points.forEach(([x, y], i) => (i ? path.lineTo(x, y) : path.moveTo(x, y))); path.closePath();
|
|
502
|
+
};
|
|
503
|
+
return topology.map(({ outer, holes }) => {
|
|
504
|
+
const shape = new THREE.Shape(); trace(shape, outer);
|
|
505
|
+
for (const hole of holes) { const path = new THREE.Path(); trace(path, hole); shape.holes.push(path); }
|
|
506
|
+
return shape;
|
|
496
507
|
});
|
|
497
|
-
const s = new THREE.Shape();
|
|
498
|
-
const trace = (path, pts) => { pts.forEach(([x, y], i) => (i ? path.lineTo(x, y) : path.moveTo(x, y))); path.closePath(); };
|
|
499
|
-
trace(s, outer);
|
|
500
|
-
if (hole) { const h = new THREE.Path(); trace(h, hole); s.holes.push(h); }
|
|
501
|
-
return s;
|
|
502
508
|
}
|
|
503
509
|
function memberGeom(el, w, d, len) {
|
|
504
510
|
const kind = shapeOf(el);
|
|
505
|
-
|
|
506
|
-
const
|
|
511
|
+
const display = el?.meta?.displaySection;
|
|
512
|
+
const displayExtrudes = display && !/^(rect|joist|unsupported-custom)$/.test(String(display.shape));
|
|
513
|
+
if (kind === 'BOX' && !displayExtrudes) return new THREE.BoxGeometry(w, len, d); // length on local Y
|
|
514
|
+
const shapes = profileShape(kind, w, d, el && el.xsection, display);
|
|
515
|
+
const g = new THREE.ExtrudeGeometry(shapes, { depth: len, bevelEnabled: false, curveSegments: 32 });
|
|
507
516
|
g.translate(0, 0, -len / 2); return g; // extruded +Z, centred
|
|
508
517
|
}
|
|
509
518
|
const _ZA = new THREE.Vector3(0, 0, 1), _YA = new THREE.Vector3(0, 1, 0);
|
|
@@ -513,7 +522,7 @@ const _ZA = new THREE.Vector3(0, 0, 1), _YA = new THREE.Vector3(0, 1, 0);
|
|
|
513
522
|
// spelled out here: it is `partFrame`'s `up` parameter, which defaults to world Z (see `memberMeshAxes`).
|
|
514
523
|
/**
|
|
515
524
|
* Orient a member from its two raw world endpoints. `from` and `to` are endpoint triples, never a
|
|
516
|
-
* pre-normalized direction
|
|
525
|
+
* pre-normalized direction: AWARE #435 makes the raw subtraction operands part of the branch contract.
|
|
517
526
|
* @param {THREE.Object3D & {geometry: THREE.BufferGeometry}} mesh
|
|
518
527
|
* @param {[number, number, number]} from raw world start endpoint
|
|
519
528
|
* @param {[number, number, number]} to raw world end endpoint
|
|
@@ -528,15 +537,14 @@ function orientMember(mesh, from, to, el) {
|
|
|
528
537
|
// had it right (#770). One frame, so the tie-break and the near-plumb cut cannot drift apart again.
|
|
529
538
|
//
|
|
530
539
|
// THE AUTHORED REFERENCE LINE selects the frame, and the operands must be the bake's own — not a
|
|
531
|
-
// direction recovered from anywhere else. `partFrame`'s near-plumb predicate
|
|
532
|
-
// INCLUSIVE, so for a member on the cut a single last-bit difference decides the branch and
|
|
533
|
-
//
|
|
540
|
+
// direction recovered from anywhere else. `partFrame`'s raw cross-multiplied near-plumb predicate is
|
|
541
|
+
// INCLUSIVE, so for a member on the cut a single last-bit operand difference decides the branch and can
|
|
542
|
+
// swing an asymmetric section sharply. Two operand changes had to go (both found by Codex on #801):
|
|
534
543
|
//
|
|
535
|
-
// - normalizing here first,
|
|
536
|
-
// `sin θ = 1e−3` dead on and flips from the ordinary branch to the degenerate one.
|
|
544
|
+
// - normalizing here first, which is forbidden by AWARE #435: classification reads raw `to − from`.
|
|
537
545
|
// - subtracting the PLACED endpoints. `el.from`/`el.to` are `refFrom + o` / `refTo + o` for the same
|
|
538
546
|
// section-position offset, so `to − from` is not bit-identical to `refTo − refFrom`. Swept on that
|
|
539
|
-
// same member,
|
|
547
|
+
// same member, 99,261 of 400,000 legal offsets flipped the branch under the raw predicate.
|
|
540
548
|
//
|
|
541
549
|
// So `contract-to-scene` ships `refFrom`/`refTo` alongside the placed line and they are what comes in
|
|
542
550
|
// here; `from`/`to` remain the fallback for a scene that predates them or an element with no authored
|
|
@@ -942,6 +950,7 @@ function buildFromScene(sc) {
|
|
|
942
950
|
const memberCuts = cutsByMember.get(el.id);
|
|
943
951
|
if (memberCuts && memberCuts.length) applyCopes(mesh, memberCuts); // notch a coped member end
|
|
944
952
|
mesh.userData.id = el.id; mesh.userData.group = el.group; mesh.userData.profile = el.meta && el.meta.profile;
|
|
953
|
+
mesh.userData.sectionShape = el.meta?.displaySection?.shape || el.xsection?.shape || shapeOf(el).toLowerCase();
|
|
945
954
|
mesh.userData.family = familyOf(el); // the selection/hover clones and the restore path need it too
|
|
946
955
|
mesh.userData.axis = lengthAxisOf(el); // …and so does the axis, or a clone rebuilds a world-projected shader
|
|
947
956
|
mesh.userData.derived = !!(el.kind && el.kind !== 'box'); // connection parts: rendered, not member-editable
|
|
@@ -7280,6 +7289,13 @@ function debug() {
|
|
|
7280
7289
|
firstId: meshById.keys().next().value ?? null,
|
|
7281
7290
|
ids: [...meshById.keys()].slice(0, 12),
|
|
7282
7291
|
geomTypes: [...meshById.values()].reduce((h, m) => { const t = m.geometry.type; h[t] = (h[t] || 0) + 1; return h; }, {}),
|
|
7292
|
+
sectionGeometry: Object.fromEntries([...meshById].map(([id, m]) => {
|
|
7293
|
+
if (!m.geometry.boundingBox) m.geometry.computeBoundingBox();
|
|
7294
|
+
const size = m.geometry.boundingBox?.getSize(new THREE.Vector3());
|
|
7295
|
+
return [id, { profile: m.userData.profile, shape: m.userData.sectionShape, type: m.geometry.type,
|
|
7296
|
+
vertices: m.geometry.attributes?.position?.count ?? 0, groups: m.geometry.groups?.length ?? 0,
|
|
7297
|
+
localSize: size ? [size.x, size.y, size.z] : null }];
|
|
7298
|
+
})),
|
|
7283
7299
|
lastPick, projection: projection(), mode: displayMode,
|
|
7284
7300
|
// Realistic-mode state. `envOn` is the load-bearing one: metal with no environment renders black,
|
|
7285
7301
|
// so "the mode switched" is not evidence on its own — the environment has to be live.
|
|
@@ -7339,6 +7355,21 @@ function centerOf(id) {
|
|
|
7339
7355
|
return { x: rect.left + (w.x * 0.5 + 0.5) * rect.width, y: rect.top + (-w.y * 0.5 + 0.5) * rect.height };
|
|
7340
7356
|
}
|
|
7341
7357
|
function worldOf(id) { const m = meshById.get(id); if (!m) return null; const w = m.getWorldPosition(new THREE.Vector3()); return [w.x, w.y, w.z]; } // test helper: a rendered part's world position
|
|
7358
|
+
// Test helper: the ACTUAL rendered member basis after its mesh quaternion and parent transforms. Unlike a
|
|
7359
|
+
// fresh `partFrame` call, this observes the object the canvas draws. BoxGeometry's width is local -X; an
|
|
7360
|
+
// extruded asymmetric profile uses local +X width, +Y depth, +Z member axis.
|
|
7361
|
+
function memberBasis(id) {
|
|
7362
|
+
const m = meshById.get(id); if (!m || !m.geometry) return null;
|
|
7363
|
+
const q = m.getWorldQuaternion(new THREE.Quaternion());
|
|
7364
|
+
const box = m.geometry.type === 'BoxGeometry';
|
|
7365
|
+
const xyz = (v) => { v.applyQuaternion(q); return [v.x, v.y, v.z]; };
|
|
7366
|
+
return {
|
|
7367
|
+
geometry: m.geometry.type,
|
|
7368
|
+
width: xyz(new THREE.Vector3(box ? -1 : 1, 0, 0)),
|
|
7369
|
+
depth: xyz(new THREE.Vector3(0, box ? 0 : 1, box ? 1 : 0)),
|
|
7370
|
+
axis: xyz(new THREE.Vector3(0, box ? 1 : 0, box ? 0 : 1)),
|
|
7371
|
+
};
|
|
7372
|
+
}
|
|
7342
7373
|
// test helper: client (px) coords of every POINT snap candidate of `type` currently in view (members + grid, via
|
|
7343
7374
|
// allCandidates) — drives precise E2E snap hovers, including grid nodes/intersections (grid-int).
|
|
7344
7375
|
function snapCandidatesScreen(type) {
|
|
@@ -7492,7 +7523,7 @@ window.Steel3DView = {
|
|
|
7492
7523
|
selDims3dCount: () => (api && api.selDim3d ? (api.selDim3d() || []).length : 0), // test helper: how many 3D dims are selected
|
|
7493
7524
|
dim3dLabelOf: (i) => { const el = dimLabelPool[i]; if (!el || el.style.display === 'none') return null; const r = el.getBoundingClientRect(); return { x: r.left + r.width / 2, y: r.top + r.height / 2, text: el.textContent }; },
|
|
7494
7525
|
wireEdgeColor: (id) => { const ls = wireEdges.get(id); return ls && ls.visible && ls.parent && ls.parent.visible && ls.material ? '#' + ls.material.color.getHexString() : null; }, // test probe: the Wire-mode OUTLINE colour of a member. probe() reads the hidden FILL's emissive, which is set in every mode — so it stays green even when the outline never adopts the cue (exactly the regression this fixes); this is the only read of the line that Wire actually draws. Gated like its sibling probes: ls.visible (leaving Wire only HIDES the outline — wireEdgesFor runs on the wire branch alone — so an ungated read reports a stale Wire colour) and ls.parent.visible (group/legend/isolate/work-area hide the parent MESH, and three skips a hidden parent's children). It still cannot see clip planes, frustum culling or a display:none canvas — a false "on" is possible there, never a false "off"
|
|
7495
|
-
debug, probe, screenOf, centerOf, worldOf, snapCandidatesScreen, referenceObjectsScreen, gridSegmentsScreen, gridBubblesScreen, clipHandlesScreen,
|
|
7526
|
+
debug, probe, screenOf, centerOf, worldOf, memberBasis, snapCandidatesScreen, referenceObjectsScreen, gridSegmentsScreen, gridBubblesScreen, clipHandlesScreen,
|
|
7496
7527
|
clipPlanePreviewShown: () => !!clipPlanePreview, // test helper: is the armed-plane hover ghost currently showing?
|
|
7497
7528
|
clipBoxFloorAt: (x, y) => clipBoxFloorPoint(x, y), // test helper: the snapped footprint point at a cursor ({ xy, snap, world } or null)
|
|
7498
7529
|
pointClipped: (p) => isPointClipped(p), // test helper: is a world point on the cut-away side of any active clip?
|