bimdown-cli 0.3.0 → 0.5.1
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/README.md +24 -3
- package/dist/chunk-4SKM4RHY.js +142 -0
- package/dist/chunk-4SKM4RHY.js.map +1 -0
- package/dist/chunk-4YHVOWS4.js +255 -0
- package/dist/chunk-4YHVOWS4.js.map +1 -0
- package/dist/chunk-AYAXRYGP.js +2129 -0
- package/dist/chunk-AYAXRYGP.js.map +1 -0
- package/dist/chunk-EC5MR5ZH.js +648 -0
- package/dist/chunk-EC5MR5ZH.js.map +1 -0
- package/dist/chunk-HS3PO2LB.js +487 -0
- package/dist/chunk-HS3PO2LB.js.map +1 -0
- package/dist/chunk-IQJA3EFO.js +179 -0
- package/dist/chunk-IQJA3EFO.js.map +1 -0
- package/dist/chunk-JY6KWRDB.js +80 -0
- package/dist/chunk-JY6KWRDB.js.map +1 -0
- package/dist/chunk-KWSGJUMZ.js +2501 -0
- package/dist/chunk-KWSGJUMZ.js.map +1 -0
- package/dist/chunk-LWYIPR64.js +35 -0
- package/dist/chunk-LWYIPR64.js.map +1 -0
- package/dist/chunk-OBY3UYCO.js +44 -0
- package/dist/chunk-OBY3UYCO.js.map +1 -0
- package/dist/chunk-XC6WHJRL.js +29 -0
- package/dist/chunk-XC6WHJRL.js.map +1 -0
- package/dist/chunk-XQU52JKB.js +187 -0
- package/dist/chunk-XQU52JKB.js.map +1 -0
- package/dist/clash-load-D3LNQR6G.js +941 -0
- package/dist/clash-load-D3LNQR6G.js.map +1 -0
- package/dist/cli.js +431 -0
- package/dist/cli.js.map +1 -0
- package/dist/dehydrate-ZHAGOI7Q.js +90 -0
- package/dist/dehydrate-ZHAGOI7Q.js.map +1 -0
- package/dist/diff-T2KOK2WR.js +89 -0
- package/dist/diff-T2KOK2WR.js.map +1 -0
- package/dist/engine-2TPWJVEQ.js +12 -0
- package/dist/engine-2TPWJVEQ.js.map +1 -0
- package/dist/hydrate-V24H7IF3.js +673 -0
- package/dist/hydrate-V24H7IF3.js.map +1 -0
- package/dist/import-ifc-RCZSXDA6.js +5324 -0
- package/dist/import-ifc-RCZSXDA6.js.map +1 -0
- package/dist/info-QC7YXWNX.js +92 -0
- package/dist/info-QC7YXWNX.js.map +1 -0
- package/dist/init-VWDML3UC.js +112 -0
- package/dist/init-VWDML3UC.js.map +1 -0
- package/dist/lib.d.ts +492 -0
- package/dist/lib.js +6528 -0
- package/dist/lib.js.map +1 -0
- package/dist/mep-W4HJI363.js +25 -0
- package/dist/mep-W4HJI363.js.map +1 -0
- package/dist/merge-ESOPDSA5.js +413 -0
- package/dist/merge-ESOPDSA5.js.map +1 -0
- package/dist/publish-3TAXQCUV.js +80 -0
- package/dist/publish-3TAXQCUV.js.map +1 -0
- package/dist/render-UEWYHPN6.js +1807 -0
- package/dist/render-UEWYHPN6.js.map +1 -0
- package/dist/resolve-topology-AQ2RO3W3.js +338 -0
- package/dist/resolve-topology-AQ2RO3W3.js.map +1 -0
- package/dist/spec/csv-schema/annotation/dimension.yaml +77 -0
- package/dist/spec/csv-schema/annotation/tag.yaml +44 -0
- package/dist/spec/csv-schema/annotation/text_note.yaml +52 -0
- package/dist/spec/csv-schema/architecture/ceiling.yaml +8 -1
- package/dist/spec/csv-schema/architecture/column.yaml +5 -1
- package/dist/spec/csv-schema/architecture/curtain_wall.yaml +45 -5
- package/dist/spec/csv-schema/architecture/door.yaml +5 -0
- package/dist/spec/csv-schema/architecture/furniture.yaml +28 -0
- package/dist/spec/csv-schema/architecture/opening.yaml +27 -6
- package/dist/spec/csv-schema/architecture/railing.yaml +35 -0
- package/dist/spec/csv-schema/architecture/roof.yaml +34 -1
- package/dist/spec/csv-schema/architecture/slab.yaml +19 -0
- package/dist/spec/csv-schema/architecture/space.yaml +11 -1
- package/dist/spec/csv-schema/architecture/stair.yaml +49 -0
- package/dist/spec/csv-schema/architecture/stair_landing.yaml +36 -0
- package/dist/spec/csv-schema/architecture/stair_run.yaml +31 -0
- package/dist/spec/csv-schema/architecture/wall.yaml +14 -1
- package/dist/spec/csv-schema/architecture/window.yaml +19 -0
- package/dist/spec/csv-schema/base/element.yaml +20 -11
- package/dist/spec/csv-schema/base/furniture_params.yaml +60 -0
- package/dist/spec/csv-schema/base/hosted_element.yaml +10 -2
- package/dist/spec/csv-schema/base/mep_connectable.yaml +23 -0
- package/dist/spec/csv-schema/base/mep_design.yaml +24 -0
- package/dist/spec/csv-schema/base/mep_insulated.yaml +9 -0
- package/dist/spec/csv-schema/base/mep_system_tag.yaml +12 -0
- package/dist/spec/csv-schema/base/point_element.yaml +1 -0
- package/dist/spec/csv-schema/base/section_profile.yaml +5 -0
- package/dist/spec/csv-schema/base/spatial_line_element.yaml +4 -2
- package/dist/spec/csv-schema/base/structural_section_profile.yaml +50 -0
- package/dist/spec/csv-schema/base/vertical_span.yaml +9 -3
- package/dist/spec/csv-schema/base/wall_bounded.yaml +21 -0
- package/dist/spec/csv-schema/grid.yaml +5 -0
- package/dist/spec/csv-schema/mep/cable_tray.yaml +10 -3
- package/dist/spec/csv-schema/mep/circuit.yaml +70 -0
- package/dist/spec/csv-schema/mep/conduit.yaml +2 -2
- package/dist/spec/csv-schema/mep/connector.yaml +112 -0
- package/dist/spec/csv-schema/mep/duct.yaml +10 -3
- package/dist/spec/csv-schema/mep/equipment.yaml +18 -1
- package/dist/spec/csv-schema/mep/mep_node.yaml +91 -2
- package/dist/spec/csv-schema/mep/mep_system.yaml +21 -0
- package/dist/spec/csv-schema/mep/pipe.yaml +27 -3
- package/dist/spec/csv-schema/mep/terminal.yaml +22 -1
- package/dist/spec/csv-schema/model_group.yaml +40 -0
- package/dist/spec/csv-schema/sheet/sheet.yaml +50 -0
- package/dist/spec/csv-schema/sheet/sheet_viewport.yaml +86 -0
- package/dist/spec/csv-schema/structure/beam.yaml +29 -1
- package/dist/spec/csv-schema/structure/beam_system.yaml +29 -0
- package/dist/spec/csv-schema/structure/brace.yaml +24 -1
- package/dist/spec/csv-schema/structure/foundation.yaml +40 -7
- package/dist/spec/csv-schema/structure/structure_column.yaml +19 -1
- package/dist/spec/csv-schema/structure/structure_slab.yaml +32 -0
- package/dist/spec/csv-schema/structure/structure_wall.yaml +22 -0
- package/dist/spec/csv-schema/types/beam_type.yaml +11 -0
- package/dist/spec/csv-schema/types/ceiling_type.yaml +6 -0
- package/dist/spec/csv-schema/types/column_type.yaml +12 -0
- package/dist/spec/csv-schema/types/curtain_wall_type.yaml +32 -0
- package/dist/spec/csv-schema/types/door_type.yaml +27 -0
- package/dist/spec/csv-schema/types/element_type.yaml +21 -0
- package/dist/spec/csv-schema/types/fenestration.yaml +16 -0
- package/dist/spec/csv-schema/types/foundation_type.yaml +36 -0
- package/dist/spec/csv-schema/types/furniture_type.yaml +11 -0
- package/dist/spec/csv-schema/types/layered_type.yaml +13 -0
- package/dist/spec/csv-schema/types/railing_type.yaml +40 -0
- package/dist/spec/csv-schema/types/roof_type.yaml +7 -0
- package/dist/spec/csv-schema/types/slab_type.yaml +9 -0
- package/dist/spec/csv-schema/types/type_layer.yaml +47 -0
- package/dist/spec/csv-schema/types/wall_type.yaml +6 -0
- package/dist/spec/csv-schema/types/window_type.yaml +31 -0
- package/dist/spec/csv-schema/underlay.yaml +73 -0
- package/dist/spec/csv-schema/view.yaml +36 -0
- package/dist/spec/duckdb-strategy.md +4 -3
- package/dist/spec/geojson-schema/readme.md +380 -0
- package/dist/spec/mep-port-conventions.md +190 -0
- package/dist/spec/migration-guide.md +1 -1
- package/dist/spec/project_metadata.schema.yaml +52 -4
- package/dist/spec/readme.md +356 -97
- package/dist/spec/starter-types/global/beam_type.csv +5 -0
- package/dist/spec/starter-types/global/ceiling_type.csv +3 -0
- package/dist/spec/starter-types/global/column_type.csv +5 -0
- package/dist/spec/starter-types/global/curtain_wall_type.csv +2 -0
- package/dist/spec/starter-types/global/door_type.csv +6 -0
- package/dist/spec/starter-types/global/foundation_type.csv +7 -0
- package/dist/spec/starter-types/global/furniture_type.csv +11 -0
- package/dist/spec/starter-types/global/railing_type.csv +5 -0
- package/dist/spec/starter-types/global/roof_type.csv +3 -0
- package/dist/spec/starter-types/global/slab_type.csv +4 -0
- package/dist/spec/starter-types/global/type_layer.csv +40 -0
- package/dist/spec/starter-types/global/wall_type.csv +8 -0
- package/dist/spec/starter-types/global/window_type.csv +6 -0
- package/dist/spec/svg-schema/readme.md +47 -1
- package/package.json +17 -5
- package/dist/index.js +0 -3366
- package/dist/index.js.map +0 -1
- package/dist/spec/csv-schema/base/mep_connected_segment.yaml +0 -17
- package/dist/spec/csv-schema/base/mep_system.yaml +0 -7
|
@@ -0,0 +1,2129 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
loadCatalog,
|
|
4
|
+
typeValues
|
|
5
|
+
} from "./chunk-XQU52JKB.js";
|
|
6
|
+
import {
|
|
7
|
+
parseGeoJsonFile
|
|
8
|
+
} from "./chunk-4SKM4RHY.js";
|
|
9
|
+
import {
|
|
10
|
+
readCsv
|
|
11
|
+
} from "./chunk-JY6KWRDB.js";
|
|
12
|
+
import {
|
|
13
|
+
discoverLayout
|
|
14
|
+
} from "./chunk-OBY3UYCO.js";
|
|
15
|
+
|
|
16
|
+
// src/geo/slab-slope.ts
|
|
17
|
+
function parseSlopeArrow(s) {
|
|
18
|
+
if (!s || !s.trim()) return null;
|
|
19
|
+
const parts = s.split(";");
|
|
20
|
+
const pts = parts.map((p) => p.split(",").map((v) => Number(v.trim())));
|
|
21
|
+
if (parts.length !== 2 || pts.some((p) => p.length !== 3 || p.some((v) => !Number.isFinite(v)))) {
|
|
22
|
+
return 'must be "tx,ty,tz;hx,hy,hz" (tail and head: plan x, y and the top height above the slab base)';
|
|
23
|
+
}
|
|
24
|
+
const [t, h] = pts;
|
|
25
|
+
if (Math.hypot(h[0] - t[0], h[1] - t[1]) < 1e-9) return "tail and head must be different plan points";
|
|
26
|
+
return { tail: { x: t[0], y: t[1], z: t[2] }, head: { x: h[0], y: h[1], z: h[2] } };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/curtain-grid.ts
|
|
30
|
+
var PANEL_KINDS = ["glass", "solid", "door", "double_door", "empty"];
|
|
31
|
+
var EPS = 1e-3;
|
|
32
|
+
var DEFAULT_CELLS = 3;
|
|
33
|
+
function parseNumberList(raw) {
|
|
34
|
+
const values = [];
|
|
35
|
+
const bad = [];
|
|
36
|
+
for (const tok of (raw ?? "").split(";")) {
|
|
37
|
+
const s = tok.trim();
|
|
38
|
+
if (!s) continue;
|
|
39
|
+
const n = Number(s);
|
|
40
|
+
if (Number.isFinite(n)) values.push(n);
|
|
41
|
+
else bad.push(s);
|
|
42
|
+
}
|
|
43
|
+
return { values, bad };
|
|
44
|
+
}
|
|
45
|
+
var RULE = /^(\d+|\*)\s*[:,]\s*(\d+|\*)\s*=\s*([a-z_]+)$/;
|
|
46
|
+
function parsePanels(raw) {
|
|
47
|
+
const rules = [];
|
|
48
|
+
const bad = [];
|
|
49
|
+
for (const tok of (raw ?? "").split(";")) {
|
|
50
|
+
const s = tok.trim();
|
|
51
|
+
if (!s) continue;
|
|
52
|
+
const m = RULE.exec(s);
|
|
53
|
+
if (!m) {
|
|
54
|
+
bad.push(s);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
rules.push({
|
|
58
|
+
col: m[1] === "*" ? "*" : Number(m[1]),
|
|
59
|
+
row: m[2] === "*" ? "*" : Number(m[2]),
|
|
60
|
+
kind: m[3]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return { rules, bad };
|
|
64
|
+
}
|
|
65
|
+
function gridLines(explicit, count, spacing, extent) {
|
|
66
|
+
if ((explicit ?? "").trim() !== "") {
|
|
67
|
+
const vals = parseNumberList(explicit).values.filter((v) => v > EPS && v < extent - EPS).sort((a, b) => a - b);
|
|
68
|
+
return vals.filter((v, i) => i === 0 || v - vals[i - 1] > EPS);
|
|
69
|
+
}
|
|
70
|
+
let cells = DEFAULT_CELLS;
|
|
71
|
+
if ((count ?? "").trim() !== "") {
|
|
72
|
+
cells = Math.max(1, parseInt(count, 10) || DEFAULT_CELLS);
|
|
73
|
+
} else {
|
|
74
|
+
const sp = parseFloat(spacing ?? "");
|
|
75
|
+
if (sp > EPS && extent > 0) {
|
|
76
|
+
const out = [];
|
|
77
|
+
for (let t = sp; t < extent - EPS && out.length < 1e3; t += sp) out.push(t);
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return Array.from({ length: cells - 1 }, (_, i) => extent * (i + 1) / cells);
|
|
82
|
+
}
|
|
83
|
+
function cellKinds(rules, cols, rows2) {
|
|
84
|
+
const out = Array.from({ length: cols }, () => Array(rows2).fill("glass"));
|
|
85
|
+
for (const r of rules) {
|
|
86
|
+
if (!PANEL_KINDS.includes(r.kind)) continue;
|
|
87
|
+
for (let c = 0; c < cols; c++) {
|
|
88
|
+
if (r.col !== "*" && r.col !== c) continue;
|
|
89
|
+
for (let w = 0; w < rows2; w++) {
|
|
90
|
+
if (r.row !== "*" && r.row !== w) continue;
|
|
91
|
+
out[c][w] = r.kind;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/curtain-embed.ts
|
|
99
|
+
var PARALLEL_SIN = 0.02;
|
|
100
|
+
var TAU = 2 * Math.PI;
|
|
101
|
+
function embedCircle(line) {
|
|
102
|
+
const arc = line.arc;
|
|
103
|
+
if (!arc) return null;
|
|
104
|
+
let r = Math.abs(arc.rx ?? arc.radius ?? 0);
|
|
105
|
+
const large = !!(arc.largeArc ?? arc.large_arc);
|
|
106
|
+
const x1p = (line.start.x - line.end.x) / 2, y1p = (line.start.y - line.end.y) / 2;
|
|
107
|
+
const d2 = x1p * x1p + y1p * y1p;
|
|
108
|
+
if (d2 < 1e-18) return null;
|
|
109
|
+
if (r * r < d2) r = Math.sqrt(d2);
|
|
110
|
+
let sq = Math.sqrt(Math.max(0, (r * r - d2) / d2));
|
|
111
|
+
if (large === !!arc.sweep) sq = -sq;
|
|
112
|
+
const cx = sq * y1p + (line.start.x + line.end.x) / 2;
|
|
113
|
+
const cy = -sq * x1p + (line.start.y + line.end.y) / 2;
|
|
114
|
+
const a0 = Math.atan2(line.start.y - cy, line.start.x - cx);
|
|
115
|
+
let sweep = Math.atan2(line.end.y - cy, line.end.x - cx) - a0;
|
|
116
|
+
if (arc.sweep && sweep <= 0) sweep += TAU;
|
|
117
|
+
if (!arc.sweep && sweep >= 0) sweep -= TAU;
|
|
118
|
+
return { cx, cy, r, a0, sweep };
|
|
119
|
+
}
|
|
120
|
+
function embedPointAt(line, s) {
|
|
121
|
+
const c = embedCircle(line);
|
|
122
|
+
if (c) {
|
|
123
|
+
const a = c.a0 + Math.sign(c.sweep) * s / c.r;
|
|
124
|
+
return { x: c.cx + c.r * Math.cos(a), y: c.cy + c.r * Math.sin(a) };
|
|
125
|
+
}
|
|
126
|
+
const l = Math.hypot(line.end.x - line.start.x, line.end.y - line.start.y) || 1;
|
|
127
|
+
return { x: line.start.x + (line.end.x - line.start.x) * s / l, y: line.start.y + (line.end.y - line.start.y) * s / l };
|
|
128
|
+
}
|
|
129
|
+
function curtainEmbedSpan(wall, thickness, cw, tol) {
|
|
130
|
+
if (!!wall.arc !== !!cw.arc) return null;
|
|
131
|
+
if (wall.arc) return arcEmbedSpan(wall, thickness, cw, tol);
|
|
132
|
+
const dx = wall.end.x - wall.start.x, dy = wall.end.y - wall.start.y;
|
|
133
|
+
const len2 = Math.hypot(dx, dy);
|
|
134
|
+
const cdx = cw.end.x - cw.start.x, cdy = cw.end.y - cw.start.y;
|
|
135
|
+
const clen = Math.hypot(cdx, cdy);
|
|
136
|
+
if (len2 < tol || clen < tol) return null;
|
|
137
|
+
const ux = dx / len2, uy = dy / len2;
|
|
138
|
+
if (Math.abs(ux * cdy - uy * cdx) / clen > PARALLEL_SIN) return null;
|
|
139
|
+
const half = thickness / 2 + tol;
|
|
140
|
+
const across = (p) => Math.abs(-(p.x - wall.start.x) * uy + (p.y - wall.start.y) * ux);
|
|
141
|
+
if (across(cw.start) > half || across(cw.end) > half) return null;
|
|
142
|
+
const along = (p) => (p.x - wall.start.x) * ux + (p.y - wall.start.y) * uy;
|
|
143
|
+
const a = along(cw.start), b = along(cw.end);
|
|
144
|
+
const lo = Math.max(0, Math.min(a, b)), hi = Math.min(len2, Math.max(a, b));
|
|
145
|
+
return hi - lo > tol ? { lo, hi } : null;
|
|
146
|
+
}
|
|
147
|
+
function arcEmbedSpan(wall, thickness, cw, tol) {
|
|
148
|
+
const w = embedCircle(wall), c = embedCircle(cw);
|
|
149
|
+
if (!w || !c) return null;
|
|
150
|
+
const half = thickness / 2 + tol;
|
|
151
|
+
if (Math.hypot(w.cx - c.cx, w.cy - c.cy) > half || Math.abs(w.r - c.r) > half) return null;
|
|
152
|
+
const dir = Math.sign(w.sweep);
|
|
153
|
+
const t0 = ((c.a0 - w.a0) * dir % TAU + TAU) % TAU;
|
|
154
|
+
const t1 = t0 + Math.abs(c.sweep) * (Math.sign(c.sweep) === dir ? 1 : -1);
|
|
155
|
+
let lo = Math.min(t0, t1), hi = Math.max(t0, t1);
|
|
156
|
+
const wl = Math.abs(w.sweep);
|
|
157
|
+
const overlap = (a, b) => Math.max(0, Math.min(wl, b) - Math.max(0, a));
|
|
158
|
+
if (overlap(lo - TAU, hi - TAU) > overlap(lo, hi)) {
|
|
159
|
+
lo -= TAU;
|
|
160
|
+
hi -= TAU;
|
|
161
|
+
}
|
|
162
|
+
const sLo = Math.max(0, lo) * w.r, sHi = Math.min(wl, hi) * w.r;
|
|
163
|
+
return sHi - sLo > tol ? { lo: sLo, hi: sHi } : null;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// src/validate/annotations.ts
|
|
167
|
+
var DIMENSION_ANCHORS = ["start", "end", "left", "right", "center"];
|
|
168
|
+
var NUMERIC_FIELDS = {
|
|
169
|
+
dimension: ["start_x", "start_y", "end_x", "end_y", "direction", "offset"],
|
|
170
|
+
text_note: ["x", "y", "size", "paper_size", "rotation"],
|
|
171
|
+
tag: ["x", "y"]
|
|
172
|
+
};
|
|
173
|
+
var ELEVATION_VIEW_IDS = ["north", "south", "east", "west"];
|
|
174
|
+
function isViewId(registry, viewId) {
|
|
175
|
+
return ELEVATION_VIEW_IDS.includes(viewId) || registry.allIds.get(viewId)?.table === "view";
|
|
176
|
+
}
|
|
177
|
+
function parseDimensionRef(ref) {
|
|
178
|
+
const colon = ref.lastIndexOf(":");
|
|
179
|
+
if (colon < 0) return { id: ref, anchor: "" };
|
|
180
|
+
const anchor = ref.slice(colon + 1);
|
|
181
|
+
if (!DIMENSION_ANCHORS.includes(anchor)) return { id: ref, anchor: "" };
|
|
182
|
+
return { id: ref.slice(0, colon), anchor };
|
|
183
|
+
}
|
|
184
|
+
function onLevel(registry, level, id) {
|
|
185
|
+
return registry.ids.has(`${level}/${id}`) || registry.ids.has(`global/${id}`);
|
|
186
|
+
}
|
|
187
|
+
function validateAnnotations(path, tableName, data, registry) {
|
|
188
|
+
const numeric = NUMERIC_FIELDS[tableName];
|
|
189
|
+
if (!numeric) return [];
|
|
190
|
+
const issues = [];
|
|
191
|
+
const level = path.split("/")[0];
|
|
192
|
+
for (let i = 0; i < data.rows.length; i++) {
|
|
193
|
+
const row = data.rows[i];
|
|
194
|
+
const at = `${path}:${i + 2}`;
|
|
195
|
+
const viewId = (row.view_id ?? "").trim();
|
|
196
|
+
if (level === "global") {
|
|
197
|
+
if (!viewId) issues.push(`${at} a ${tableName} in global/ needs a view_id (section id or north/south/east/west); plan annotations belong in a level directory`);
|
|
198
|
+
else if (!isViewId(registry, viewId)) issues.push(`${at} view_id "${viewId}" is neither a section of global/view.csv nor north/south/east/west`);
|
|
199
|
+
if (tableName === "dimension" && (row.start_ref || row.end_ref)) issues.push(`${at} view dimensions use fixed points \u2014 leave start_ref / end_ref empty`);
|
|
200
|
+
} else if (viewId) {
|
|
201
|
+
issues.push(`${at} view_id is set \u2014 annotations on a section / elevation belong in global/${tableName}.csv`);
|
|
202
|
+
}
|
|
203
|
+
for (const f of numeric) {
|
|
204
|
+
const v = row[f];
|
|
205
|
+
if (v !== void 0 && v !== "" && !Number.isFinite(Number(v))) {
|
|
206
|
+
issues.push(`${at} ${f}="${v}" is not a number`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (tableName === "dimension") {
|
|
210
|
+
for (const side of ["start_ref", "end_ref"]) {
|
|
211
|
+
const ref = (row[side] ?? "").trim();
|
|
212
|
+
if (!ref) continue;
|
|
213
|
+
const colon = ref.lastIndexOf(":");
|
|
214
|
+
if (colon >= 0 && !DIMENSION_ANCHORS.includes(ref.slice(colon + 1))) {
|
|
215
|
+
issues.push(`${at} ${side} "${ref}" has an unknown anchor \u2014 use <id>, or <id>:${DIMENSION_ANCHORS.join("|")}`);
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
const { id } = parseDimensionRef(ref);
|
|
219
|
+
if (!registry.allIds.has(id)) {
|
|
220
|
+
issues.push(`${at} ${side} "${ref}" references non-existent id`);
|
|
221
|
+
} else if (!onLevel(registry, level, id)) {
|
|
222
|
+
issues.push(`${at} ${side} "${ref}" is not on ${level} or in global/`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (!row.start_ref && !row.end_ref && row.start_x === row.end_x && row.start_y === row.end_y) {
|
|
226
|
+
issues.push(`${at} dimension start and end points coincide`);
|
|
227
|
+
}
|
|
228
|
+
} else if (tableName === "tag") {
|
|
229
|
+
const hasX = (row.x ?? "") !== "";
|
|
230
|
+
const hasY = (row.y ?? "") !== "";
|
|
231
|
+
if (hasX !== hasY) issues.push(`${at} set both x and y (pinned tag) or neither (tag follows its host)`);
|
|
232
|
+
const host = row.host_id ?? "";
|
|
233
|
+
if (host && registry.allIds.has(host) && !onLevel(registry, level, host)) {
|
|
234
|
+
issues.push(`${at} host_id "${host}" is not on ${level} or in global/`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return issues;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// src/stair/geometry.ts
|
|
242
|
+
var STAIR_CUT_HEIGHT = 1.2;
|
|
243
|
+
var RAIL_INSET = 0.05;
|
|
244
|
+
var sub = (a, b) => ({ x: a.x - b.x, y: a.y - b.y });
|
|
245
|
+
var add = (a, b, k = 1) => ({ x: a.x + b.x * k, y: a.y + b.y * k });
|
|
246
|
+
var dot = (a, b) => a.x * b.x + a.y * b.y;
|
|
247
|
+
var cross = (a, b) => a.x * b.y - a.y * b.x;
|
|
248
|
+
var len = (a) => Math.hypot(a.x, a.y);
|
|
249
|
+
var dist = (a, b) => Math.hypot(a.x - b.x, a.y - b.y);
|
|
250
|
+
var leftOf = (u) => ({ x: -u.y, y: u.x });
|
|
251
|
+
function totalRisers(asm) {
|
|
252
|
+
return asm.runs.reduce((s, r) => s + r.stepCount, 0) + asm.landings.reduce((s, l) => s + winderSteps(l), 0);
|
|
253
|
+
}
|
|
254
|
+
function winderSteps(l) {
|
|
255
|
+
return Math.max(0, Math.round(l.steps ?? 0));
|
|
256
|
+
}
|
|
257
|
+
function arcFromEnds(start, end, radius, largeArc, sweep) {
|
|
258
|
+
const d = dist(start, end);
|
|
259
|
+
if (d < 1e-9 || !(radius > 0)) return null;
|
|
260
|
+
const r = Math.max(radius, d / 2);
|
|
261
|
+
const m = { x: (start.x + end.x) / 2, y: (start.y + end.y) / 2 };
|
|
262
|
+
const h = Math.sqrt(Math.max(0, r * r - d / 2 * (d / 2)));
|
|
263
|
+
const u = { x: (end.x - start.x) / d, y: (end.y - start.y) / d };
|
|
264
|
+
const side = largeArc === sweep ? -1 : 1;
|
|
265
|
+
const c = add(m, leftOf(u), side * h);
|
|
266
|
+
const a0 = Math.atan2(start.y - c.y, start.x - c.x);
|
|
267
|
+
const a1 = Math.atan2(end.y - c.y, end.x - c.x);
|
|
268
|
+
let sw = a1 - a0;
|
|
269
|
+
if (sweep) {
|
|
270
|
+
while (sw <= 1e-12) sw += 2 * Math.PI;
|
|
271
|
+
} else {
|
|
272
|
+
while (sw >= -1e-12) sw -= 2 * Math.PI;
|
|
273
|
+
}
|
|
274
|
+
return { cx: c.x, cy: c.y, r, a0, sweep: sw };
|
|
275
|
+
}
|
|
276
|
+
function runAt(r, s, o = 0) {
|
|
277
|
+
if (!r.arc) return add(add(r.start, r.u, s), leftOf(r.u), o);
|
|
278
|
+
const { cx, cy, a0, sweep } = r.arc;
|
|
279
|
+
const sg = sweep >= 0 ? 1 : -1;
|
|
280
|
+
const a = a0 + sg * s / r.arc.r;
|
|
281
|
+
const rad = r.arc.r - sg * o;
|
|
282
|
+
return { x: cx + Math.cos(a) * rad, y: cy + Math.sin(a) * rad };
|
|
283
|
+
}
|
|
284
|
+
function runDir(r, s) {
|
|
285
|
+
if (!r.arc) return r.u;
|
|
286
|
+
const sg = r.arc.sweep >= 0 ? 1 : -1;
|
|
287
|
+
const a = r.arc.a0 + sg * s / r.arc.r;
|
|
288
|
+
return { x: -Math.sin(a) * sg, y: Math.cos(a) * sg };
|
|
289
|
+
}
|
|
290
|
+
function runSamples(r, extra = []) {
|
|
291
|
+
const n = r.arc ? Math.max(2, Math.ceil(Math.abs(r.arc.sweep) / (Math.PI / 36))) : 1;
|
|
292
|
+
const ts = /* @__PURE__ */ new Set();
|
|
293
|
+
for (let i = 0; i <= n; i++) ts.add(i / n);
|
|
294
|
+
for (const t of extra) if (t > 1e-9 && t < 1 - 1e-9) ts.add(t);
|
|
295
|
+
return [...ts].sort((a, b) => a - b);
|
|
296
|
+
}
|
|
297
|
+
function clipHalf(poly, p, d, sgn) {
|
|
298
|
+
const side = (q) => sgn * cross(d, sub(q, p));
|
|
299
|
+
const out = [];
|
|
300
|
+
for (let i = 0; i < poly.length; i++) {
|
|
301
|
+
const a = poly[i], b = poly[(i + 1) % poly.length];
|
|
302
|
+
const sa = side(a), sb = side(b);
|
|
303
|
+
if (sa >= -1e-12) out.push(a);
|
|
304
|
+
if (sa >= -1e-12 !== sb >= -1e-12) {
|
|
305
|
+
const t = sa / (sa - sb);
|
|
306
|
+
out.push({ x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t });
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return out;
|
|
310
|
+
}
|
|
311
|
+
function rayHits(poly, p, d) {
|
|
312
|
+
let t0 = Infinity, t1 = -Infinity;
|
|
313
|
+
for (let i = 0; i < poly.length; i++) {
|
|
314
|
+
const a = poly[i], b = poly[(i + 1) % poly.length];
|
|
315
|
+
const e = sub(b, a);
|
|
316
|
+
const den = cross(d, e);
|
|
317
|
+
if (Math.abs(den) < 1e-12) continue;
|
|
318
|
+
const w = sub(a, p);
|
|
319
|
+
const t = cross(w, e) / den;
|
|
320
|
+
const v = cross(w, d) / den;
|
|
321
|
+
if (t < -1e-9 || v < -1e-9 || v > 1 + 1e-9) continue;
|
|
322
|
+
t0 = Math.min(t0, Math.max(0, t));
|
|
323
|
+
t1 = Math.max(t1, t);
|
|
324
|
+
}
|
|
325
|
+
return t1 > 1e-9 ? { t0: Math.min(t0, t1), t1 } : null;
|
|
326
|
+
}
|
|
327
|
+
function turnPath(r, q, landing) {
|
|
328
|
+
const a = r.end, b = q.start;
|
|
329
|
+
const ur = runDir(r, r.length), uq = runDir(q, 0);
|
|
330
|
+
const x = lineIntersection(a, ur, b, uq);
|
|
331
|
+
if (x && dot(sub(x, a), ur) > -1e-6 && dot(sub(b, x), uq) > -1e-6 && dist(x, a) < 3 * r.width) return [a, x, b];
|
|
332
|
+
if (dot(ur, uq) < -0.5) {
|
|
333
|
+
const depth = landing ? Math.max(0, ...landing.vertices.map((v) => dot(sub(v, a), ur))) : r.width;
|
|
334
|
+
return [a, add(a, ur, depth / 2), add(b, uq, -depth / 2), b];
|
|
335
|
+
}
|
|
336
|
+
return [a, b];
|
|
337
|
+
}
|
|
338
|
+
function departingRun(asm, landing) {
|
|
339
|
+
const r = arrivingRun(asm, landing);
|
|
340
|
+
if (!r) return void 0;
|
|
341
|
+
const i = asm.runs.indexOf(r);
|
|
342
|
+
return i >= 0 ? asm.runs[i + 1] : void 0;
|
|
343
|
+
}
|
|
344
|
+
function winderGeometry(asm, landing) {
|
|
345
|
+
const k = winderSteps(landing);
|
|
346
|
+
if (k < 1) return null;
|
|
347
|
+
const r = arrivingRun(asm, landing);
|
|
348
|
+
const q = departingRun(asm, landing);
|
|
349
|
+
if (!r || !q) return null;
|
|
350
|
+
const riser = r.stepCount > 0 && Math.abs(r.endZ - r.startZ) > 1e-9 ? (r.endZ - r.startZ) / r.stepCount : (Math.min(q.startZ, q.endZ) - landing.top) / k;
|
|
351
|
+
const er = runDir(r, r.length), eq = runDir(q, 0);
|
|
352
|
+
const pivot = lineIntersection(r.end, leftOf(er), q.start, leftOf(eq)) ?? { x: (r.end.x + q.start.x) / 2, y: (r.end.y + q.start.y) / 2 };
|
|
353
|
+
const path = turnPath(r, q, landing);
|
|
354
|
+
const lens = [0];
|
|
355
|
+
for (let i = 1; i < path.length; i++) lens.push(lens[i - 1] + dist(path[i - 1], path[i]));
|
|
356
|
+
const L = lens[lens.length - 1];
|
|
357
|
+
if (L < 1e-6) return null;
|
|
358
|
+
const pathAt = (s) => {
|
|
359
|
+
for (let i = 1; i < path.length; i++) {
|
|
360
|
+
if (s <= lens[i] + 1e-12 || i === path.length - 1) {
|
|
361
|
+
const seg = lens[i] - lens[i - 1];
|
|
362
|
+
return add(path[i - 1], sub(path[i], path[i - 1]), seg > 1e-12 ? (s - lens[i - 1]) / seg : 0);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return path[path.length - 1];
|
|
366
|
+
};
|
|
367
|
+
const dirs = [];
|
|
368
|
+
for (let i = 0; i <= k; i++) {
|
|
369
|
+
let v = sub(pathAt(L * i / k), pivot);
|
|
370
|
+
if (len(v) < 1e-9) v = i === 0 ? er : eq;
|
|
371
|
+
const l = len(v);
|
|
372
|
+
dirs.push({ x: v.x / l, y: v.y / l });
|
|
373
|
+
}
|
|
374
|
+
const sgn = cross(dirs[0], sub(pathAt(L / 2), pivot)) >= 0 ? 1 : -1;
|
|
375
|
+
const lines = [];
|
|
376
|
+
for (let i = 1; i < k; i++) {
|
|
377
|
+
const h = rayHits(landing.vertices, pivot, dirs[i]);
|
|
378
|
+
if (h) lines.push({ a: add(pivot, dirs[i], h.t0), b: add(pivot, dirs[i], h.t1), z: landing.top + riser * (i + 1) });
|
|
379
|
+
}
|
|
380
|
+
const treads = [];
|
|
381
|
+
for (let i = 0; i < k; i++) {
|
|
382
|
+
const poly = clipHalf(clipHalf([...landing.vertices], pivot, dirs[i], sgn), pivot, dirs[i + 1], -sgn);
|
|
383
|
+
if (poly.length >= 3) treads.push({ poly, top: landing.top + riser * (i + 1) });
|
|
384
|
+
}
|
|
385
|
+
return { pivot, lines, treads, path: L, floor: landing.top - landing.thickness };
|
|
386
|
+
}
|
|
387
|
+
function pointPolygonDistance(p, poly) {
|
|
388
|
+
let inside = false;
|
|
389
|
+
let best = Infinity;
|
|
390
|
+
for (let i = 0, j = poly.length - 1; i < poly.length; j = i++) {
|
|
391
|
+
const a = poly[j], b = poly[i];
|
|
392
|
+
if (a.y > p.y !== b.y > p.y && p.x < (b.x - a.x) * (p.y - a.y) / (b.y - a.y) + a.x) inside = !inside;
|
|
393
|
+
best = Math.min(best, dist(p, closestOnSegment(p, a, b).point));
|
|
394
|
+
}
|
|
395
|
+
return inside ? 0 : best;
|
|
396
|
+
}
|
|
397
|
+
function closestOnSegment(p, a, b) {
|
|
398
|
+
const ab = sub(b, a);
|
|
399
|
+
const l2 = dot(ab, ab);
|
|
400
|
+
const t = l2 < 1e-12 ? 0 : Math.max(0, Math.min(1, dot(sub(p, a), ab) / l2));
|
|
401
|
+
return { point: add(a, ab, t), t };
|
|
402
|
+
}
|
|
403
|
+
function arrivingRun(asm, landing) {
|
|
404
|
+
let best;
|
|
405
|
+
let bestD = Infinity;
|
|
406
|
+
for (const r of asm.runs) {
|
|
407
|
+
const top = r.endZ >= r.startZ ? r.end : r.start;
|
|
408
|
+
const d = pointPolygonDistance(top, landing.vertices);
|
|
409
|
+
if (d < bestD - 1e-9) {
|
|
410
|
+
bestD = d;
|
|
411
|
+
best = r;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return best && bestD <= best.width * 1.5 ? best : void 0;
|
|
415
|
+
}
|
|
416
|
+
function stairRepetitions(attrs, levelId, levelElevation, levelElevations2) {
|
|
417
|
+
const base = { index: 0, levelId, dz: 0, scale: 1 };
|
|
418
|
+
const topId = attrs.multistory_top_level_id;
|
|
419
|
+
const top = topId ? levelElevations2.get(topId) : void 0;
|
|
420
|
+
if (top === void 0 || top <= levelElevation + 1e-6) return [base];
|
|
421
|
+
const above = [];
|
|
422
|
+
for (const [id, e] of levelElevations2) {
|
|
423
|
+
if (e > levelElevation + 1e-6 && e <= top + 1e-6 && !above.some((a) => Math.abs(a.e - e) < 1e-6)) above.push({ id, e });
|
|
424
|
+
}
|
|
425
|
+
above.sort((a, b) => a.e - b.e);
|
|
426
|
+
if (above.length < 1) return [base];
|
|
427
|
+
const elev = [levelElevation, ...above.map((a) => a.e)];
|
|
428
|
+
const ids = [levelId, ...above.map((a) => a.id)];
|
|
429
|
+
const h0 = elev[1] - elev[0];
|
|
430
|
+
const reps = [];
|
|
431
|
+
for (let i = 0; i + 1 < elev.length; i++) {
|
|
432
|
+
reps.push({ index: i, levelId: ids[i], dz: elev[i] - elev[0], scale: h0 > 1e-9 ? (elev[i + 1] - elev[i]) / h0 : 1 });
|
|
433
|
+
}
|
|
434
|
+
return reps;
|
|
435
|
+
}
|
|
436
|
+
function repZ(rep, z) {
|
|
437
|
+
return rep.dz + z * rep.scale;
|
|
438
|
+
}
|
|
439
|
+
function nosingZ(r, s) {
|
|
440
|
+
const g = r.length / r.stepCount;
|
|
441
|
+
const riser = (r.endZ - r.startZ) / r.stepCount;
|
|
442
|
+
if (s >= r.length - g) return r.endZ;
|
|
443
|
+
return r.startZ + riser + Math.max(0, s) * (riser / g);
|
|
444
|
+
}
|
|
445
|
+
function runEdgePoint(r, side, s) {
|
|
446
|
+
const o = (side === "left" ? 1 : -1) * r.width / 2;
|
|
447
|
+
const p = runAt(r, s, o);
|
|
448
|
+
return { x: p.x, y: p.y, z: nosingZ(r, s), run: { run: r, s } };
|
|
449
|
+
}
|
|
450
|
+
function runEdge(r, side, s0, s1) {
|
|
451
|
+
const knee = r.length - r.length / r.stepCount;
|
|
452
|
+
const pts = [runEdgePoint(r, side, s0)];
|
|
453
|
+
const inner = runSamples(r, [knee / r.length]).map((t) => t * r.length).filter((s) => s > s0 + 1e-6 && s < s1 - 1e-6);
|
|
454
|
+
for (const s of inner) pts.push(runEdgePoint(r, side, s));
|
|
455
|
+
pts.push(runEdgePoint(r, side, s1));
|
|
456
|
+
return pts;
|
|
457
|
+
}
|
|
458
|
+
function lineIntersection(p, u, q, v) {
|
|
459
|
+
const den = cross(u, v);
|
|
460
|
+
if (Math.abs(den) < 1e-9) return null;
|
|
461
|
+
const t = cross(sub(q, p), v) / den;
|
|
462
|
+
return add(p, u, t);
|
|
463
|
+
}
|
|
464
|
+
function boundaryLocation(p, poly) {
|
|
465
|
+
let best = { edge: 0, t: 0, point: poly[0], d: Infinity };
|
|
466
|
+
for (let i = 0; i < poly.length; i++) {
|
|
467
|
+
const c = closestOnSegment(p, poly[i], poly[(i + 1) % poly.length]);
|
|
468
|
+
const d = dist(p, c.point);
|
|
469
|
+
if (d < best.d) best = { edge: i, t: c.t, point: c.point, d };
|
|
470
|
+
}
|
|
471
|
+
return best;
|
|
472
|
+
}
|
|
473
|
+
var signedArea = (v) => {
|
|
474
|
+
let a = 0;
|
|
475
|
+
for (let i = 0; i < v.length; i++) a += cross(v[i], v[(i + 1) % v.length]);
|
|
476
|
+
return a / 2;
|
|
477
|
+
};
|
|
478
|
+
function walkLanding(poly, p, q, side) {
|
|
479
|
+
const ccw = signedArea(poly) > 0;
|
|
480
|
+
const forward = side === "right" === ccw;
|
|
481
|
+
const a = boundaryLocation(p, poly), b = boundaryLocation(q, poly);
|
|
482
|
+
const n = poly.length;
|
|
483
|
+
const out = [a.point];
|
|
484
|
+
if (a.edge === b.edge && (forward ? b.t >= a.t - 1e-9 : b.t <= a.t + 1e-9)) {
|
|
485
|
+
out.push(b.point);
|
|
486
|
+
return out;
|
|
487
|
+
}
|
|
488
|
+
let e = a.edge;
|
|
489
|
+
for (let guard = 0; guard <= n; guard++) {
|
|
490
|
+
if (forward) {
|
|
491
|
+
out.push(poly[(e + 1) % n]);
|
|
492
|
+
e = (e + 1) % n;
|
|
493
|
+
} else {
|
|
494
|
+
out.push(poly[e]);
|
|
495
|
+
e = (e - 1 + n) % n;
|
|
496
|
+
}
|
|
497
|
+
if (e === b.edge) break;
|
|
498
|
+
}
|
|
499
|
+
out.push(b.point);
|
|
500
|
+
return out;
|
|
501
|
+
}
|
|
502
|
+
function landingBetween(asm, a, b, tol) {
|
|
503
|
+
let best;
|
|
504
|
+
let bestD = Infinity;
|
|
505
|
+
for (const l of asm.landings) {
|
|
506
|
+
const d = Math.max(boundaryLocation(a, l.vertices).d, boundaryLocation(b, l.vertices).d);
|
|
507
|
+
if (d < bestD) {
|
|
508
|
+
bestD = d;
|
|
509
|
+
best = l;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
return best && bestD <= tol ? best : void 0;
|
|
513
|
+
}
|
|
514
|
+
function railChain(asm, side) {
|
|
515
|
+
const runs = asm.runs;
|
|
516
|
+
if (runs.length === 0) return [];
|
|
517
|
+
const chain = [];
|
|
518
|
+
const s0 = runs.map(() => 0);
|
|
519
|
+
const s1 = runs.map((r) => r.length);
|
|
520
|
+
const joins = runs.map(() => []);
|
|
521
|
+
const winderJoin = runs.map(() => false);
|
|
522
|
+
for (let k = 0; k + 1 < runs.length; k++) {
|
|
523
|
+
const r = runs[k], q = runs[k + 1];
|
|
524
|
+
const bk = runEdgePoint(r, side, r.length), aq = runEdgePoint(q, side, 0);
|
|
525
|
+
const landing = landingBetween(asm, bk, aq, 0.02 + 1e-6);
|
|
526
|
+
if (landing) {
|
|
527
|
+
joins[k] = walkLanding(landing.vertices, bk, aq, side).slice(1, -1);
|
|
528
|
+
winderJoin[k] = winderSteps(landing) > 0;
|
|
529
|
+
continue;
|
|
530
|
+
}
|
|
531
|
+
const ur = runDir(r, r.length), uq = runDir(q, 0);
|
|
532
|
+
if (r.arc || q.arc) continue;
|
|
533
|
+
const x = lineIntersection(bk, ur, aq, uq);
|
|
534
|
+
if (x && dist(x, bk) < 3 * r.width + r.length && dist(x, aq) < 3 * q.width + q.length) {
|
|
535
|
+
const tr = dot(sub(x, runEdgePoint(r, side, 0)), r.u);
|
|
536
|
+
const tq = dot(sub(x, runEdgePoint(q, side, 0)), q.u);
|
|
537
|
+
if (tr < r.length) s1[k] = Math.max(0, tr);
|
|
538
|
+
if (tq > 0) s0[k + 1] = Math.min(q.length, tq);
|
|
539
|
+
if (tr >= r.length || tq <= 0) joins[k] = [x];
|
|
540
|
+
continue;
|
|
541
|
+
}
|
|
542
|
+
if (dot(r.u, q.u) < -0.5) {
|
|
543
|
+
const outer = cross(r.u, sub(aq, bk)) * (side === "left" ? 1 : -1) < 0;
|
|
544
|
+
if (outer) {
|
|
545
|
+
const depth = Math.max(r.width, q.width);
|
|
546
|
+
joins[k] = [add(bk, r.u, depth), add(aq, q.u, -depth)];
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
for (let k = 0; k < runs.length; k++) {
|
|
551
|
+
const r = runs[k];
|
|
552
|
+
const edge = runEdge(r, side, s0[k], Math.max(s0[k], s1[k]));
|
|
553
|
+
chain.push(...edge);
|
|
554
|
+
if (k + 1 < runs.length) {
|
|
555
|
+
const z = Math.max(r.startZ, r.endZ);
|
|
556
|
+
if (winderJoin[k] && joins[k].length > 0) {
|
|
557
|
+
const from = edge[edge.length - 1];
|
|
558
|
+
const to = runEdgePoint(runs[k + 1], side, s0[k + 1]);
|
|
559
|
+
const path = [from, ...joins[k], to];
|
|
560
|
+
let total = 0;
|
|
561
|
+
for (let i = 1; i < path.length; i++) total += dist(path[i - 1], path[i]);
|
|
562
|
+
let acc = 0;
|
|
563
|
+
for (let i = 1; i + 1 < path.length; i++) {
|
|
564
|
+
acc += dist(path[i - 1], path[i]);
|
|
565
|
+
chain.push({ x: path[i].x, y: path[i].y, z: from.z + (to.z - from.z) * (total > 1e-9 ? acc / total : 0) });
|
|
566
|
+
}
|
|
567
|
+
} else {
|
|
568
|
+
for (const p of joins[k]) chain.push({ x: p.x, y: p.y, z });
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
return chain;
|
|
573
|
+
}
|
|
574
|
+
function offsetChain(pts, d) {
|
|
575
|
+
const groups = [];
|
|
576
|
+
for (let i = 0; i < pts.length; i++) {
|
|
577
|
+
const last = groups[groups.length - 1];
|
|
578
|
+
if (last && dist(last.p, pts[i]) < 1e-6) last.idx.push(i);
|
|
579
|
+
else groups.push({ p: { x: pts[i].x, y: pts[i].y }, idx: [i] });
|
|
580
|
+
}
|
|
581
|
+
const out = pts.map((p) => ({ ...p }));
|
|
582
|
+
if (groups.length < 2) return out;
|
|
583
|
+
const dirs = [];
|
|
584
|
+
for (let g = 0; g + 1 < groups.length; g++) {
|
|
585
|
+
const v = sub(groups[g + 1].p, groups[g].p);
|
|
586
|
+
const l = len(v);
|
|
587
|
+
dirs.push({ x: v.x / l, y: v.y / l });
|
|
588
|
+
}
|
|
589
|
+
for (let g = 0; g < groups.length; g++) {
|
|
590
|
+
const din = dirs[g - 1], dout = dirs[g];
|
|
591
|
+
let shift;
|
|
592
|
+
if (!din) shift = add({ x: 0, y: 0 }, leftOf(dout), d);
|
|
593
|
+
else if (!dout) shift = add({ x: 0, y: 0 }, leftOf(din), d);
|
|
594
|
+
else {
|
|
595
|
+
const n1 = leftOf(din), n2 = leftOf(dout);
|
|
596
|
+
const m = add(n1, n2);
|
|
597
|
+
const ml = len(m);
|
|
598
|
+
if (ml < 1e-6) shift = add({ x: 0, y: 0 }, n1, d);
|
|
599
|
+
else {
|
|
600
|
+
const mu = { x: m.x / ml, y: m.y / ml };
|
|
601
|
+
const k = Math.min(4, 1 / Math.max(0.25, dot(mu, n1)));
|
|
602
|
+
shift = add({ x: 0, y: 0 }, mu, d * k);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
for (const i of groups[g].idx) {
|
|
606
|
+
out[i].x += shift.x;
|
|
607
|
+
out[i].y += shift.y;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
return out;
|
|
611
|
+
}
|
|
612
|
+
function stairRailPath(asm, side, inset = RAIL_INSET) {
|
|
613
|
+
const chain = offsetChain(railChain(asm, side), side === "left" ? -inset : inset);
|
|
614
|
+
const segs = [];
|
|
615
|
+
for (let i = 0; i + 1 < chain.length; i++) {
|
|
616
|
+
const a = chain[i], b = chain[i + 1];
|
|
617
|
+
if (dist(a, b) < 1e-6 && Math.abs(a.z - b.z) < 1e-6) continue;
|
|
618
|
+
const seg = { a: { x: a.x, y: a.y, z: a.z }, b: { x: b.x, y: b.y, z: b.z } };
|
|
619
|
+
if (a.run && b.run && a.run.run === b.run.run && b.run.s > a.run.s + 1e-6) {
|
|
620
|
+
const r = a.run.run;
|
|
621
|
+
seg.run = {
|
|
622
|
+
going: r.length / r.stepCount,
|
|
623
|
+
riser: (r.endZ - r.startZ) / r.stepCount,
|
|
624
|
+
startZ: r.startZ,
|
|
625
|
+
s0: a.run.s,
|
|
626
|
+
s1: b.run.s,
|
|
627
|
+
steps: r.stepCount
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
segs.push(seg);
|
|
631
|
+
}
|
|
632
|
+
return segs;
|
|
633
|
+
}
|
|
634
|
+
function lineRailPath(start, end, startZ, endZ) {
|
|
635
|
+
return [{ a: { x: start.x, y: start.y, z: startZ }, b: { x: end.x, y: end.y, z: endZ } }];
|
|
636
|
+
}
|
|
637
|
+
function railPlan(segs) {
|
|
638
|
+
const out = [];
|
|
639
|
+
for (const s of segs) {
|
|
640
|
+
for (const p of [s.a, s.b]) {
|
|
641
|
+
const last = out[out.length - 1];
|
|
642
|
+
if (!last || dist(last, p) > 1e-6) out.push({ x: p.x, y: p.y });
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
return out;
|
|
646
|
+
}
|
|
647
|
+
function runPlan(r, cutZ) {
|
|
648
|
+
const hw = r.width / 2;
|
|
649
|
+
const at = (t, o) => runAt(r, r.length * t, o);
|
|
650
|
+
const goingUp = r.endZ > r.startZ;
|
|
651
|
+
const cut = goingUp && r.endZ - r.startZ > 1e-9 ? Math.max(0, Math.min(1, (cutZ - r.startZ) / (r.endZ - r.startZ))) : r.startZ >= cutZ ? 0 : 1;
|
|
652
|
+
const lines = [];
|
|
653
|
+
const ts = runSamples(r, [cut]);
|
|
654
|
+
for (const o of [hw, -hw]) {
|
|
655
|
+
for (let i = 0; i + 1 < ts.length; i++) {
|
|
656
|
+
lines.push({ a: at(ts[i], o), b: at(ts[i + 1], o), above: ts[i] >= cut - 1e-9, edge: true });
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
lines.push({ a: at(0, hw), b: at(0, -hw), above: cut <= 0, edge: true });
|
|
660
|
+
lines.push({ a: at(1, hw), b: at(1, -hw), above: cut < 1, edge: true });
|
|
661
|
+
for (let i = 1; i < r.stepCount; i++) {
|
|
662
|
+
const t = i / r.stepCount;
|
|
663
|
+
lines.push({ a: at(t, hw), b: at(t, -hw), above: t > cut + 1e-9 });
|
|
664
|
+
}
|
|
665
|
+
let breakLine;
|
|
666
|
+
if (cut > 0 && cut < 1) {
|
|
667
|
+
const z = Math.min(0.06, 0.25 / r.length);
|
|
668
|
+
breakLine = [at(cut - z, hw), at(cut - z / 4, hw * 0.1), at(cut + z / 4, -hw * 0.1), at(cut + z, -hw)];
|
|
669
|
+
}
|
|
670
|
+
const os = runSamples(r);
|
|
671
|
+
const outline2 = [...os.map((t) => at(t, hw)), ...[...os].reverse().map((t) => at(t, -hw))];
|
|
672
|
+
return { lines, outline: outline2, breakLine, cut };
|
|
673
|
+
}
|
|
674
|
+
function walkingLine(asm) {
|
|
675
|
+
const out = [];
|
|
676
|
+
const push = (p) => {
|
|
677
|
+
const last = out[out.length - 1];
|
|
678
|
+
if (!last || dist(last, p) > 1e-6) out.push(p);
|
|
679
|
+
};
|
|
680
|
+
const runs = asm.runs;
|
|
681
|
+
for (let k = 0; k < runs.length; k++) {
|
|
682
|
+
const r = runs[k];
|
|
683
|
+
for (const t of runSamples(r)) push(runAt(r, r.length * t));
|
|
684
|
+
const q = runs[k + 1];
|
|
685
|
+
if (!q) break;
|
|
686
|
+
for (const p of turnPath(r, q, landingBetween(asm, r.end, q.start, r.width)).slice(1, -1)) push(p);
|
|
687
|
+
}
|
|
688
|
+
return out;
|
|
689
|
+
}
|
|
690
|
+
var STAIR_LIMITS = {
|
|
691
|
+
riserMin: 0.15,
|
|
692
|
+
riserMax: 0.19,
|
|
693
|
+
goingMin: 0.26,
|
|
694
|
+
blondelMin: 0.6,
|
|
695
|
+
blondelMax: 0.65,
|
|
696
|
+
widthMin: 0.9
|
|
697
|
+
};
|
|
698
|
+
function stairCalc(asm, upm = 1, scales = [1]) {
|
|
699
|
+
if (asm.runs.length === 0) return null;
|
|
700
|
+
const risers = totalRisers(asm);
|
|
701
|
+
const z0 = Math.min(...asm.runs.map((r) => Math.min(r.startZ, r.endZ)));
|
|
702
|
+
const z1 = Math.max(...asm.runs.map((r) => Math.max(r.startZ, r.endZ)));
|
|
703
|
+
const rise = (z1 - z0) / upm;
|
|
704
|
+
const riser = risers > 0 ? rise / risers : 0;
|
|
705
|
+
let going = Infinity, goingAt = "";
|
|
706
|
+
let width = Infinity, widthAt = "";
|
|
707
|
+
for (const r of asm.runs) {
|
|
708
|
+
const g = r.length / r.stepCount / upm;
|
|
709
|
+
if (g < going) {
|
|
710
|
+
going = g;
|
|
711
|
+
goingAt = r.id;
|
|
712
|
+
}
|
|
713
|
+
if (r.width / upm < width) {
|
|
714
|
+
width = r.width / upm;
|
|
715
|
+
widthAt = r.id;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
for (const l of asm.landings) {
|
|
719
|
+
const w = winderGeometry(asm, l);
|
|
720
|
+
if (!w) continue;
|
|
721
|
+
const g = w.path / winderSteps(l) / upm;
|
|
722
|
+
if (g < going) {
|
|
723
|
+
going = g;
|
|
724
|
+
goingAt = l.id;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
let rMin = riser, rMax = riser;
|
|
728
|
+
for (const s of scales) {
|
|
729
|
+
rMin = Math.min(rMin, riser * s);
|
|
730
|
+
rMax = Math.max(rMax, riser * s);
|
|
731
|
+
}
|
|
732
|
+
const L = STAIR_LIMITS;
|
|
733
|
+
const riserBad = rMax > L.riserMax + 1e-9 ? rMax : rMin < L.riserMin - 1e-9 ? rMin : riser;
|
|
734
|
+
const blondel = 2 * riser + going;
|
|
735
|
+
let landingWorst = 0, landingAt = "";
|
|
736
|
+
for (const l of asm.landings) {
|
|
737
|
+
const r = arrivingRun(asm, l);
|
|
738
|
+
if (!r) continue;
|
|
739
|
+
const d = Math.abs(l.top - Math.max(r.startZ, r.endZ)) / upm;
|
|
740
|
+
if (d > landingWorst) {
|
|
741
|
+
landingWorst = d;
|
|
742
|
+
landingAt = l.id;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
const checks = [
|
|
746
|
+
{ key: "riser", ok: rMin >= L.riserMin - 1e-9 && rMax <= L.riserMax + 1e-9, value: riserBad },
|
|
747
|
+
{ key: "going", ok: going >= L.goingMin - 1e-9, value: going, where: goingAt },
|
|
748
|
+
{ key: "blondel", ok: blondel >= L.blondelMin - 1e-9 && blondel <= L.blondelMax + 1e-9, value: blondel },
|
|
749
|
+
{ key: "width", ok: width >= L.widthMin - 1e-9, value: width, where: widthAt }
|
|
750
|
+
];
|
|
751
|
+
if (asm.landings.length > 0) checks.push({ key: "landing", ok: landingWorst <= 0.01, value: landingWorst, where: landingAt || void 0 });
|
|
752
|
+
return { risers, rise, riser, going, blondel, width, checks };
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
// src/stair/model.ts
|
|
756
|
+
import { existsSync } from "fs";
|
|
757
|
+
import { join } from "path";
|
|
758
|
+
var num = (s, fallback) => {
|
|
759
|
+
const v = parseFloat(s ?? "");
|
|
760
|
+
return Number.isFinite(v) ? v : fallback;
|
|
761
|
+
};
|
|
762
|
+
function rows(dir, table) {
|
|
763
|
+
const out = /* @__PURE__ */ new Map();
|
|
764
|
+
const p = join(dir, `${table}.csv`);
|
|
765
|
+
if (!existsSync(p)) return out;
|
|
766
|
+
try {
|
|
767
|
+
readCsv(p).rows.forEach((row, i) => {
|
|
768
|
+
if (row.id) out.set(row.id, { row, line: i + 2 });
|
|
769
|
+
});
|
|
770
|
+
} catch {
|
|
771
|
+
}
|
|
772
|
+
return out;
|
|
773
|
+
}
|
|
774
|
+
function features(dir, table) {
|
|
775
|
+
const out = /* @__PURE__ */ new Map();
|
|
776
|
+
const p = join(dir, `${table}.geojson`);
|
|
777
|
+
if (!existsSync(p)) return out;
|
|
778
|
+
try {
|
|
779
|
+
for (const f of parseGeoJsonFile(p).features) if (f.properties?.id) out.set(String(f.properties.id), f);
|
|
780
|
+
} catch {
|
|
781
|
+
}
|
|
782
|
+
return out;
|
|
783
|
+
}
|
|
784
|
+
function runFrom(id, table, row, f, elevation) {
|
|
785
|
+
if (!f || f.geometry.type !== "LineString") return null;
|
|
786
|
+
const c = f.geometry.coordinates;
|
|
787
|
+
if (c.length < 2) return null;
|
|
788
|
+
const a = c[0], b = c[c.length - 1];
|
|
789
|
+
const start = { x: a[0], y: a[1] }, end = { x: b[0], y: b[1] };
|
|
790
|
+
const chord = Math.hypot(end.x - start.x, end.y - start.y);
|
|
791
|
+
if (chord < 1e-3) return null;
|
|
792
|
+
const h = f.properties.arc;
|
|
793
|
+
const arc = h && typeof h.radius === "number" ? arcFromEnds(start, end, h.radius, h.large_arc === true, h.sweep === true) ?? void 0 : void 0;
|
|
794
|
+
return {
|
|
795
|
+
id,
|
|
796
|
+
table,
|
|
797
|
+
start,
|
|
798
|
+
end,
|
|
799
|
+
startZ: (a[2] ?? 0) - elevation,
|
|
800
|
+
endZ: (b[2] ?? 0) - elevation,
|
|
801
|
+
width: num(row.width, 1.2) || 1.2,
|
|
802
|
+
stepCount: Math.max(1, Math.round(num(row.step_count, 18)) || 18),
|
|
803
|
+
length: arc ? Math.abs(arc.sweep) * arc.r : chord,
|
|
804
|
+
u: { x: (end.x - start.x) / chord, y: (end.y - start.y) / chord },
|
|
805
|
+
...arc ? { arc } : {}
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
function landingFrom(id, row, f) {
|
|
809
|
+
if (!f || f.geometry.type !== "Polygon") return null;
|
|
810
|
+
const ring = f.geometry.coordinates[0] ?? [];
|
|
811
|
+
const vertices = ring.map((p) => ({ x: p[0], y: p[1] }));
|
|
812
|
+
if (vertices.length > 1) {
|
|
813
|
+
const a = vertices[0], b = vertices[vertices.length - 1];
|
|
814
|
+
if (a.x === b.x && a.y === b.y) vertices.pop();
|
|
815
|
+
}
|
|
816
|
+
if (vertices.length < 3) return null;
|
|
817
|
+
const top = num(row.base_offset, typeof f.properties.base_offset === "number" ? f.properties.base_offset : 0);
|
|
818
|
+
const steps = Math.round(num(row.step_count, 0));
|
|
819
|
+
return { id, vertices, top, thickness: num(row.thickness, 0.15) || 0.15, ...steps > 0 ? { steps } : {} };
|
|
820
|
+
}
|
|
821
|
+
function levelElevations(globalDir) {
|
|
822
|
+
const out = /* @__PURE__ */ new Map();
|
|
823
|
+
for (const [id, { row }] of rows(globalDir, "level")) out.set(id, num(row.elevation, 0));
|
|
824
|
+
return out;
|
|
825
|
+
}
|
|
826
|
+
function loadStairs(projectDir) {
|
|
827
|
+
const layout = discoverLayout(projectDir);
|
|
828
|
+
const elevations = levelElevations(layout.globalDir);
|
|
829
|
+
const catalog = loadCatalog(projectDir);
|
|
830
|
+
const dirs = [{ name: "global", path: layout.globalDir }, ...layout.levelDirs];
|
|
831
|
+
const globalStairs = /* @__PURE__ */ new Map();
|
|
832
|
+
const out = [];
|
|
833
|
+
for (const d of dirs) {
|
|
834
|
+
if (!existsSync(d.path)) continue;
|
|
835
|
+
const elevation = d.name === "global" ? 0 : elevations.get(d.name) ?? 0;
|
|
836
|
+
const stairRows = rows(d.path, "stair"), stairFeats = features(d.path, "stair");
|
|
837
|
+
const runRows = rows(d.path, "stair_run"), runFeats = features(d.path, "stair_run");
|
|
838
|
+
const landRows = rows(d.path, "stair_landing"), landFeats = features(d.path, "stair_landing");
|
|
839
|
+
const stairs = /* @__PURE__ */ new Map();
|
|
840
|
+
const extra = /* @__PURE__ */ new Map();
|
|
841
|
+
const lands = /* @__PURE__ */ new Map();
|
|
842
|
+
const orphans = [];
|
|
843
|
+
const known = (h) => stairRows.has(h) || globalStairs.has(h);
|
|
844
|
+
for (const [id, { row, line }] of runRows) {
|
|
845
|
+
if (!known(row.host_id ?? "")) {
|
|
846
|
+
orphans.push({ table: "stair_run", id, hostId: row.host_id ?? "", line });
|
|
847
|
+
continue;
|
|
848
|
+
}
|
|
849
|
+
const r = runFrom(id, "stair_run", row, runFeats.get(id), elevation);
|
|
850
|
+
if (r) (extra.get(row.host_id) ?? extra.set(row.host_id, []).get(row.host_id)).push(r);
|
|
851
|
+
}
|
|
852
|
+
for (const [id, { row, line }] of landRows) {
|
|
853
|
+
if (!known(row.host_id ?? "")) {
|
|
854
|
+
orphans.push({ table: "stair_landing", id, hostId: row.host_id ?? "", line });
|
|
855
|
+
continue;
|
|
856
|
+
}
|
|
857
|
+
const l = landingFrom(id, row, landFeats.get(id));
|
|
858
|
+
if (l) (lands.get(row.host_id) ?? lands.set(row.host_id, []).get(row.host_id)).push(l);
|
|
859
|
+
}
|
|
860
|
+
for (const [id, { row, line }] of stairRows) {
|
|
861
|
+
const own = runFrom(id, "stair", row, stairFeats.get(id), elevation);
|
|
862
|
+
const more = (extra.get(id) ?? []).sort((a, b) => Math.min(a.startZ, a.endZ) - Math.min(b.startZ, b.endZ));
|
|
863
|
+
const ownIsRun = !!own && !(more.length > 0 && Math.abs(Math.min(own.startZ, own.endZ) - Math.min(...more.map((r) => Math.min(r.startZ, r.endZ)))) < 1e-3 && Math.abs(Math.max(own.startZ, own.endZ) - Math.max(...more.map((r) => Math.max(r.startZ, r.endZ)))) < 1e-3);
|
|
864
|
+
const asm = { stairId: id, runs: [...own && ownIsRun ? [own] : [], ...more], landings: lands.get(id) ?? [], ownIsRun };
|
|
865
|
+
const reps = d.name === "global" ? [{ index: 0, levelId: "", dz: 0, scale: 1 }] : stairRepetitions(row, d.name, elevation, elevations);
|
|
866
|
+
const m = { id, line, row, asm, reps };
|
|
867
|
+
stairs.set(id, m);
|
|
868
|
+
if (d.name === "global") globalStairs.set(id, m);
|
|
869
|
+
}
|
|
870
|
+
const railRows = rows(d.path, "railing"), railFeats = features(d.path, "railing");
|
|
871
|
+
const slabTops = /* @__PURE__ */ new Map();
|
|
872
|
+
for (const t of ["slab", "structure_slab"]) {
|
|
873
|
+
const feats = features(d.path, t);
|
|
874
|
+
for (const [id, { row }] of rows(d.path, t)) {
|
|
875
|
+
const f = feats.get(id);
|
|
876
|
+
slabTops.set(id, num(row.base_offset, typeof f?.properties.base_offset === "number" ? f.properties.base_offset : 0));
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
const railings = [];
|
|
880
|
+
for (const [id, { row, line }] of railRows) {
|
|
881
|
+
const t = row.type_id ? catalog.types.get(row.type_id) : void 0;
|
|
882
|
+
const tv = t && t.table === "railing_type" ? typeValues(t) : {};
|
|
883
|
+
const height = num(row.height, num(tv.height, 1));
|
|
884
|
+
const hostId = row.host_id ?? "";
|
|
885
|
+
const stair = stairs.get(hostId) ?? globalStairs.get(hostId);
|
|
886
|
+
const f = railFeats.get(id);
|
|
887
|
+
if (stair) {
|
|
888
|
+
const side = row.side === "right" ? "right" : "left";
|
|
889
|
+
const base = stairRailPath(stair.asm, side);
|
|
890
|
+
const paths2 = stair.reps.map((rep) => base.map((s) => ({
|
|
891
|
+
a: { ...s.a, z: repZ(rep, s.a.z) },
|
|
892
|
+
b: { ...s.b, z: repZ(rep, s.b.z) },
|
|
893
|
+
run: s.run && { ...s.run, startZ: repZ(rep, s.run.startZ), riser: s.run.riser * rep.scale }
|
|
894
|
+
})));
|
|
895
|
+
railings.push({ id, line, row, host: "stair", side, paths: paths2, height });
|
|
896
|
+
continue;
|
|
897
|
+
}
|
|
898
|
+
const host = hostId ? slabTops.has(hostId) ? "slab" : "missing" : null;
|
|
899
|
+
let paths = [];
|
|
900
|
+
if (f && f.geometry.type === "LineString" && f.geometry.coordinates.length >= 2) {
|
|
901
|
+
const c = f.geometry.coordinates;
|
|
902
|
+
const segs = [];
|
|
903
|
+
for (let i = 0; i + 1 < c.length; i++) {
|
|
904
|
+
const z0 = host === "slab" ? slabTops.get(hostId) : (c[i][2] ?? elevation) - elevation;
|
|
905
|
+
const z1 = host === "slab" ? slabTops.get(hostId) : (c[i + 1][2] ?? elevation) - elevation;
|
|
906
|
+
segs.push(...lineRailPath({ x: c[i][0], y: c[i][1] }, { x: c[i + 1][0], y: c[i + 1][1] }, z0, z1));
|
|
907
|
+
}
|
|
908
|
+
paths = [segs];
|
|
909
|
+
}
|
|
910
|
+
railings.push({ id, line, row, host, paths, height });
|
|
911
|
+
}
|
|
912
|
+
out.push({ dir: d.name, elevation, stairs: [...stairs.values()], orphans, railings });
|
|
913
|
+
}
|
|
914
|
+
return out;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// src/furniture/library.ts
|
|
918
|
+
var CATEGORY_LABELS = {
|
|
919
|
+
furniture: { en: "Furniture", zh: "\u5BB6\u5177", ifc: "IfcFurniture", revit: "Furniture" },
|
|
920
|
+
casework: { en: "Casework", zh: "\u6A71\u67DC", ifc: "IfcFurniture", revit: "Casework" },
|
|
921
|
+
appliance: { en: "Appliances", zh: "\u5BB6\u7535", ifc: "IfcElectricAppliance", revit: "Specialty Equipment" },
|
|
922
|
+
specialty: { en: "Specialty", zh: "\u4E13\u7528\u8BBE\u5907", ifc: "IfcFurnishingElement", revit: "Specialty Equipment" },
|
|
923
|
+
vehicle: { en: "Vehicles & Parking", zh: "\u8F66\u8F86\u4E0E\u8F66\u4F4D", ifc: "IfcBuildingElementProxy", revit: "Parking" },
|
|
924
|
+
planting: { en: "Planting", zh: "\u690D\u7269", ifc: "IfcGeographicElement", revit: "Planting" },
|
|
925
|
+
entourage: { en: "People", zh: "\u4EBA\u7269", ifc: "IfcBuildingElementProxy", revit: "Entourage" },
|
|
926
|
+
generic: { en: "Generic", zh: "\u901A\u7528\u5360\u4F4D", ifc: "IfcBuildingElementProxy", revit: "Generic Models" }
|
|
927
|
+
};
|
|
928
|
+
var CATEGORY_ORDER = [
|
|
929
|
+
"furniture",
|
|
930
|
+
"casework",
|
|
931
|
+
"appliance",
|
|
932
|
+
"specialty",
|
|
933
|
+
"vehicle",
|
|
934
|
+
"planting",
|
|
935
|
+
"entourage",
|
|
936
|
+
"generic"
|
|
937
|
+
];
|
|
938
|
+
var clamp = (v, lo, hi) => Math.max(lo, Math.min(hi, v));
|
|
939
|
+
function rc(cx, cy, w, h, o = {}) {
|
|
940
|
+
return { k: "rect", x: cx - w / 2, y: cy - h / 2, w, h, ...o };
|
|
941
|
+
}
|
|
942
|
+
function ln(x1, y1, x2, y2, dash) {
|
|
943
|
+
return dash ? { k: "line", x1, y1, x2, y2, dash } : { k: "line", x1, y1, x2, y2 };
|
|
944
|
+
}
|
|
945
|
+
function box(x, y, z, w, d, h, c) {
|
|
946
|
+
return { k: "box", x, y, z, w, d, h, c };
|
|
947
|
+
}
|
|
948
|
+
function cyl(x, y, z, r, h, c, top, seg) {
|
|
949
|
+
return { k: "cyl", x, y, z, rx: r, ry: r, h, c, ...top !== void 0 ? { top } : {}, ...seg ? { seg } : {} };
|
|
950
|
+
}
|
|
951
|
+
function outline(p, r = 0) {
|
|
952
|
+
return rc(0, 0, p.w, p.d, { fill: "paper", ...r ? { r } : {} });
|
|
953
|
+
}
|
|
954
|
+
function modules(w, module) {
|
|
955
|
+
return Math.max(1, Math.round(w / module));
|
|
956
|
+
}
|
|
957
|
+
function legs(w, d, top, s, c, inset = 0.04) {
|
|
958
|
+
const x = w / 2 - inset - s / 2, y = d / 2 - inset - s / 2;
|
|
959
|
+
return [[-x, -y], [x, -y], [-x, y], [x, y]].map(([lx, ly]) => box(lx, ly, 0, s, s, top, c));
|
|
960
|
+
}
|
|
961
|
+
function tablePlan(p) {
|
|
962
|
+
if (p.variant === "round") return [{ k: "ellipse", cx: 0, cy: 0, rx: p.w / 2, ry: p.d / 2, fill: "paper" }];
|
|
963
|
+
if (p.variant === "racetrack") {
|
|
964
|
+
const r = Math.min(p.w, p.d) / 2;
|
|
965
|
+
return [rc(0, 0, p.w, p.d, { r, fill: "paper" })];
|
|
966
|
+
}
|
|
967
|
+
return [outline(p)];
|
|
968
|
+
}
|
|
969
|
+
function tableMass(p, c = "woodLight") {
|
|
970
|
+
const t = 0.03, top = p.h - t;
|
|
971
|
+
if (p.variant === "round") {
|
|
972
|
+
return [
|
|
973
|
+
{ k: "cyl", x: 0, y: 0, z: top, rx: p.w / 2, ry: p.d / 2, h: t, c, seg: 24 },
|
|
974
|
+
cyl(0, 0, 0, 0.05, top, "metal", 1, 8),
|
|
975
|
+
{ k: "cyl", x: 0, y: 0, z: 0, rx: Math.min(p.w, p.d) * 0.25, ry: Math.min(p.w, p.d) * 0.25, h: 0.03, c: "metal", seg: 16 }
|
|
976
|
+
];
|
|
977
|
+
}
|
|
978
|
+
if (p.variant === "racetrack") {
|
|
979
|
+
const r = Math.min(p.w, p.d) / 2;
|
|
980
|
+
const long = p.w >= p.d;
|
|
981
|
+
const core = long ? p.w - 2 * r : p.d - 2 * r;
|
|
982
|
+
const parts = [
|
|
983
|
+
box(0, 0, top, long ? core : p.w, long ? p.d : core, t, c),
|
|
984
|
+
cyl(long ? -core / 2 : 0, long ? 0 : -core / 2, top, r, t, c, 1, 16),
|
|
985
|
+
cyl(long ? core / 2 : 0, long ? 0 : core / 2, top, r, t, c, 1, 16)
|
|
986
|
+
];
|
|
987
|
+
const off = core / 2 * 0.7;
|
|
988
|
+
parts.push(box(long ? -off : 0, long ? 0 : -off, 0, 0.08, 0.08, top, "metal"));
|
|
989
|
+
parts.push(box(long ? off : 0, long ? 0 : off, 0, 0.08, 0.08, top, "metal"));
|
|
990
|
+
return parts;
|
|
991
|
+
}
|
|
992
|
+
return [box(0, 0, top, p.w, p.d, t, c), ...legs(p.w, p.d, top, 0.05, "metal")];
|
|
993
|
+
}
|
|
994
|
+
function sofaPlan(p, seats) {
|
|
995
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
996
|
+
const arm = clamp(p.w * 0.09, 0.12, 0.2), back = clamp(p.d * 0.22, 0.15, 0.25);
|
|
997
|
+
const out = [];
|
|
998
|
+
if (p.variant === "l_shape") {
|
|
999
|
+
const sd = Math.min(0.95, p.d);
|
|
1000
|
+
const y0 = hd - sd;
|
|
1001
|
+
out.push({ k: "poly", closed: true, fill: "paper", pts: [[-hw, hd], [hw, hd], [hw, -hd], [hw - sd, -hd], [hw - sd, y0], [-hw, y0]] });
|
|
1002
|
+
out.push(ln(-hw + arm, hd - back, hw - back, hd - back));
|
|
1003
|
+
out.push(ln(hw - back, hd - back, hw - back, -hd + arm));
|
|
1004
|
+
out.push(rc(-hw + arm / 2, (y0 + hd - back) / 2, arm, hd - back - y0, { r: 0.04 }));
|
|
1005
|
+
out.push(rc(hw - (sd + back) / 2, -hd + arm / 2, sd - back, arm, { r: 0.04 }));
|
|
1006
|
+
out.push(ln(hw - sd, y0, hw - sd, hd - back));
|
|
1007
|
+
const n = Math.max(1, seats - 1);
|
|
1008
|
+
const span2 = hw - sd - (-hw + arm);
|
|
1009
|
+
for (let i = 1; i < n; i++) {
|
|
1010
|
+
const x = -hw + arm + span2 * i / n;
|
|
1011
|
+
out.push(ln(x, hd - back, x, y0 + 0.04));
|
|
1012
|
+
}
|
|
1013
|
+
return out;
|
|
1014
|
+
}
|
|
1015
|
+
out.push(outline(p, 0.04));
|
|
1016
|
+
out.push(ln(-hw + arm, hd - back, hw - arm, hd - back));
|
|
1017
|
+
out.push(ln(-hw + arm, hd - back, -hw + arm, -hd + 0.02));
|
|
1018
|
+
out.push(ln(hw - arm, hd - back, hw - arm, -hd + 0.02));
|
|
1019
|
+
const span = p.w - 2 * arm;
|
|
1020
|
+
for (let i = 1; i < seats; i++) {
|
|
1021
|
+
const x = -hw + arm + span * i / seats;
|
|
1022
|
+
out.push(ln(x, hd - back, x, -hd + 0.04));
|
|
1023
|
+
}
|
|
1024
|
+
return out;
|
|
1025
|
+
}
|
|
1026
|
+
function sofaMass(p, c = "fabric") {
|
|
1027
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1028
|
+
const arm = clamp(p.w * 0.09, 0.12, 0.2), back = clamp(p.d * 0.22, 0.15, 0.25);
|
|
1029
|
+
const seatH = Math.min(0.44, p.h * 0.55), armH = Math.min(0.62, p.h * 0.78);
|
|
1030
|
+
if (p.variant === "l_shape") {
|
|
1031
|
+
const sd = Math.min(0.95, p.d);
|
|
1032
|
+
const y0 = hd - sd;
|
|
1033
|
+
const parts = [
|
|
1034
|
+
box(0, hd - sd / 2, 0.08, p.w, sd, seatH - 0.08, c),
|
|
1035
|
+
box(0, hd - back / 2, seatH, p.w, back, p.h - seatH, c),
|
|
1036
|
+
box(hw - back / 2, -back / 2, seatH, back, p.d - back, p.h - seatH, c),
|
|
1037
|
+
box(-hw + arm / 2, (y0 + hd - back) / 2, seatH, arm, hd - back - y0, armH - seatH, c)
|
|
1038
|
+
];
|
|
1039
|
+
if (y0 + hd > 0.01) {
|
|
1040
|
+
parts.push(box(hw - sd / 2, (y0 - hd) / 2, 0.08, sd, y0 + hd, seatH - 0.08, c));
|
|
1041
|
+
parts.push(box(hw - (sd + back) / 2, -hd + arm / 2, seatH, sd - back, arm, armH - seatH, c));
|
|
1042
|
+
}
|
|
1043
|
+
return parts;
|
|
1044
|
+
}
|
|
1045
|
+
return [
|
|
1046
|
+
box(0, 0, 0.08, p.w, p.d, seatH - 0.08, c),
|
|
1047
|
+
box(0, hd - back / 2, seatH, p.w, back, p.h - seatH, c),
|
|
1048
|
+
box(-hw + arm / 2, -back / 2, seatH, arm, p.d - back, armH - seatH, c),
|
|
1049
|
+
box(hw - arm / 2, -back / 2, seatH, arm, p.d - back, armH - seatH, c),
|
|
1050
|
+
...legs(p.w, p.d, 0.08, 0.05, "dark", 0.03)
|
|
1051
|
+
];
|
|
1052
|
+
}
|
|
1053
|
+
function counterRunMass(p, top = "counter") {
|
|
1054
|
+
const t = 0.04, kick = 0.1, recess = 0.05;
|
|
1055
|
+
return [
|
|
1056
|
+
box(0, recess / 2, 0, p.w - 0.02, p.d - recess - 0.02, kick, "dark"),
|
|
1057
|
+
box(0, 0.01, kick, p.w - 0.01, p.d - 0.03, p.h - t - kick, "white"),
|
|
1058
|
+
box(0, 0, p.h - t, p.w, p.d, t, top)
|
|
1059
|
+
];
|
|
1060
|
+
}
|
|
1061
|
+
var FAMILIES = [
|
|
1062
|
+
// ── Furniture ─────────────────────────────────────────────────────────────
|
|
1063
|
+
{
|
|
1064
|
+
id: "desk",
|
|
1065
|
+
category: "furniture",
|
|
1066
|
+
en: "Desk",
|
|
1067
|
+
zh: "\u529E\u516C\u684C",
|
|
1068
|
+
keywords: "desk table workstation office \u4E66\u684C \u5DE5\u4F4D \u5199\u5B57\u53F0",
|
|
1069
|
+
size: [1.4, 0.7, 0.75],
|
|
1070
|
+
wallBacked: true,
|
|
1071
|
+
variants: [
|
|
1072
|
+
{ id: "standard", en: "Standard", zh: "\u6807\u51C6" },
|
|
1073
|
+
{ id: "pedestal", en: "With pedestal", zh: "\u5E26\u62BD\u5C49\u67DC" },
|
|
1074
|
+
{ id: "l_shape", en: "L-shape", zh: "L \u5F62", size: [1.6, 1.4, 0.75] }
|
|
1075
|
+
],
|
|
1076
|
+
ifc: "IfcFurniture.DESK",
|
|
1077
|
+
revit: "Furniture",
|
|
1078
|
+
plan(p) {
|
|
1079
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1080
|
+
if (p.variant === "l_shape") {
|
|
1081
|
+
const td = Math.min(0.7, p.d), rw = Math.min(0.6, p.w);
|
|
1082
|
+
return [
|
|
1083
|
+
{ k: "poly", closed: true, fill: "paper", pts: [[-hw, hd], [hw, hd], [hw, -hd], [hw - rw, -hd], [hw - rw, hd - td], [-hw, hd - td]] },
|
|
1084
|
+
ln(hw - rw, hd - td, hw - rw, hd, true)
|
|
1085
|
+
];
|
|
1086
|
+
}
|
|
1087
|
+
const out = [outline(p)];
|
|
1088
|
+
if (p.variant === "pedestal") {
|
|
1089
|
+
const pw = Math.min(0.42, p.w * 0.35);
|
|
1090
|
+
out.push(rc(hw - pw / 2 - 0.03, 0.02, pw, p.d - 0.1, { dash: true }));
|
|
1091
|
+
}
|
|
1092
|
+
return out;
|
|
1093
|
+
},
|
|
1094
|
+
mass(p) {
|
|
1095
|
+
const t = 0.03, top = p.h - t, hw = p.w / 2, hd = p.d / 2;
|
|
1096
|
+
const parts = [];
|
|
1097
|
+
if (p.variant === "l_shape") {
|
|
1098
|
+
const td = Math.min(0.7, p.d), rw = Math.min(0.6, p.w);
|
|
1099
|
+
parts.push(box(-rw / 2, hd - td / 2, top, p.w - rw, td, t, "woodLight"));
|
|
1100
|
+
parts.push(box(hw - rw / 2, 0, top, rw, p.d, t, "woodLight"));
|
|
1101
|
+
parts.push(box(-hw + 0.015, hd - td / 2, 0, 0.03, td, top, "white"));
|
|
1102
|
+
parts.push(box(hw - rw / 2, -hd + 0.015, 0, rw, 0.03, top, "white"));
|
|
1103
|
+
parts.push(box(-rw / 2, hd - 0.02, 0.3, p.w - rw, 0.02, top - 0.3, "white"));
|
|
1104
|
+
return parts;
|
|
1105
|
+
}
|
|
1106
|
+
parts.push(box(0, 0, top, p.w, p.d, t, "woodLight"));
|
|
1107
|
+
parts.push(box(-hw + 0.015, 0, 0, 0.03, p.d - 0.04, top, "white"));
|
|
1108
|
+
parts.push(box(hw - 0.015, 0, 0, 0.03, p.d - 0.04, top, "white"));
|
|
1109
|
+
parts.push(box(0, hd - 0.03, 0.3, p.w - 0.06, 0.02, top - 0.3, "white"));
|
|
1110
|
+
if (p.variant === "pedestal") {
|
|
1111
|
+
const pw = Math.min(0.42, p.w * 0.35);
|
|
1112
|
+
parts.push(box(hw - pw / 2 - 0.03, 0.02, 0, pw, p.d - 0.1, top - 0.02, "white"));
|
|
1113
|
+
}
|
|
1114
|
+
return parts;
|
|
1115
|
+
}
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
id: "office_chair",
|
|
1119
|
+
category: "furniture",
|
|
1120
|
+
en: "Office chair",
|
|
1121
|
+
zh: "\u529E\u516C\u6905",
|
|
1122
|
+
keywords: "chair task swivel seat \u6905\u5B50 \u8F6C\u6905",
|
|
1123
|
+
size: [0.62, 0.62, 1],
|
|
1124
|
+
ifc: "IfcFurniture.CHAIR",
|
|
1125
|
+
revit: "Furniture",
|
|
1126
|
+
plan(p) {
|
|
1127
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1128
|
+
const sw = p.w * 0.78, sd = p.d * 0.72;
|
|
1129
|
+
return [
|
|
1130
|
+
{ k: "circle", cx: 0, cy: 0, r: Math.min(hw, hd), dash: true },
|
|
1131
|
+
rc(0, -hd + sd / 2 + 0.02, sw, sd, { r: 0.06, fill: "paper" }),
|
|
1132
|
+
rc(0, hd - 0.06, sw * 0.95, 0.1, { r: 0.04, fill: "paper" }),
|
|
1133
|
+
rc(-sw / 2 - 0.02, -0.02, 0.05, sd * 0.7, { r: 0.02, fill: "paper" }),
|
|
1134
|
+
rc(sw / 2 + 0.02, -0.02, 0.05, sd * 0.7, { r: 0.02, fill: "paper" })
|
|
1135
|
+
];
|
|
1136
|
+
},
|
|
1137
|
+
mass(p) {
|
|
1138
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1139
|
+
const sw = p.w * 0.78, sd = p.d * 0.72, seat = 0.46;
|
|
1140
|
+
return [
|
|
1141
|
+
cyl(0, 0, 0.03, Math.min(hw, hd) * 0.95, 0.04, "dark", 1, 10),
|
|
1142
|
+
cyl(0, 0, 0.07, 0.03, seat - 0.12, "metal", 1, 8),
|
|
1143
|
+
box(0, -hd + sd / 2 + 0.02, seat - 0.06, sw, sd, 0.08, "cloth"),
|
|
1144
|
+
box(0, hd - 0.06, seat + 0.1, sw * 0.95, 0.07, p.h - seat - 0.1, "cloth"),
|
|
1145
|
+
box(-sw / 2 - 0.02, -0.02, seat + 0.12, 0.05, sd * 0.7, 0.04, "dark"),
|
|
1146
|
+
box(sw / 2 + 0.02, -0.02, seat + 0.12, 0.05, sd * 0.7, 0.04, "dark")
|
|
1147
|
+
];
|
|
1148
|
+
}
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
id: "chair",
|
|
1152
|
+
category: "furniture",
|
|
1153
|
+
en: "Chair",
|
|
1154
|
+
zh: "\u6905\u5B50",
|
|
1155
|
+
keywords: "dining side chair seat \u9910\u6905 \u9760\u80CC\u6905",
|
|
1156
|
+
size: [0.45, 0.5, 0.85],
|
|
1157
|
+
ifc: "IfcFurniture.CHAIR",
|
|
1158
|
+
revit: "Furniture",
|
|
1159
|
+
plan(p) {
|
|
1160
|
+
const hd = p.d / 2;
|
|
1161
|
+
return [
|
|
1162
|
+
rc(0, -0.03, p.w, p.d - 0.06, { r: 0.03, fill: "paper" }),
|
|
1163
|
+
rc(0, hd - 0.035, p.w, 0.07, { fill: "paper" })
|
|
1164
|
+
];
|
|
1165
|
+
},
|
|
1166
|
+
mass(p) {
|
|
1167
|
+
const hd = p.d / 2, seat = 0.45;
|
|
1168
|
+
return [
|
|
1169
|
+
...legs(p.w, p.d - 0.06, seat - 0.04, 0.035, "wood", 0.02).map((l) => ({ ...l, y: l.y - 0.03 })),
|
|
1170
|
+
box(0, -0.03, seat - 0.04, p.w, p.d - 0.06, 0.04, "wood"),
|
|
1171
|
+
box(0, hd - 0.035, 0, p.w, 0.04, p.h, "wood")
|
|
1172
|
+
];
|
|
1173
|
+
}
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
id: "meeting_table",
|
|
1177
|
+
category: "furniture",
|
|
1178
|
+
en: "Meeting table",
|
|
1179
|
+
zh: "\u4F1A\u8BAE\u684C",
|
|
1180
|
+
keywords: "conference boardroom table \u4F1A\u8BAE \u684C",
|
|
1181
|
+
size: [2.4, 1.2, 0.75],
|
|
1182
|
+
variants: [
|
|
1183
|
+
{ id: "rect", en: "Rectangular", zh: "\u77E9\u5F62" },
|
|
1184
|
+
{ id: "racetrack", en: "Racetrack", zh: "\u8DD1\u9053\u5F62", size: [3.2, 1.3, 0.75] },
|
|
1185
|
+
{ id: "round", en: "Round", zh: "\u5706\u5F62", size: [1.2, 1.2, 0.75] }
|
|
1186
|
+
],
|
|
1187
|
+
ifc: "IfcFurniture.TABLE",
|
|
1188
|
+
revit: "Furniture",
|
|
1189
|
+
plan: tablePlan,
|
|
1190
|
+
mass: (p) => tableMass(p, "woodLight")
|
|
1191
|
+
},
|
|
1192
|
+
{
|
|
1193
|
+
id: "dining_table",
|
|
1194
|
+
category: "furniture",
|
|
1195
|
+
en: "Dining table",
|
|
1196
|
+
zh: "\u9910\u684C",
|
|
1197
|
+
keywords: "dining kitchen table \u996D\u684C",
|
|
1198
|
+
size: [1.6, 0.9, 0.75],
|
|
1199
|
+
variants: [
|
|
1200
|
+
{ id: "rect", en: "Rectangular", zh: "\u77E9\u5F62" },
|
|
1201
|
+
{ id: "round", en: "Round", zh: "\u5706\u5F62", size: [1, 1, 0.75] }
|
|
1202
|
+
],
|
|
1203
|
+
ifc: "IfcFurniture.TABLE",
|
|
1204
|
+
revit: "Furniture",
|
|
1205
|
+
plan: tablePlan,
|
|
1206
|
+
mass: (p) => tableMass(p, "wood")
|
|
1207
|
+
},
|
|
1208
|
+
{
|
|
1209
|
+
id: "coffee_table",
|
|
1210
|
+
category: "furniture",
|
|
1211
|
+
en: "Coffee table",
|
|
1212
|
+
zh: "\u8336\u51E0",
|
|
1213
|
+
keywords: "coffee side low table \u8336\u684C \u8FB9\u51E0",
|
|
1214
|
+
size: [1.1, 0.6, 0.42],
|
|
1215
|
+
variants: [
|
|
1216
|
+
{ id: "rect", en: "Rectangular", zh: "\u77E9\u5F62" },
|
|
1217
|
+
{ id: "round", en: "Round", zh: "\u5706\u5F62", size: [0.8, 0.8, 0.42] }
|
|
1218
|
+
],
|
|
1219
|
+
ifc: "IfcFurniture.TABLE",
|
|
1220
|
+
revit: "Furniture",
|
|
1221
|
+
plan: tablePlan,
|
|
1222
|
+
mass: (p) => tableMass(p, "wood")
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
id: "sofa",
|
|
1226
|
+
category: "furniture",
|
|
1227
|
+
en: "Sofa",
|
|
1228
|
+
zh: "\u6C99\u53D1",
|
|
1229
|
+
keywords: "couch settee lounge \u957F\u6C99\u53D1 \u4E09\u4EBA\u6C99\u53D1",
|
|
1230
|
+
size: [2.1, 0.9, 0.8],
|
|
1231
|
+
wallBacked: true,
|
|
1232
|
+
variants: [
|
|
1233
|
+
{ id: "3_seat", en: "3-seat", zh: "\u4E09\u4EBA" },
|
|
1234
|
+
{ id: "2_seat", en: "2-seat", zh: "\u53CC\u4EBA", size: [1.6, 0.9, 0.8] },
|
|
1235
|
+
{ id: "l_shape", en: "L-shape (chaise right)", zh: "L \u5F62\uFF08\u53F3\u8D35\u5983\uFF09", size: [2.6, 1.6, 0.8] }
|
|
1236
|
+
],
|
|
1237
|
+
ifc: "IfcFurniture.SOFA",
|
|
1238
|
+
revit: "Furniture",
|
|
1239
|
+
plan(p) {
|
|
1240
|
+
return sofaPlan(p, p.variant === "2_seat" ? 2 : 3);
|
|
1241
|
+
},
|
|
1242
|
+
mass(p) {
|
|
1243
|
+
return sofaMass(p);
|
|
1244
|
+
}
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
id: "armchair",
|
|
1248
|
+
category: "furniture",
|
|
1249
|
+
en: "Armchair",
|
|
1250
|
+
zh: "\u5355\u4EBA\u6C99\u53D1",
|
|
1251
|
+
keywords: "lounge easy chair \u6276\u624B\u6905 \u4F11\u95F2\u6905",
|
|
1252
|
+
size: [0.85, 0.85, 0.8],
|
|
1253
|
+
ifc: "IfcFurniture.CHAIR",
|
|
1254
|
+
revit: "Furniture",
|
|
1255
|
+
plan(p) {
|
|
1256
|
+
return sofaPlan(p, 1);
|
|
1257
|
+
},
|
|
1258
|
+
mass(p) {
|
|
1259
|
+
return sofaMass(p, "fabricWarm");
|
|
1260
|
+
}
|
|
1261
|
+
},
|
|
1262
|
+
{
|
|
1263
|
+
id: "bed",
|
|
1264
|
+
category: "furniture",
|
|
1265
|
+
en: "Bed",
|
|
1266
|
+
zh: "\u5E8A",
|
|
1267
|
+
keywords: "bed bedroom mattress \u5355\u4EBA\u5E8A \u53CC\u4EBA\u5E8A \u5367\u5BA4",
|
|
1268
|
+
size: [1.6, 2.1, 0.95],
|
|
1269
|
+
wallBacked: true,
|
|
1270
|
+
variants: [
|
|
1271
|
+
{ id: "double", en: "Double 1.5 m", zh: "\u53CC\u4EBA 1.5 \u7C73" },
|
|
1272
|
+
{ id: "single", en: "Single 0.9 m", zh: "\u5355\u4EBA 0.9 \u7C73", size: [1, 2.1, 0.9] },
|
|
1273
|
+
{ id: "king", en: "King 1.8 m", zh: "\u5927\u5E8A 1.8 \u7C73", size: [1.9, 2.15, 1] }
|
|
1274
|
+
],
|
|
1275
|
+
ifc: "IfcFurniture.BED",
|
|
1276
|
+
revit: "Furniture",
|
|
1277
|
+
plan(p) {
|
|
1278
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1279
|
+
const head = 0.06, inset = 0.03;
|
|
1280
|
+
const pillows = p.w >= 1.3 ? 2 : 1;
|
|
1281
|
+
const pw = (p.w - 2 * inset - (pillows - 1) * 0.06 - 0.1) / pillows;
|
|
1282
|
+
const out = [outline(p), ln(-hw, hd - head, hw, hd - head)];
|
|
1283
|
+
for (let i = 0; i < pillows; i++) {
|
|
1284
|
+
const x = -hw + inset + 0.05 + pw / 2 + i * (pw + 0.06);
|
|
1285
|
+
out.push(rc(x, hd - head - 0.06 - 0.18, pw, 0.36, { r: 0.07 }));
|
|
1286
|
+
}
|
|
1287
|
+
const fy = hd - head - 0.55;
|
|
1288
|
+
out.push(ln(-hw + inset, fy, hw - inset, fy));
|
|
1289
|
+
out.push({ k: "poly", pts: [[hw - inset - 0.35, fy], [hw - inset, fy - 0.35]] });
|
|
1290
|
+
out.push(ln(-hw + inset, fy, -hw + inset, -hd + inset));
|
|
1291
|
+
out.push(ln(hw - inset, fy - 0.35, hw - inset, -hd + inset));
|
|
1292
|
+
out.push(ln(-hw + inset, -hd + inset, hw - inset, -hd + inset));
|
|
1293
|
+
return out;
|
|
1294
|
+
},
|
|
1295
|
+
mass(p) {
|
|
1296
|
+
const hw = p.w / 2, hd = p.d / 2, head = 0.06;
|
|
1297
|
+
const pillows = p.w >= 1.3 ? 2 : 1;
|
|
1298
|
+
const pw = (p.w - 0.16 - (pillows - 1) * 0.06) / pillows;
|
|
1299
|
+
const parts = [
|
|
1300
|
+
box(0, -head / 2, 0.05, p.w, p.d - head, 0.25, "wood"),
|
|
1301
|
+
box(0, -head / 2, 0.3, p.w - 0.04, p.d - head - 0.04, 0.22, "white"),
|
|
1302
|
+
box(0, hd - head / 2, 0, p.w, head, p.h, "wood"),
|
|
1303
|
+
box(0, -head / 2 - 0.35, 0.52, p.w - 0.02, p.d - head - 0.7, 0.03, "fabric")
|
|
1304
|
+
];
|
|
1305
|
+
for (let i = 0; i < pillows; i++) {
|
|
1306
|
+
const x = -hw + 0.08 + pw / 2 + i * (pw + 0.06);
|
|
1307
|
+
parts.push(box(x, hd - head - 0.24, 0.52, pw, 0.36, 0.1, "paint"));
|
|
1308
|
+
}
|
|
1309
|
+
return parts;
|
|
1310
|
+
}
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
id: "nightstand",
|
|
1314
|
+
category: "furniture",
|
|
1315
|
+
en: "Nightstand",
|
|
1316
|
+
zh: "\u5E8A\u5934\u67DC",
|
|
1317
|
+
keywords: "bedside table \u8FB9\u67DC",
|
|
1318
|
+
size: [0.45, 0.4, 0.55],
|
|
1319
|
+
wallBacked: true,
|
|
1320
|
+
ifc: "IfcFurniture.TABLE",
|
|
1321
|
+
revit: "Furniture",
|
|
1322
|
+
plan(p) {
|
|
1323
|
+
return [outline(p), ln(-p.w / 2 + 0.03, -p.d / 2 + 0.03, p.w / 2 - 0.03, -p.d / 2 + 0.03)];
|
|
1324
|
+
},
|
|
1325
|
+
mass(p) {
|
|
1326
|
+
return [box(0, 0, 0.05, p.w, p.d, p.h - 0.05, "wood"), ...legs(p.w, p.d, 0.05, 0.03, "dark", 0.02)];
|
|
1327
|
+
}
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
id: "wardrobe",
|
|
1331
|
+
category: "furniture",
|
|
1332
|
+
en: "Wardrobe",
|
|
1333
|
+
zh: "\u8863\u67DC",
|
|
1334
|
+
keywords: "closet armoire cabinet \u8863\u6A71 \u8863\u5E3D\u67DC",
|
|
1335
|
+
size: [1.2, 0.6, 2.2],
|
|
1336
|
+
wallBacked: true,
|
|
1337
|
+
variants: [
|
|
1338
|
+
{ id: "hinged", en: "Hinged doors", zh: "\u5E73\u5F00\u95E8" },
|
|
1339
|
+
{ id: "sliding", en: "Sliding doors", zh: "\u63A8\u62C9\u95E8", size: [1.8, 0.65, 2.2] }
|
|
1340
|
+
],
|
|
1341
|
+
ifc: "IfcFurniture.SHELF",
|
|
1342
|
+
revit: "Casework",
|
|
1343
|
+
plan(p) {
|
|
1344
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1345
|
+
const out = [outline(p)];
|
|
1346
|
+
out.push(ln(-hw + 0.06, 0.03, hw - 0.06, 0.03, true));
|
|
1347
|
+
const hangers = Math.max(2, Math.round(p.w / 0.25));
|
|
1348
|
+
for (let i = 1; i < hangers; i++) {
|
|
1349
|
+
const x = -hw + p.w * i / hangers;
|
|
1350
|
+
out.push(ln(x - 0.08, 0.03 - 0.2, x + 0.08, 0.03 + 0.2));
|
|
1351
|
+
}
|
|
1352
|
+
if (p.variant === "sliding") {
|
|
1353
|
+
out.push(rc(-p.w / 4 + 0.01, -hd + 0.04, p.w / 2 + 0.02, 0.025));
|
|
1354
|
+
out.push(rc(p.w / 4 - 0.01, -hd + 0.075, p.w / 2 + 0.02, 0.025));
|
|
1355
|
+
} else {
|
|
1356
|
+
const n = modules(p.w, 0.5);
|
|
1357
|
+
const dw = p.w / n;
|
|
1358
|
+
for (let i = 0; i < n; i++) {
|
|
1359
|
+
const left = i % 2 === 0;
|
|
1360
|
+
const hx = -hw + dw * i + (left ? 0 : dw);
|
|
1361
|
+
out.push(ln(-hw + dw * i, -hd, -hw + dw * (i + 1), -hd));
|
|
1362
|
+
out.push({ k: "arc", cx: hx, cy: -hd, r: dw, a0: left ? 270 : 180, a1: left ? 360 : 270, dash: true });
|
|
1363
|
+
out.push(ln(hx, -hd, hx, -hd - dw, true));
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
return out;
|
|
1367
|
+
},
|
|
1368
|
+
mass(p) {
|
|
1369
|
+
const n = p.variant === "sliding" ? 2 : modules(p.w, 0.5);
|
|
1370
|
+
const parts = [box(0, 0.01, 0.08, p.w, p.d - 0.02, p.h - 0.08, "wood"), box(0, 0.03, 0, p.w - 0.04, p.d - 0.08, 0.08, "dark")];
|
|
1371
|
+
for (let i = 1; i < n; i++) parts.push(box(-p.w / 2 + p.w * i / n, -p.d / 2 + 5e-3, 0.1, 8e-3, 0.01, p.h - 0.14, "dark"));
|
|
1372
|
+
return parts;
|
|
1373
|
+
}
|
|
1374
|
+
},
|
|
1375
|
+
{
|
|
1376
|
+
id: "bookshelf",
|
|
1377
|
+
category: "furniture",
|
|
1378
|
+
en: "Bookshelf",
|
|
1379
|
+
zh: "\u4E66\u67B6",
|
|
1380
|
+
keywords: "shelving bookcase shelf \u4E66\u67DC \u7F6E\u7269\u67B6",
|
|
1381
|
+
size: [0.9, 0.35, 2],
|
|
1382
|
+
wallBacked: true,
|
|
1383
|
+
ifc: "IfcFurniture.SHELF",
|
|
1384
|
+
revit: "Furniture",
|
|
1385
|
+
plan(p) {
|
|
1386
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1387
|
+
const out = [outline(p), ln(-hw, hd - 0.02, hw, hd - 0.02)];
|
|
1388
|
+
const bays = modules(p.w, 0.9);
|
|
1389
|
+
for (let i = 1; i < bays; i++) out.push(ln(-hw + p.w * i / bays, -hd, -hw + p.w * i / bays, hd - 0.02));
|
|
1390
|
+
return out;
|
|
1391
|
+
},
|
|
1392
|
+
mass(p) {
|
|
1393
|
+
const hw = p.w / 2, hd = p.d / 2, t = 0.02;
|
|
1394
|
+
const parts = [
|
|
1395
|
+
box(-hw + t / 2, 0, 0, t, p.d, p.h, "woodLight"),
|
|
1396
|
+
box(hw - t / 2, 0, 0, t, p.d, p.h, "woodLight"),
|
|
1397
|
+
box(0, hd - 5e-3, 0, p.w - 2 * t, 0.01, p.h, "wood")
|
|
1398
|
+
];
|
|
1399
|
+
const shelves = Math.max(2, Math.round(p.h / 0.36));
|
|
1400
|
+
for (let i = 0; i <= shelves; i++) parts.push(box(0, 0, Math.min(p.h - t, i * (p.h - t) / shelves), p.w - 2 * t, p.d - 0.01, t, "woodLight"));
|
|
1401
|
+
const bays = modules(p.w, 0.9);
|
|
1402
|
+
for (let i = 1; i < bays; i++) parts.push(box(-hw + p.w * i / bays, 0, 0, t, p.d, p.h, "woodLight"));
|
|
1403
|
+
return parts;
|
|
1404
|
+
}
|
|
1405
|
+
},
|
|
1406
|
+
{
|
|
1407
|
+
id: "filing_cabinet",
|
|
1408
|
+
category: "furniture",
|
|
1409
|
+
en: "Filing cabinet",
|
|
1410
|
+
zh: "\u6587\u4EF6\u67DC",
|
|
1411
|
+
keywords: "file drawer cabinet storage \u6863\u6848\u67DC \u62BD\u5C49\u67DC",
|
|
1412
|
+
size: [0.5, 0.62, 1.32],
|
|
1413
|
+
wallBacked: true,
|
|
1414
|
+
variants: [
|
|
1415
|
+
{ id: "vertical", en: "Vertical 4-drawer", zh: "\u7AD6\u5F0F\u56DB\u62BD" },
|
|
1416
|
+
{ id: "lateral", en: "Lateral", zh: "\u6A2A\u5F0F", size: [0.9, 0.45, 1.05] }
|
|
1417
|
+
],
|
|
1418
|
+
ifc: "IfcFurniture.FILECABINET",
|
|
1419
|
+
revit: "Furniture",
|
|
1420
|
+
plan(p) {
|
|
1421
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1422
|
+
return [outline(p), ln(-hw, -hd + 0.03, hw, -hd + 0.03), ln(-0.08, -hd - 0.025, 0.08, -hd - 0.025)];
|
|
1423
|
+
},
|
|
1424
|
+
mass(p) {
|
|
1425
|
+
const n = Math.max(2, Math.round(p.h / 0.33));
|
|
1426
|
+
const parts = [box(0, 0, 0, p.w, p.d, p.h, "metal")];
|
|
1427
|
+
for (let i = 0; i < n; i++) parts.push(box(0, -p.d / 2 - 0.01, (i + 0.65) * p.h / n, 0.16, 0.02, 0.02, "dark"));
|
|
1428
|
+
return parts;
|
|
1429
|
+
}
|
|
1430
|
+
},
|
|
1431
|
+
{
|
|
1432
|
+
id: "sideboard",
|
|
1433
|
+
category: "furniture",
|
|
1434
|
+
en: "Sideboard / TV unit",
|
|
1435
|
+
zh: "\u7535\u89C6\u67DC / \u8FB9\u67DC",
|
|
1436
|
+
keywords: "credenza media tv cabinet buffet \u77EE\u67DC \u9910\u8FB9\u67DC",
|
|
1437
|
+
size: [1.8, 0.45, 0.55],
|
|
1438
|
+
wallBacked: true,
|
|
1439
|
+
ifc: "IfcFurniture.SHELF",
|
|
1440
|
+
revit: "Furniture",
|
|
1441
|
+
plan(p) {
|
|
1442
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1443
|
+
const out = [outline(p), ln(-hw, -hd + 0.03, hw, -hd + 0.03)];
|
|
1444
|
+
const n = modules(p.w, 0.6);
|
|
1445
|
+
for (let i = 1; i < n; i++) out.push(ln(-hw + p.w * i / n, -hd, -hw + p.w * i / n, -hd + 0.03));
|
|
1446
|
+
return out;
|
|
1447
|
+
},
|
|
1448
|
+
mass(p) {
|
|
1449
|
+
return [box(0, 0, 0.1, p.w, p.d, p.h - 0.1, "wood"), ...legs(p.w, p.d, 0.1, 0.04, "dark", 0.05)];
|
|
1450
|
+
}
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
id: "reception_counter",
|
|
1454
|
+
category: "furniture",
|
|
1455
|
+
en: "Reception counter",
|
|
1456
|
+
zh: "\u524D\u53F0",
|
|
1457
|
+
keywords: "reception desk front counter lobby \u63A5\u5F85\u53F0 \u670D\u52A1\u53F0",
|
|
1458
|
+
size: [2.4, 0.8, 1.1],
|
|
1459
|
+
variants: [
|
|
1460
|
+
{ id: "straight", en: "Straight", zh: "\u4E00\u5B57\u5F62" },
|
|
1461
|
+
{ id: "l_shape", en: "L-shape", zh: "L \u5F62", size: [2.4, 1.6, 1.1] }
|
|
1462
|
+
],
|
|
1463
|
+
ifc: "IfcFurniture.DESK",
|
|
1464
|
+
revit: "Furniture",
|
|
1465
|
+
// Visitors at the front (-Y) high ledge, staff behind (+Y) at desk height.
|
|
1466
|
+
// The L returns on the right towards the back; staff sit inside the L.
|
|
1467
|
+
plan(p) {
|
|
1468
|
+
const hw = p.w / 2, hd = p.d / 2, ledge = 0.3;
|
|
1469
|
+
if (p.variant === "l_shape") {
|
|
1470
|
+
const td = Math.min(0.8, p.d), rw = Math.min(0.8, p.w);
|
|
1471
|
+
return [
|
|
1472
|
+
{ k: "poly", closed: true, fill: "paper", pts: [[-hw, -hd], [hw, -hd], [hw, hd], [hw - rw, hd], [hw - rw, -hd + td], [-hw, -hd + td]] },
|
|
1473
|
+
{ k: "poly", closed: true, fill: "tone", pts: [[-hw, -hd], [hw, -hd], [hw, hd], [hw - ledge, hd], [hw - ledge, -hd + ledge], [-hw, -hd + ledge]] }
|
|
1474
|
+
];
|
|
1475
|
+
}
|
|
1476
|
+
return [outline(p), rc(0, -hd + ledge / 2, p.w, ledge, { fill: "tone" })];
|
|
1477
|
+
},
|
|
1478
|
+
mass(p) {
|
|
1479
|
+
const hw = p.w / 2, hd = p.d / 2, ledge = 0.3, work = 0.75, t = 0.03;
|
|
1480
|
+
if (p.variant === "l_shape") {
|
|
1481
|
+
const td = Math.min(0.8, p.d), rw = Math.min(0.8, p.w);
|
|
1482
|
+
return [
|
|
1483
|
+
box(0, -hd + 0.03, 0, p.w, 0.06, p.h - t, "white"),
|
|
1484
|
+
box(hw - 0.03, 0.03, 0, 0.06, p.d - 0.06, p.h - t, "white"),
|
|
1485
|
+
box(0, -hd + ledge / 2, p.h - t, p.w, ledge, t, "counter"),
|
|
1486
|
+
box(hw - ledge / 2, ledge / 2, p.h - t, ledge, p.d - ledge, t, "counter"),
|
|
1487
|
+
box(-ledge / 2, -hd + (ledge + td) / 2, work - t, p.w - ledge, td - ledge, t, "woodLight"),
|
|
1488
|
+
box(hw - (rw + ledge) / 2, td / 2, work - t, rw - ledge, p.d - td, t, "woodLight"),
|
|
1489
|
+
box(-hw + 0.03, -hd + td / 2, 0, 0.06, td, work - t, "white"),
|
|
1490
|
+
box(hw - rw / 2, hd - 0.03, 0, rw, 0.06, work - t, "white")
|
|
1491
|
+
];
|
|
1492
|
+
}
|
|
1493
|
+
return [
|
|
1494
|
+
box(0, -hd + 0.03, 0, p.w, 0.06, p.h - t, "white"),
|
|
1495
|
+
box(0, -hd + ledge / 2, p.h - t, p.w, ledge, t, "counter"),
|
|
1496
|
+
box(-hw + 0.03, 0, 0, 0.06, p.d, work - t, "white"),
|
|
1497
|
+
box(hw - 0.03, 0, 0, 0.06, p.d, work - t, "white"),
|
|
1498
|
+
box(0, ledge / 2, work - t, p.w, p.d - ledge, t, "woodLight")
|
|
1499
|
+
];
|
|
1500
|
+
}
|
|
1501
|
+
},
|
|
1502
|
+
{
|
|
1503
|
+
id: "locker",
|
|
1504
|
+
category: "furniture",
|
|
1505
|
+
en: "Lockers",
|
|
1506
|
+
zh: "\u50A8\u7269\u67DC",
|
|
1507
|
+
keywords: "locker bank staff changing \u66F4\u8863\u67DC \u8863\u7269\u67DC",
|
|
1508
|
+
size: [0.9, 0.5, 1.8],
|
|
1509
|
+
wallBacked: true,
|
|
1510
|
+
variants: [
|
|
1511
|
+
{ id: "single_tier", en: "Single tier", zh: "\u5355\u5C42" },
|
|
1512
|
+
{ id: "double_tier", en: "Double tier", zh: "\u53CC\u5C42" }
|
|
1513
|
+
],
|
|
1514
|
+
ifc: "IfcFurniture.SHELF",
|
|
1515
|
+
revit: "Furniture",
|
|
1516
|
+
plan(p) {
|
|
1517
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1518
|
+
const n = modules(p.w, 0.3);
|
|
1519
|
+
const out = [outline(p), ln(-hw, -hd + 0.025, hw, -hd + 0.025)];
|
|
1520
|
+
for (let i = 1; i < n; i++) out.push(ln(-hw + p.w * i / n, -hd, -hw + p.w * i / n, hd));
|
|
1521
|
+
return out;
|
|
1522
|
+
},
|
|
1523
|
+
mass(p) {
|
|
1524
|
+
const n = modules(p.w, 0.3), uw = p.w / n;
|
|
1525
|
+
const tiers = p.variant === "double_tier" ? 2 : 1;
|
|
1526
|
+
const parts = [box(0, 0, 0, p.w, p.d, 0.1, "dark")];
|
|
1527
|
+
for (let i = 0; i < n; i++) {
|
|
1528
|
+
for (let t = 0; t < tiers; t++) {
|
|
1529
|
+
const th = (p.h - 0.1) / tiers;
|
|
1530
|
+
parts.push(box(-p.w / 2 + uw * (i + 0.5), 0, 0.1 + th * t + 5e-3, uw - 0.01, p.d, th - 0.01, "metal"));
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
return parts;
|
|
1534
|
+
}
|
|
1535
|
+
},
|
|
1536
|
+
// ── Casework ──────────────────────────────────────────────────────────────
|
|
1537
|
+
{
|
|
1538
|
+
id: "base_cabinet",
|
|
1539
|
+
category: "casework",
|
|
1540
|
+
en: "Base cabinet + counter",
|
|
1541
|
+
zh: "\u5730\u67DC + \u53F0\u9762",
|
|
1542
|
+
keywords: "kitchen counter worktop cabinet run sink \u6A71\u67DC \u53F0\u9762 \u6C34\u69FD\u67DC",
|
|
1543
|
+
size: [0.6, 0.6, 0.9],
|
|
1544
|
+
wallBacked: true,
|
|
1545
|
+
variants: [
|
|
1546
|
+
{ id: "doors", en: "Doors", zh: "\u67DC\u95E8" },
|
|
1547
|
+
{ id: "drawers", en: "Drawers", zh: "\u62BD\u5C49" },
|
|
1548
|
+
{ id: "sink", en: "Sink base", zh: "\u6C34\u69FD\u67DC", size: [0.8, 0.6, 0.9] }
|
|
1549
|
+
],
|
|
1550
|
+
ifc: "IfcFurniture.USERDEFINED",
|
|
1551
|
+
revit: "Casework",
|
|
1552
|
+
plan(p) {
|
|
1553
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1554
|
+
const out = [outline(p)];
|
|
1555
|
+
const n = modules(p.w, 0.6);
|
|
1556
|
+
out.push(ln(-hw, -hd + 0.03, hw, -hd + 0.03, true));
|
|
1557
|
+
for (let i = 1; i < n; i++) out.push(ln(-hw + p.w * i / n, -hd + 0.03, -hw + p.w * i / n, hd, true));
|
|
1558
|
+
if (p.variant === "sink") {
|
|
1559
|
+
const bw = Math.min(p.w - 0.16, 0.7), bd = Math.min(p.d - 0.16, 0.42);
|
|
1560
|
+
out.push(rc(0, -0.02, bw, bd, { r: 0.05 }));
|
|
1561
|
+
out.push({ k: "circle", cx: 0, cy: -0.02, r: 0.025 });
|
|
1562
|
+
out.push({ k: "circle", cx: 0, cy: hd - 0.06, r: 0.02 });
|
|
1563
|
+
out.push(ln(0, hd - 0.06, 0, -0.02 + bd / 2 - 0.04));
|
|
1564
|
+
}
|
|
1565
|
+
return out;
|
|
1566
|
+
},
|
|
1567
|
+
mass(p) {
|
|
1568
|
+
const parts = counterRunMass(p);
|
|
1569
|
+
if (p.variant === "sink") {
|
|
1570
|
+
const bw = Math.min(p.w - 0.16, 0.7), bd = Math.min(p.d - 0.16, 0.42);
|
|
1571
|
+
parts.push(box(0, -0.02, p.h - 5e-3, bw, bd, 6e-3, "metal"));
|
|
1572
|
+
parts.push(cyl(0, p.d / 2 - 0.06, p.h, 0.02, 0.3, "metal", 1, 8));
|
|
1573
|
+
}
|
|
1574
|
+
return parts;
|
|
1575
|
+
}
|
|
1576
|
+
},
|
|
1577
|
+
{
|
|
1578
|
+
id: "wall_cabinet",
|
|
1579
|
+
category: "casework",
|
|
1580
|
+
en: "Wall cabinet",
|
|
1581
|
+
zh: "\u540A\u67DC",
|
|
1582
|
+
keywords: "upper cabinet kitchen overhead \u4E0A\u67DC \u58C1\u67DC",
|
|
1583
|
+
size: [0.6, 0.35, 0.7],
|
|
1584
|
+
baseOffset: 1.45,
|
|
1585
|
+
wallBacked: true,
|
|
1586
|
+
ifc: "IfcFurniture.USERDEFINED",
|
|
1587
|
+
revit: "Casework",
|
|
1588
|
+
plan(p) {
|
|
1589
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1590
|
+
const out = [rc(0, 0, p.w, p.d, { dash: true }), ln(-hw, -hd, hw, hd, true), ln(-hw, hd, hw, -hd, true)];
|
|
1591
|
+
return out;
|
|
1592
|
+
},
|
|
1593
|
+
mass(p) {
|
|
1594
|
+
const n = modules(p.w, 0.6);
|
|
1595
|
+
const parts = [box(0, 0, 0, p.w, p.d, p.h, "white")];
|
|
1596
|
+
for (let i = 1; i < n; i++) parts.push(box(-p.w / 2 + p.w * i / n, -p.d / 2 + 4e-3, 0.02, 6e-3, 0.01, p.h - 0.04, "dark"));
|
|
1597
|
+
return parts;
|
|
1598
|
+
}
|
|
1599
|
+
},
|
|
1600
|
+
{
|
|
1601
|
+
id: "tall_cabinet",
|
|
1602
|
+
category: "casework",
|
|
1603
|
+
en: "Tall cabinet",
|
|
1604
|
+
zh: "\u9AD8\u67DC",
|
|
1605
|
+
keywords: "pantry larder tall unit oven housing \u50A8\u7269\u9AD8\u67DC",
|
|
1606
|
+
size: [0.6, 0.6, 2.2],
|
|
1607
|
+
wallBacked: true,
|
|
1608
|
+
ifc: "IfcFurniture.USERDEFINED",
|
|
1609
|
+
revit: "Casework",
|
|
1610
|
+
plan(p) {
|
|
1611
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1612
|
+
return [outline(p), ln(-hw, -hd, hw, hd), ln(-hw, hd, hw, -hd)];
|
|
1613
|
+
},
|
|
1614
|
+
mass(p) {
|
|
1615
|
+
return [box(0, 0.025, 0, p.w - 0.02, p.d - 0.05, 0.1, "dark"), box(0, 0, 0.1, p.w, p.d, p.h - 0.1, "white")];
|
|
1616
|
+
}
|
|
1617
|
+
},
|
|
1618
|
+
// ── Appliances (no MEP ports) ─────────────────────────────────────────────
|
|
1619
|
+
{
|
|
1620
|
+
id: "refrigerator",
|
|
1621
|
+
category: "appliance",
|
|
1622
|
+
en: "Refrigerator",
|
|
1623
|
+
zh: "\u51B0\u7BB1",
|
|
1624
|
+
keywords: "fridge freezer \u51B0\u67DC",
|
|
1625
|
+
size: [0.7, 0.7, 1.85],
|
|
1626
|
+
wallBacked: true,
|
|
1627
|
+
variants: [
|
|
1628
|
+
{ id: "single", en: "Single door", zh: "\u5355\u95E8" },
|
|
1629
|
+
{ id: "side_by_side", en: "Side-by-side", zh: "\u5BF9\u5F00\u95E8", size: [0.91, 0.72, 1.78] }
|
|
1630
|
+
],
|
|
1631
|
+
ifc: "IfcElectricAppliance.REFRIGERATOR",
|
|
1632
|
+
revit: "Specialty Equipment",
|
|
1633
|
+
plan(p) {
|
|
1634
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1635
|
+
const out = [outline(p), ln(-hw, -hd + 0.06, hw, -hd + 0.06)];
|
|
1636
|
+
if (p.variant === "side_by_side") out.push(ln(0, -hd, 0, -hd + 0.06));
|
|
1637
|
+
out.push({ k: "text", x: 0, y: 0.05, size: Math.min(0.14, p.w * 0.2), text: "REF" });
|
|
1638
|
+
return out;
|
|
1639
|
+
},
|
|
1640
|
+
mass(p) {
|
|
1641
|
+
const parts = [box(0, 0.02, 0, p.w, p.d - 0.04, p.h, "white"), box(0, -p.d / 2 + 0.02, 0.02, p.w - 0.01, 0.04, p.h - 0.04, "paint")];
|
|
1642
|
+
if (p.variant === "side_by_side") {
|
|
1643
|
+
parts.push(box(-0.04, -p.d / 2 - 0.01, p.h * 0.35, 0.02, 0.03, p.h * 0.4, "metal"));
|
|
1644
|
+
parts.push(box(0.04, -p.d / 2 - 0.01, p.h * 0.35, 0.02, 0.03, p.h * 0.4, "metal"));
|
|
1645
|
+
} else {
|
|
1646
|
+
parts.push(box(p.w / 2 - 0.06, -p.d / 2 - 0.01, p.h * 0.4, 0.02, 0.03, p.h * 0.35, "metal"));
|
|
1647
|
+
}
|
|
1648
|
+
return parts;
|
|
1649
|
+
}
|
|
1650
|
+
},
|
|
1651
|
+
{
|
|
1652
|
+
id: "stove",
|
|
1653
|
+
category: "appliance",
|
|
1654
|
+
en: "Range / cooktop",
|
|
1655
|
+
zh: "\u7076\u53F0",
|
|
1656
|
+
keywords: "cooker oven hob stove range \u7089\u7076 \u71C3\u6C14\u7076 \u7535\u78C1\u7089",
|
|
1657
|
+
size: [0.6, 0.6, 0.9],
|
|
1658
|
+
wallBacked: true,
|
|
1659
|
+
ifc: "IfcElectricAppliance.ELECTRICCOOKER",
|
|
1660
|
+
revit: "Specialty Equipment",
|
|
1661
|
+
plan(p) {
|
|
1662
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1663
|
+
const r1 = clamp(Math.min(p.w, p.d) * 0.14, 0.05, 0.11), r2 = r1 * 0.75;
|
|
1664
|
+
const bx = p.w * 0.22, by = p.d * 0.2;
|
|
1665
|
+
return [
|
|
1666
|
+
outline(p),
|
|
1667
|
+
ln(-hw, -hd + 0.07, hw, -hd + 0.07),
|
|
1668
|
+
{ k: "circle", cx: -bx, cy: by, r: r2 },
|
|
1669
|
+
{ k: "circle", cx: bx, cy: by, r: r1 },
|
|
1670
|
+
{ k: "circle", cx: -bx, cy: -by + 0.02, r: r1 },
|
|
1671
|
+
{ k: "circle", cx: bx, cy: -by + 0.02, r: r2 }
|
|
1672
|
+
];
|
|
1673
|
+
},
|
|
1674
|
+
mass(p) {
|
|
1675
|
+
const bx = p.w * 0.22, by = p.d * 0.2, r = clamp(Math.min(p.w, p.d) * 0.12, 0.05, 0.1);
|
|
1676
|
+
return [
|
|
1677
|
+
box(0, 0, 0, p.w, p.d, p.h - 0.01, "metal"),
|
|
1678
|
+
box(0, 0, p.h - 0.01, p.w, p.d, 0.01, "dark"),
|
|
1679
|
+
cyl(-bx, by, p.h, r, 0.015, "dark", 1, 10),
|
|
1680
|
+
cyl(bx, by, p.h, r, 0.015, "dark", 1, 10),
|
|
1681
|
+
cyl(-bx, -by + 0.02, p.h, r, 0.015, "dark", 1, 10),
|
|
1682
|
+
cyl(bx, -by + 0.02, p.h, r, 0.015, "dark", 1, 10),
|
|
1683
|
+
box(0, -p.d / 2 - 5e-3, 0.12, p.w - 0.06, 0.01, p.h * 0.6, "glass")
|
|
1684
|
+
];
|
|
1685
|
+
}
|
|
1686
|
+
},
|
|
1687
|
+
{
|
|
1688
|
+
id: "dishwasher",
|
|
1689
|
+
category: "appliance",
|
|
1690
|
+
en: "Dishwasher",
|
|
1691
|
+
zh: "\u6D17\u7897\u673A",
|
|
1692
|
+
keywords: "dish washer \u6D17\u7897",
|
|
1693
|
+
size: [0.6, 0.6, 0.85],
|
|
1694
|
+
wallBacked: true,
|
|
1695
|
+
ifc: "IfcElectricAppliance.DISHWASHER",
|
|
1696
|
+
revit: "Specialty Equipment",
|
|
1697
|
+
plan(p) {
|
|
1698
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1699
|
+
return [outline(p), ln(-hw, -hd + 0.04, hw, -hd + 0.04), { k: "text", x: 0, y: 0, size: Math.min(0.14, p.w * 0.22), text: "DW" }];
|
|
1700
|
+
},
|
|
1701
|
+
mass(p) {
|
|
1702
|
+
return [box(0, 0, 0, p.w, p.d, p.h, "metal"), box(0, -p.d / 2 - 0.01, p.h - 0.12, p.w - 0.04, 0.02, 0.08, "dark")];
|
|
1703
|
+
}
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
id: "washing_machine",
|
|
1707
|
+
category: "appliance",
|
|
1708
|
+
en: "Washing machine",
|
|
1709
|
+
zh: "\u6D17\u8863\u673A",
|
|
1710
|
+
keywords: "washer laundry dryer \u6D17\u8863 \u70D8\u5E72\u673A",
|
|
1711
|
+
size: [0.6, 0.6, 0.85],
|
|
1712
|
+
wallBacked: true,
|
|
1713
|
+
ifc: "IfcElectricAppliance.WASHINGMACHINE",
|
|
1714
|
+
revit: "Specialty Equipment",
|
|
1715
|
+
plan(p) {
|
|
1716
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1717
|
+
return [outline(p), ln(-hw, hd - 0.1, hw, hd - 0.1), { k: "circle", cx: 0, cy: -0.04, r: Math.min(p.w, p.d) * 0.3 }];
|
|
1718
|
+
},
|
|
1719
|
+
mass(p) {
|
|
1720
|
+
return [
|
|
1721
|
+
box(0, 0, 0, p.w, p.d, p.h, "white"),
|
|
1722
|
+
box(0, -p.d / 2 - 5e-3, p.h * 0.22, Math.min(0.32, p.w * 0.55), 0.01, Math.min(0.32, p.w * 0.55), "glass")
|
|
1723
|
+
];
|
|
1724
|
+
}
|
|
1725
|
+
},
|
|
1726
|
+
// ── Specialty ─────────────────────────────────────────────────────────────
|
|
1727
|
+
{
|
|
1728
|
+
id: "toilet_partition",
|
|
1729
|
+
category: "specialty",
|
|
1730
|
+
en: "Toilet partition",
|
|
1731
|
+
zh: "\u536B\u751F\u95F4\u9694\u65AD",
|
|
1732
|
+
keywords: "cubicle stall wc compartment \u5395\u6240\u9694\u95F4 \u9694\u65AD",
|
|
1733
|
+
size: [0.9, 1.5, 2],
|
|
1734
|
+
wallBacked: true,
|
|
1735
|
+
variants: [
|
|
1736
|
+
{ id: "standard", en: "Standard cubicle", zh: "\u6807\u51C6\u9694\u95F4" },
|
|
1737
|
+
{ id: "accessible", en: "Accessible cubicle", zh: "\u65E0\u969C\u788D\u9694\u95F4", size: [1.6, 1.9, 2] }
|
|
1738
|
+
],
|
|
1739
|
+
ifc: "IfcFurnishingElement",
|
|
1740
|
+
revit: "Specialty Equipment",
|
|
1741
|
+
plan(p) {
|
|
1742
|
+
const hw = p.w / 2, hd = p.d / 2, t = 0.025;
|
|
1743
|
+
const door = clamp(p.variant === "accessible" ? 0.9 : 0.6, 0.45, p.w - 2 * t - 0.05);
|
|
1744
|
+
const x1 = hw - t - 0.05, x0 = x1 - door;
|
|
1745
|
+
return [
|
|
1746
|
+
rc(-hw + t / 2, 0, t, p.d, { fill: "dark" }),
|
|
1747
|
+
rc(hw - t / 2, 0, t, p.d, { fill: "dark" }),
|
|
1748
|
+
rc((-hw + t + x0) / 2, -hd + t / 2, x0 - (-hw + t), t, { fill: "dark" }),
|
|
1749
|
+
rc((x1 + hw - t) / 2, -hd + t / 2, hw - t - x1, t, { fill: "dark" }),
|
|
1750
|
+
ln(x1, -hd + t, x1, -hd + t + door),
|
|
1751
|
+
{ k: "arc", cx: x1, cy: -hd + t, r: door, a0: 90, a1: 180 }
|
|
1752
|
+
];
|
|
1753
|
+
},
|
|
1754
|
+
mass(p) {
|
|
1755
|
+
const hw = p.w / 2, hd = p.d / 2, t = 0.025, z0 = 0.15, ph = p.h - z0;
|
|
1756
|
+
const door = clamp(p.variant === "accessible" ? 0.9 : 0.6, 0.45, p.w - 2 * t - 0.05);
|
|
1757
|
+
const x1 = hw - t - 0.05, x0 = x1 - door;
|
|
1758
|
+
return [
|
|
1759
|
+
box(-hw + t / 2, 0, z0, t, p.d, ph, "partition"),
|
|
1760
|
+
box(hw - t / 2, 0, z0, t, p.d, ph, "partition"),
|
|
1761
|
+
box((-hw + t + x0) / 2, -hd + t / 2, z0, x0 - (-hw + t), t, ph, "partition"),
|
|
1762
|
+
box((x1 + hw - t) / 2, -hd + t / 2, z0, hw - t - x1, t, ph, "partition"),
|
|
1763
|
+
box((x0 + x1) / 2, -hd + t / 2, z0, door - 0.01, t * 0.8, ph - 0.05, "partition"),
|
|
1764
|
+
box(-hw + t / 2, -hd + 0.05, 0, 0.04, 0.04, z0, "metal"),
|
|
1765
|
+
box(hw - t / 2, -hd + 0.05, 0, 0.04, 0.04, z0, "metal")
|
|
1766
|
+
];
|
|
1767
|
+
}
|
|
1768
|
+
},
|
|
1769
|
+
// ── Vehicles & parking ────────────────────────────────────────────────────
|
|
1770
|
+
{
|
|
1771
|
+
id: "car",
|
|
1772
|
+
category: "vehicle",
|
|
1773
|
+
en: "Car",
|
|
1774
|
+
zh: "\u6C7D\u8F66",
|
|
1775
|
+
keywords: "vehicle automobile sedan suv parking \u5C0F\u6C7D\u8F66 \u8F7F\u8F66",
|
|
1776
|
+
size: [1.8, 4.6, 1.45],
|
|
1777
|
+
variants: [
|
|
1778
|
+
{ id: "sedan", en: "Sedan", zh: "\u8F7F\u8F66" },
|
|
1779
|
+
{ id: "suv", en: "SUV", zh: "SUV", size: [1.9, 4.8, 1.75] }
|
|
1780
|
+
],
|
|
1781
|
+
ifc: "IfcBuildingElementProxy",
|
|
1782
|
+
revit: "Parking",
|
|
1783
|
+
plan(p) {
|
|
1784
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1785
|
+
const cab0 = -hd * 0.45, cab1 = hd * 0.25;
|
|
1786
|
+
return [
|
|
1787
|
+
rc(0, 0, p.w, p.d, { r: Math.min(0.35, p.w * 0.2), fill: "paper" }),
|
|
1788
|
+
{ k: "poly", closed: true, pts: [[-hw + 0.12, cab1], [hw - 0.12, cab1], [hw - 0.2, cab1 + p.d * 0.12], [-hw + 0.2, cab1 + p.d * 0.12]] },
|
|
1789
|
+
rc(0, (cab0 + cab1) / 2, p.w - 0.3, cab1 - cab0, { r: 0.08 }),
|
|
1790
|
+
{ k: "poly", closed: true, pts: [[-hw + 0.15, cab0], [hw - 0.15, cab0], [hw - 0.22, cab0 - p.d * 0.07], [-hw + 0.22, cab0 - p.d * 0.07]] },
|
|
1791
|
+
rc(-hw - 0.05, cab1 - 0.05, 0.1, 0.08, { fill: "paper" }),
|
|
1792
|
+
rc(hw + 0.05, cab1 - 0.05, 0.1, 0.08, { fill: "paper" })
|
|
1793
|
+
];
|
|
1794
|
+
},
|
|
1795
|
+
mass(p) {
|
|
1796
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1797
|
+
const body = p.variant === "suv" ? 1 : 0.85;
|
|
1798
|
+
const cab0 = -hd * 0.5, cab1 = hd * 0.3;
|
|
1799
|
+
const wx = hw - 0.13, wy = hd * 0.65, wr = p.variant === "suv" ? 0.36 : 0.32;
|
|
1800
|
+
return [
|
|
1801
|
+
box(0, 0, 0.18, p.w, p.d, body - 0.18, "car"),
|
|
1802
|
+
box(0, (cab0 + cab1) / 2, body, p.w - 0.16, cab1 - cab0, p.h - body - 0.04, "glass"),
|
|
1803
|
+
box(0, (cab0 + cab1) / 2, p.h - 0.04, p.w - 0.2, cab1 - cab0 - 0.2, 0.04, "car"),
|
|
1804
|
+
...[[-wx, -wy], [wx, -wy], [-wx, wy], [wx, wy]].map(([x, y]) => box(x, y, 0, 0.24, wr * 2, wr * 2, "tire"))
|
|
1805
|
+
];
|
|
1806
|
+
}
|
|
1807
|
+
},
|
|
1808
|
+
{
|
|
1809
|
+
id: "parking_space",
|
|
1810
|
+
category: "vehicle",
|
|
1811
|
+
en: "Parking space",
|
|
1812
|
+
zh: "\u8F66\u4F4D",
|
|
1813
|
+
keywords: "parking stall bay space car park \u505C\u8F66\u4F4D \u8F66\u4F4D\u7EBF",
|
|
1814
|
+
size: [2.5, 5.3, 0.01],
|
|
1815
|
+
variants: [
|
|
1816
|
+
{ id: "standard", en: "Standard", zh: "\u6807\u51C6" },
|
|
1817
|
+
{ id: "accessible", en: "Accessible", zh: "\u65E0\u969C\u788D", size: [3.7, 5.3, 0.01] }
|
|
1818
|
+
],
|
|
1819
|
+
ifc: "IfcBuildingElementProxy",
|
|
1820
|
+
revit: "Parking",
|
|
1821
|
+
plan(p) {
|
|
1822
|
+
const hw = p.w / 2, hd = p.d / 2, t = 0.1;
|
|
1823
|
+
const out = [
|
|
1824
|
+
rc(-hw + t / 2, 0, t, p.d, { fill: "tone" }),
|
|
1825
|
+
rc(hw - t / 2, 0, t, p.d, { fill: "tone" }),
|
|
1826
|
+
rc(0, hd - t / 2, p.w, t, { fill: "tone" })
|
|
1827
|
+
];
|
|
1828
|
+
if (p.variant === "accessible") {
|
|
1829
|
+
const aw = Math.min(1.2, p.w * 0.35);
|
|
1830
|
+
out.push(ln(hw - aw, hd - t, hw - aw, -hd));
|
|
1831
|
+
for (let y = -hd + 0.4; y < hd - 0.3; y += 0.6) out.push(ln(hw - aw, y, hw - t, y + 0.5));
|
|
1832
|
+
out.push({ k: "circle", cx: -aw / 2, cy: -0.2, r: 0.45 });
|
|
1833
|
+
}
|
|
1834
|
+
return out;
|
|
1835
|
+
},
|
|
1836
|
+
mass(p) {
|
|
1837
|
+
const hw = p.w / 2, hd = p.d / 2, t = 0.1;
|
|
1838
|
+
return [
|
|
1839
|
+
box(-hw + t / 2, 0, 0, t, p.d, 5e-3, "paint"),
|
|
1840
|
+
box(hw - t / 2, 0, 0, t, p.d, 5e-3, "paint"),
|
|
1841
|
+
box(0, hd - t / 2, 0, p.w, t, 5e-3, "paint")
|
|
1842
|
+
];
|
|
1843
|
+
}
|
|
1844
|
+
},
|
|
1845
|
+
// ── Planting ──────────────────────────────────────────────────────────────
|
|
1846
|
+
{
|
|
1847
|
+
id: "tree",
|
|
1848
|
+
category: "planting",
|
|
1849
|
+
en: "Tree",
|
|
1850
|
+
zh: "\u4E54\u6728",
|
|
1851
|
+
keywords: "tree planting landscape \u6811 \u690D\u7269 \u666F\u89C2",
|
|
1852
|
+
size: [5, 5, 7],
|
|
1853
|
+
variants: [
|
|
1854
|
+
{ id: "deciduous", en: "Deciduous", zh: "\u843D\u53F6\u4E54\u6728" },
|
|
1855
|
+
{ id: "conifer", en: "Conifer", zh: "\u9488\u53F6\u6811", size: [3.5, 3.5, 8] }
|
|
1856
|
+
],
|
|
1857
|
+
ifc: "IfcGeographicElement",
|
|
1858
|
+
revit: "Planting",
|
|
1859
|
+
plan(p) {
|
|
1860
|
+
const rx = p.w / 2, ry = p.d / 2;
|
|
1861
|
+
const pts = [];
|
|
1862
|
+
if (p.variant === "conifer") {
|
|
1863
|
+
const n = 18;
|
|
1864
|
+
for (let i = 0; i < n * 2; i++) {
|
|
1865
|
+
const a = Math.PI * i / n, f = i % 2 === 0 ? 1 : 0.72;
|
|
1866
|
+
pts.push([Math.cos(a) * rx * f, Math.sin(a) * ry * f]);
|
|
1867
|
+
}
|
|
1868
|
+
const out = [{ k: "poly", closed: true, fill: "paper", pts }];
|
|
1869
|
+
for (let i = 0; i < n; i += 3) {
|
|
1870
|
+
const a = 2 * Math.PI * i / n;
|
|
1871
|
+
out.push(ln(0, 0, Math.cos(a) * rx * 0.7, Math.sin(a) * ry * 0.7));
|
|
1872
|
+
}
|
|
1873
|
+
out.push({ k: "circle", cx: 0, cy: 0, r: Math.min(rx, ry) * 0.06, fill: "dark" });
|
|
1874
|
+
return out;
|
|
1875
|
+
}
|
|
1876
|
+
const lobes = 13, steps = 6;
|
|
1877
|
+
for (let i = 0; i < lobes * steps; i++) {
|
|
1878
|
+
const a = 2 * Math.PI * i / (lobes * steps);
|
|
1879
|
+
const f = 0.88 + 0.12 * Math.sqrt(Math.sin(Math.PI * (i % steps) / steps));
|
|
1880
|
+
pts.push([Math.cos(a) * rx * f, Math.sin(a) * ry * f]);
|
|
1881
|
+
}
|
|
1882
|
+
return [
|
|
1883
|
+
{ k: "poly", closed: true, fill: "paper", pts },
|
|
1884
|
+
{ k: "ellipse", cx: 0, cy: 0, rx: rx * 0.55, ry: ry * 0.55, dash: true },
|
|
1885
|
+
{ k: "circle", cx: 0, cy: 0, r: Math.min(rx, ry) * 0.06, fill: "dark" },
|
|
1886
|
+
ln(-rx * 0.15, 0, rx * 0.15, 0),
|
|
1887
|
+
ln(0, -ry * 0.15, 0, ry * 0.15)
|
|
1888
|
+
];
|
|
1889
|
+
},
|
|
1890
|
+
mass(p) {
|
|
1891
|
+
const r = Math.min(p.w, p.d) / 2;
|
|
1892
|
+
if (p.variant === "conifer") {
|
|
1893
|
+
return [
|
|
1894
|
+
cyl(0, 0, 0, Math.max(0.08, r * 0.06), p.h * 0.3, "trunk", 0.8, 6),
|
|
1895
|
+
{ k: "cyl", x: 0, y: 0, z: p.h * 0.18, rx: p.w / 2, ry: p.d / 2, h: p.h * 0.82, c: "leafDark", top: 0, seg: 8 }
|
|
1896
|
+
];
|
|
1897
|
+
}
|
|
1898
|
+
const crown = Math.min(p.h * 0.6, Math.max(p.w, p.d) * 0.7);
|
|
1899
|
+
return [
|
|
1900
|
+
cyl(0, 0, 0, Math.max(0.08, r * 0.05), p.h - crown * 0.6, "trunk", 0.7, 6),
|
|
1901
|
+
{ k: "sph", x: 0, y: 0, z: p.h - crown / 2, rx: p.w / 2, ry: p.d / 2, rz: crown / 2, c: "leaf" }
|
|
1902
|
+
];
|
|
1903
|
+
}
|
|
1904
|
+
},
|
|
1905
|
+
{
|
|
1906
|
+
id: "plant",
|
|
1907
|
+
category: "planting",
|
|
1908
|
+
en: "Potted plant",
|
|
1909
|
+
zh: "\u76C6\u683D",
|
|
1910
|
+
keywords: "plant pot shrub indoor green \u7EFF\u690D \u82B1\u76C6 \u704C\u6728",
|
|
1911
|
+
size: [0.5, 0.5, 1.1],
|
|
1912
|
+
ifc: "IfcFurnishingElement",
|
|
1913
|
+
revit: "Planting",
|
|
1914
|
+
plan(p) {
|
|
1915
|
+
const rx = p.w / 2, ry = p.d / 2;
|
|
1916
|
+
const pts = [];
|
|
1917
|
+
const lobes = 7;
|
|
1918
|
+
for (let i = 0; i < lobes * 2; i++) {
|
|
1919
|
+
const a = Math.PI * i / lobes;
|
|
1920
|
+
const f = i % 2 === 0 ? 1 : 0.55;
|
|
1921
|
+
pts.push([Math.cos(a) * rx * f, Math.sin(a) * ry * f]);
|
|
1922
|
+
}
|
|
1923
|
+
return [{ k: "poly", closed: true, fill: "paper", pts }, { k: "ellipse", cx: 0, cy: 0, rx: rx * 0.45, ry: ry * 0.45 }];
|
|
1924
|
+
},
|
|
1925
|
+
mass(p) {
|
|
1926
|
+
const pot = Math.min(0.4, p.h * 0.35);
|
|
1927
|
+
return [
|
|
1928
|
+
{ k: "cyl", x: 0, y: 0, z: 0, rx: p.w * 0.25, ry: p.d * 0.25, h: pot, c: "counter", top: 1.2, seg: 10 },
|
|
1929
|
+
{ k: "sph", x: 0, y: 0, z: pot + (p.h - pot) / 2, rx: p.w / 2, ry: p.d / 2, rz: (p.h - pot) / 2, c: "leaf" }
|
|
1930
|
+
];
|
|
1931
|
+
}
|
|
1932
|
+
},
|
|
1933
|
+
// ── People ────────────────────────────────────────────────────────────────
|
|
1934
|
+
{
|
|
1935
|
+
id: "person",
|
|
1936
|
+
category: "entourage",
|
|
1937
|
+
en: "Person",
|
|
1938
|
+
zh: "\u4EBA\u7269",
|
|
1939
|
+
keywords: "people human figure scale entourage \u4EBA \u6BD4\u4F8B\u4EBA",
|
|
1940
|
+
size: [0.5, 0.3, 1.75],
|
|
1941
|
+
variants: [
|
|
1942
|
+
{ id: "adult", en: "Adult", zh: "\u6210\u4EBA" },
|
|
1943
|
+
{ id: "child", en: "Child", zh: "\u513F\u7AE5", size: [0.36, 0.22, 1.2] }
|
|
1944
|
+
],
|
|
1945
|
+
ifc: "IfcBuildingElementProxy",
|
|
1946
|
+
revit: "Entourage",
|
|
1947
|
+
plan(p) {
|
|
1948
|
+
const head = Math.min(p.w, p.d) * 0.36;
|
|
1949
|
+
return [
|
|
1950
|
+
{ k: "ellipse", cx: 0, cy: 0, rx: p.w / 2, ry: p.d / 2, fill: "paper" },
|
|
1951
|
+
{ k: "circle", cx: 0, cy: -p.d * 0.05, r: head, fill: "paper" },
|
|
1952
|
+
ln(0, -p.d * 0.05 - head, 0, -p.d / 2)
|
|
1953
|
+
];
|
|
1954
|
+
},
|
|
1955
|
+
mass(p) {
|
|
1956
|
+
const head = p.h * 0.075, leg = p.h * 0.47, torso = p.h - leg - head * 2 - 0.02;
|
|
1957
|
+
return [
|
|
1958
|
+
box(-p.w * 0.16, 0, 0, p.w * 0.26, p.d * 0.6, leg, "cloth"),
|
|
1959
|
+
box(p.w * 0.16, 0, 0, p.w * 0.26, p.d * 0.6, leg, "cloth"),
|
|
1960
|
+
box(0, 0, leg, p.w * 0.72, p.d * 0.75, torso, "fabricWarm"),
|
|
1961
|
+
box(-p.w * 0.43, 0, leg + torso * 0.15, p.w * 0.14, p.d * 0.5, torso * 0.85, "fabricWarm"),
|
|
1962
|
+
box(p.w * 0.43, 0, leg + torso * 0.15, p.w * 0.14, p.d * 0.5, torso * 0.85, "fabricWarm"),
|
|
1963
|
+
{ k: "sph", x: 0, y: 0, z: p.h - head, rx: head * 0.85, ry: head * 0.95, rz: head, c: "skin" }
|
|
1964
|
+
];
|
|
1965
|
+
}
|
|
1966
|
+
},
|
|
1967
|
+
// ── Generic placeholders ──────────────────────────────────────────────────
|
|
1968
|
+
{
|
|
1969
|
+
id: "generic_box",
|
|
1970
|
+
category: "generic",
|
|
1971
|
+
en: "Box placeholder",
|
|
1972
|
+
zh: "\u65B9\u4F53\u5360\u4F4D",
|
|
1973
|
+
keywords: "generic box block placeholder massing \u4F53\u5757 \u5360\u4F4D",
|
|
1974
|
+
size: [1, 1, 1],
|
|
1975
|
+
ifc: "IfcBuildingElementProxy",
|
|
1976
|
+
revit: "Generic Models",
|
|
1977
|
+
plan(p) {
|
|
1978
|
+
const hw = p.w / 2, hd = p.d / 2;
|
|
1979
|
+
return [outline(p), ln(-hw, -hd, hw, hd, true), ln(-hw, hd, hw, -hd, true)];
|
|
1980
|
+
},
|
|
1981
|
+
mass(p) {
|
|
1982
|
+
return [box(0, 0, 0, p.w, p.d, p.h, "generic")];
|
|
1983
|
+
}
|
|
1984
|
+
},
|
|
1985
|
+
{
|
|
1986
|
+
id: "generic_cylinder",
|
|
1987
|
+
category: "generic",
|
|
1988
|
+
en: "Cylinder placeholder",
|
|
1989
|
+
zh: "\u5706\u67F1\u5360\u4F4D",
|
|
1990
|
+
keywords: "generic cylinder round placeholder tank \u5706\u67F1 \u5360\u4F4D",
|
|
1991
|
+
size: [1, 1, 1],
|
|
1992
|
+
ifc: "IfcBuildingElementProxy",
|
|
1993
|
+
revit: "Generic Models",
|
|
1994
|
+
plan(p) {
|
|
1995
|
+
const rx = p.w / 2, ry = p.d / 2;
|
|
1996
|
+
return [{ k: "ellipse", cx: 0, cy: 0, rx, ry, fill: "paper" }, ln(-rx, 0, rx, 0, true), ln(0, -ry, 0, ry, true)];
|
|
1997
|
+
},
|
|
1998
|
+
mass(p) {
|
|
1999
|
+
return [{ k: "cyl", x: 0, y: 0, z: 0, rx: p.w / 2, ry: p.d / 2, h: p.h, c: "generic", seg: 20 }];
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
];
|
|
2003
|
+
var BY_ID = new Map(FAMILIES.map((f) => [f.id, f]));
|
|
2004
|
+
function furnitureFamilies() {
|
|
2005
|
+
return FAMILIES;
|
|
2006
|
+
}
|
|
2007
|
+
function getFurnitureFamily(id) {
|
|
2008
|
+
return id ? BY_ID.get(id) : void 0;
|
|
2009
|
+
}
|
|
2010
|
+
function fallbackFamily() {
|
|
2011
|
+
return BY_ID.get("generic_box");
|
|
2012
|
+
}
|
|
2013
|
+
function resolveVariant(fam, variant) {
|
|
2014
|
+
if (!fam.variants || fam.variants.length === 0) return void 0;
|
|
2015
|
+
return fam.variants.find((v) => v.id === variant) ?? fam.variants[0];
|
|
2016
|
+
}
|
|
2017
|
+
function defaultSize(fam, variant) {
|
|
2018
|
+
return resolveVariant(fam, variant)?.size ?? fam.size;
|
|
2019
|
+
}
|
|
2020
|
+
var num2 = (v) => {
|
|
2021
|
+
if (v === void 0 || v === "") return void 0;
|
|
2022
|
+
const n = Number(v);
|
|
2023
|
+
return Number.isFinite(n) && n > 0 ? n : void 0;
|
|
2024
|
+
};
|
|
2025
|
+
function resolveFurniture(attrs, upm = 1) {
|
|
2026
|
+
const known = getFurnitureFamily(attrs.family);
|
|
2027
|
+
const family = known ?? fallbackFamily();
|
|
2028
|
+
const variant = resolveVariant(family, attrs.variant)?.id ?? "";
|
|
2029
|
+
const [dw, dd, dh] = defaultSize(family, variant);
|
|
2030
|
+
const m = (v) => {
|
|
2031
|
+
const n = num2(v);
|
|
2032
|
+
return n === void 0 ? void 0 : n / upm;
|
|
2033
|
+
};
|
|
2034
|
+
const params = { variant, w: m(attrs.size_x) ?? dw, d: m(attrs.size_y) ?? dd, h: m(attrs.height) ?? dh };
|
|
2035
|
+
return {
|
|
2036
|
+
family,
|
|
2037
|
+
unknownFamily: !known,
|
|
2038
|
+
params,
|
|
2039
|
+
mirror: attrs.mirror === "true" || attrs.mirror === "1",
|
|
2040
|
+
upm,
|
|
2041
|
+
size: { w: params.w * upm, d: params.d * upm, h: params.h * upm }
|
|
2042
|
+
};
|
|
2043
|
+
}
|
|
2044
|
+
function scalePrim(p, k) {
|
|
2045
|
+
switch (p.k) {
|
|
2046
|
+
case "rect":
|
|
2047
|
+
return { ...p, x: p.x * k, y: p.y * k, w: p.w * k, h: p.h * k, ...p.r ? { r: p.r * k } : {} };
|
|
2048
|
+
case "circle":
|
|
2049
|
+
return { ...p, cx: p.cx * k, cy: p.cy * k, r: p.r * k };
|
|
2050
|
+
case "ellipse":
|
|
2051
|
+
return { ...p, cx: p.cx * k, cy: p.cy * k, rx: p.rx * k, ry: p.ry * k };
|
|
2052
|
+
case "line":
|
|
2053
|
+
return { ...p, x1: p.x1 * k, y1: p.y1 * k, x2: p.x2 * k, y2: p.y2 * k };
|
|
2054
|
+
case "poly":
|
|
2055
|
+
return { ...p, pts: p.pts.map(([x, y]) => [x * k, y * k]) };
|
|
2056
|
+
case "arc":
|
|
2057
|
+
return { ...p, cx: p.cx * k, cy: p.cy * k, r: p.r * k };
|
|
2058
|
+
case "text":
|
|
2059
|
+
return { ...p, x: p.x * k, y: p.y * k, size: p.size * k };
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
function mirrorPrim(p) {
|
|
2063
|
+
switch (p.k) {
|
|
2064
|
+
case "rect":
|
|
2065
|
+
return { ...p, x: -(p.x + p.w) };
|
|
2066
|
+
case "circle":
|
|
2067
|
+
return { ...p, cx: -p.cx };
|
|
2068
|
+
case "ellipse":
|
|
2069
|
+
return { ...p, cx: -p.cx };
|
|
2070
|
+
case "line":
|
|
2071
|
+
return { ...p, x1: -p.x1, x2: -p.x2 };
|
|
2072
|
+
case "poly":
|
|
2073
|
+
return { ...p, pts: p.pts.map(([x, y]) => [-x, y]) };
|
|
2074
|
+
case "arc":
|
|
2075
|
+
return { ...p, cx: -p.cx, a0: 180 - p.a1, a1: 180 - p.a0 };
|
|
2076
|
+
case "text":
|
|
2077
|
+
return { ...p, x: -p.x };
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
function furniturePlan(r) {
|
|
2081
|
+
const prims = r.family.plan(r.params).map((p) => r.upm === 1 ? p : scalePrim(p, r.upm));
|
|
2082
|
+
return r.mirror ? prims.map(mirrorPrim) : prims;
|
|
2083
|
+
}
|
|
2084
|
+
function arcPath(a) {
|
|
2085
|
+
const rad = Math.PI / 180;
|
|
2086
|
+
const x0 = a.cx + a.r * Math.cos(a.a0 * rad), y0 = a.cy + a.r * Math.sin(a.a0 * rad);
|
|
2087
|
+
const x1 = a.cx + a.r * Math.cos(a.a1 * rad), y1 = a.cy + a.r * Math.sin(a.a1 * rad);
|
|
2088
|
+
const large = a.a1 - a.a0 > 180 ? 1 : 0;
|
|
2089
|
+
return `M ${f3(x0)} ${f3(y0)} A ${f3(a.r)} ${f3(a.r)} 0 ${large} 1 ${f3(x1)} ${f3(y1)}`;
|
|
2090
|
+
}
|
|
2091
|
+
function f3(n) {
|
|
2092
|
+
return Number(n.toFixed(4)).toString();
|
|
2093
|
+
}
|
|
2094
|
+
function variantIds(fam) {
|
|
2095
|
+
return (fam.variants ?? []).map((v) => v.id);
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
export {
|
|
2099
|
+
ELEVATION_VIEW_IDS,
|
|
2100
|
+
parseDimensionRef,
|
|
2101
|
+
validateAnnotations,
|
|
2102
|
+
CATEGORY_LABELS,
|
|
2103
|
+
CATEGORY_ORDER,
|
|
2104
|
+
furnitureFamilies,
|
|
2105
|
+
getFurnitureFamily,
|
|
2106
|
+
resolveFurniture,
|
|
2107
|
+
furniturePlan,
|
|
2108
|
+
arcPath,
|
|
2109
|
+
variantIds,
|
|
2110
|
+
parseSlopeArrow,
|
|
2111
|
+
PANEL_KINDS,
|
|
2112
|
+
parseNumberList,
|
|
2113
|
+
parsePanels,
|
|
2114
|
+
gridLines,
|
|
2115
|
+
cellKinds,
|
|
2116
|
+
STAIR_CUT_HEIGHT,
|
|
2117
|
+
runDir,
|
|
2118
|
+
winderGeometry,
|
|
2119
|
+
railPlan,
|
|
2120
|
+
runPlan,
|
|
2121
|
+
walkingLine,
|
|
2122
|
+
STAIR_LIMITS,
|
|
2123
|
+
stairCalc,
|
|
2124
|
+
loadStairs,
|
|
2125
|
+
embedCircle,
|
|
2126
|
+
embedPointAt,
|
|
2127
|
+
curtainEmbedSpan
|
|
2128
|
+
};
|
|
2129
|
+
//# sourceMappingURL=chunk-AYAXRYGP.js.map
|