brepjs-bim 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brepjs-bim.cjs +34 -8
- package/dist/brepjs-bim.js +34 -8
- package/dist/model/bimModel.d.ts +2 -2
- package/package.json +1 -1
package/dist/brepjs-bim.cjs
CHANGED
|
@@ -6378,18 +6378,22 @@ var BimModel = class {
|
|
|
6378
6378
|
this.#associateClassification(id, spec);
|
|
6379
6379
|
return (0, brepjs.ok)(id);
|
|
6380
6380
|
}
|
|
6381
|
-
addBeam(spec) {
|
|
6381
|
+
addBeam(spec, options) {
|
|
6382
|
+
const keyCheck = this.#checkStableKey(options);
|
|
6383
|
+
if (!keyCheck.ok) return keyCheck;
|
|
6382
6384
|
const geomResult = beamToSolid(spec);
|
|
6383
6385
|
if (!geomResult.ok) return (0, brepjs.err)(geomResult.error);
|
|
6384
|
-
const id = this.#makeElement("BEAM", spec, geomResult.value);
|
|
6386
|
+
const id = this.#makeElement("BEAM", spec, geomResult.value, options?.stableKey);
|
|
6385
6387
|
this.#associateMaterial(id, spec);
|
|
6386
6388
|
this.#associateClassification(id, spec);
|
|
6387
6389
|
return (0, brepjs.ok)(id);
|
|
6388
6390
|
}
|
|
6389
|
-
addColumn(spec) {
|
|
6391
|
+
addColumn(spec, options) {
|
|
6392
|
+
const keyCheck = this.#checkStableKey(options);
|
|
6393
|
+
if (!keyCheck.ok) return keyCheck;
|
|
6390
6394
|
const geomResult = columnToSolid(spec);
|
|
6391
6395
|
if (!geomResult.ok) return (0, brepjs.err)(geomResult.error);
|
|
6392
|
-
const id = this.#makeElement("COLUMN", spec, geomResult.value);
|
|
6396
|
+
const id = this.#makeElement("COLUMN", spec, geomResult.value, options?.stableKey);
|
|
6393
6397
|
this.#associateMaterial(id, spec);
|
|
6394
6398
|
this.#associateClassification(id, spec);
|
|
6395
6399
|
return (0, brepjs.ok)(id);
|
|
@@ -16493,7 +16497,7 @@ function assignNum(target, key, value) {
|
|
|
16493
16497
|
* while the IR path serves the viewport and dedup. GlobalIds derive from
|
|
16494
16498
|
* families key paths (stable under reordering), not insertion order.
|
|
16495
16499
|
*
|
|
16496
|
-
* Scope: Storey containers, Wall/Slab elements, and wall openings — a
|
|
16500
|
+
* Scope: Storey containers, Wall/Slab/Column/Beam elements, and wall openings — a
|
|
16497
16501
|
* fill-role void (Door/Window family) maps onto addDoor/addWindow, which cut
|
|
16498
16502
|
* the wall and wire IfcRelVoidsElement + IfcRelFillsElement; the opening and
|
|
16499
16503
|
* filler GlobalIds derive from the synthesized key paths. Anonymous (non-fill)
|
|
@@ -16523,6 +16527,27 @@ var GEOMETRY_PROPS = /* @__PURE__ */ new Set([
|
|
|
16523
16527
|
"transform",
|
|
16524
16528
|
"psets"
|
|
16525
16529
|
]);
|
|
16530
|
+
var SPEC_ROUTES = {
|
|
16531
|
+
Wall: {
|
|
16532
|
+
parse: parseWallSpec,
|
|
16533
|
+
add: (m, spec, key) => m.addWall(spec, { stableKey: key })
|
|
16534
|
+
},
|
|
16535
|
+
Slab: {
|
|
16536
|
+
parse: parseSlabSpec,
|
|
16537
|
+
add: (m, spec, key) => m.addSlab(spec, { stableKey: key })
|
|
16538
|
+
},
|
|
16539
|
+
Column: {
|
|
16540
|
+
parse: parseColumnSpec,
|
|
16541
|
+
add: (m, spec, key) => m.addColumn(spec, { stableKey: key })
|
|
16542
|
+
},
|
|
16543
|
+
Beam: {
|
|
16544
|
+
parse: parseBeamSpec,
|
|
16545
|
+
add: (m, spec, key) => m.addBeam(spec, { stableKey: key })
|
|
16546
|
+
}
|
|
16547
|
+
};
|
|
16548
|
+
function specRoute(type) {
|
|
16549
|
+
return Object.hasOwn(SPEC_ROUTES, type) ? SPEC_ROUTES[type] : void 0;
|
|
16550
|
+
}
|
|
16526
16551
|
/** Total of the resolved geometry's OUTER literal translate chain. The
|
|
16527
16552
|
* transform vocabulary is translate-only, so frame differences are exact
|
|
16528
16553
|
* subtractions. Parameter-driven translations stop the peel. */
|
|
@@ -16668,6 +16693,7 @@ function familiesToBim(root, options) {
|
|
|
16668
16693
|
const idByKeyPath = /* @__PURE__ */ new Map();
|
|
16669
16694
|
const walk = (el, storeyId) => {
|
|
16670
16695
|
let containerId = storeyId;
|
|
16696
|
+
const route = specRoute(el.type);
|
|
16671
16697
|
if (el.type === "Storey") {
|
|
16672
16698
|
const keyed = requireKeyed(el);
|
|
16673
16699
|
if (!keyed.ok) return keyed;
|
|
@@ -16678,12 +16704,12 @@ function familiesToBim(root, options) {
|
|
|
16678
16704
|
model.aggregate(buildingId, id);
|
|
16679
16705
|
idByKeyPath.set(el.keyPath, id);
|
|
16680
16706
|
containerId = id;
|
|
16681
|
-
} else if (
|
|
16707
|
+
} else if (route !== void 0) {
|
|
16682
16708
|
const keyed = requireKeyed(el);
|
|
16683
16709
|
if (!keyed.ok) return keyed;
|
|
16684
|
-
const parsed =
|
|
16710
|
+
const parsed = route.parse(specInput(el));
|
|
16685
16711
|
if (!parsed.ok) return parsed;
|
|
16686
|
-
const added =
|
|
16712
|
+
const added = route.add(model, parsed.value, el.keyPath);
|
|
16687
16713
|
if (!added.ok) return added;
|
|
16688
16714
|
idByKeyPath.set(el.keyPath, added.value);
|
|
16689
16715
|
if (containerId === null) return (0, brepjs.err)(specError("FAMILIES_NO_STOREY", `familiesToBim: '${el.keyPath}' has no Storey ancestor — IFC elements need spatial containment`));
|
package/dist/brepjs-bim.js
CHANGED
|
@@ -6355,18 +6355,22 @@ var BimModel = class {
|
|
|
6355
6355
|
this.#associateClassification(id, spec);
|
|
6356
6356
|
return ok(id);
|
|
6357
6357
|
}
|
|
6358
|
-
addBeam(spec) {
|
|
6358
|
+
addBeam(spec, options) {
|
|
6359
|
+
const keyCheck = this.#checkStableKey(options);
|
|
6360
|
+
if (!keyCheck.ok) return keyCheck;
|
|
6359
6361
|
const geomResult = beamToSolid(spec);
|
|
6360
6362
|
if (!geomResult.ok) return err(geomResult.error);
|
|
6361
|
-
const id = this.#makeElement("BEAM", spec, geomResult.value);
|
|
6363
|
+
const id = this.#makeElement("BEAM", spec, geomResult.value, options?.stableKey);
|
|
6362
6364
|
this.#associateMaterial(id, spec);
|
|
6363
6365
|
this.#associateClassification(id, spec);
|
|
6364
6366
|
return ok(id);
|
|
6365
6367
|
}
|
|
6366
|
-
addColumn(spec) {
|
|
6368
|
+
addColumn(spec, options) {
|
|
6369
|
+
const keyCheck = this.#checkStableKey(options);
|
|
6370
|
+
if (!keyCheck.ok) return keyCheck;
|
|
6367
6371
|
const geomResult = columnToSolid(spec);
|
|
6368
6372
|
if (!geomResult.ok) return err(geomResult.error);
|
|
6369
|
-
const id = this.#makeElement("COLUMN", spec, geomResult.value);
|
|
6373
|
+
const id = this.#makeElement("COLUMN", spec, geomResult.value, options?.stableKey);
|
|
6370
6374
|
this.#associateMaterial(id, spec);
|
|
6371
6375
|
this.#associateClassification(id, spec);
|
|
6372
6376
|
return ok(id);
|
|
@@ -16470,7 +16474,7 @@ function assignNum(target, key, value) {
|
|
|
16470
16474
|
* while the IR path serves the viewport and dedup. GlobalIds derive from
|
|
16471
16475
|
* families key paths (stable under reordering), not insertion order.
|
|
16472
16476
|
*
|
|
16473
|
-
* Scope: Storey containers, Wall/Slab elements, and wall openings — a
|
|
16477
|
+
* Scope: Storey containers, Wall/Slab/Column/Beam elements, and wall openings — a
|
|
16474
16478
|
* fill-role void (Door/Window family) maps onto addDoor/addWindow, which cut
|
|
16475
16479
|
* the wall and wire IfcRelVoidsElement + IfcRelFillsElement; the opening and
|
|
16476
16480
|
* filler GlobalIds derive from the synthesized key paths. Anonymous (non-fill)
|
|
@@ -16500,6 +16504,27 @@ var GEOMETRY_PROPS = /* @__PURE__ */ new Set([
|
|
|
16500
16504
|
"transform",
|
|
16501
16505
|
"psets"
|
|
16502
16506
|
]);
|
|
16507
|
+
var SPEC_ROUTES = {
|
|
16508
|
+
Wall: {
|
|
16509
|
+
parse: parseWallSpec,
|
|
16510
|
+
add: (m, spec, key) => m.addWall(spec, { stableKey: key })
|
|
16511
|
+
},
|
|
16512
|
+
Slab: {
|
|
16513
|
+
parse: parseSlabSpec,
|
|
16514
|
+
add: (m, spec, key) => m.addSlab(spec, { stableKey: key })
|
|
16515
|
+
},
|
|
16516
|
+
Column: {
|
|
16517
|
+
parse: parseColumnSpec,
|
|
16518
|
+
add: (m, spec, key) => m.addColumn(spec, { stableKey: key })
|
|
16519
|
+
},
|
|
16520
|
+
Beam: {
|
|
16521
|
+
parse: parseBeamSpec,
|
|
16522
|
+
add: (m, spec, key) => m.addBeam(spec, { stableKey: key })
|
|
16523
|
+
}
|
|
16524
|
+
};
|
|
16525
|
+
function specRoute(type) {
|
|
16526
|
+
return Object.hasOwn(SPEC_ROUTES, type) ? SPEC_ROUTES[type] : void 0;
|
|
16527
|
+
}
|
|
16503
16528
|
/** Total of the resolved geometry's OUTER literal translate chain. The
|
|
16504
16529
|
* transform vocabulary is translate-only, so frame differences are exact
|
|
16505
16530
|
* subtractions. Parameter-driven translations stop the peel. */
|
|
@@ -16645,6 +16670,7 @@ function familiesToBim(root, options) {
|
|
|
16645
16670
|
const idByKeyPath = /* @__PURE__ */ new Map();
|
|
16646
16671
|
const walk = (el, storeyId) => {
|
|
16647
16672
|
let containerId = storeyId;
|
|
16673
|
+
const route = specRoute(el.type);
|
|
16648
16674
|
if (el.type === "Storey") {
|
|
16649
16675
|
const keyed = requireKeyed(el);
|
|
16650
16676
|
if (!keyed.ok) return keyed;
|
|
@@ -16655,12 +16681,12 @@ function familiesToBim(root, options) {
|
|
|
16655
16681
|
model.aggregate(buildingId, id);
|
|
16656
16682
|
idByKeyPath.set(el.keyPath, id);
|
|
16657
16683
|
containerId = id;
|
|
16658
|
-
} else if (
|
|
16684
|
+
} else if (route !== void 0) {
|
|
16659
16685
|
const keyed = requireKeyed(el);
|
|
16660
16686
|
if (!keyed.ok) return keyed;
|
|
16661
|
-
const parsed =
|
|
16687
|
+
const parsed = route.parse(specInput(el));
|
|
16662
16688
|
if (!parsed.ok) return parsed;
|
|
16663
|
-
const added =
|
|
16689
|
+
const added = route.add(model, parsed.value, el.keyPath);
|
|
16664
16690
|
if (!added.ok) return added;
|
|
16665
16691
|
idByKeyPath.set(el.keyPath, added.value);
|
|
16666
16692
|
if (containerId === null) return err(specError("FAMILIES_NO_STOREY", `familiesToBim: '${el.keyPath}' has no Storey ancestor — IFC elements need spatial containment`));
|
package/dist/model/bimModel.d.ts
CHANGED
|
@@ -42,8 +42,8 @@ export declare class BimModel {
|
|
|
42
42
|
addStorey(spec: StoreySpec, options?: ElementIdentityOptions): LocalId;
|
|
43
43
|
addWall(spec: WallSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
|
|
44
44
|
addSlab(spec: SlabSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
|
|
45
|
-
addBeam(spec: BeamSpec): Result<LocalId, BimError>;
|
|
46
|
-
addColumn(spec: ColumnSpec): Result<LocalId, BimError>;
|
|
45
|
+
addBeam(spec: BeamSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
|
|
46
|
+
addColumn(spec: ColumnSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
|
|
47
47
|
addSpace(spec: SpaceSpec): Result<LocalId, BimError>;
|
|
48
48
|
addRoof(spec: RoofSpec): Result<LocalId, BimError>;
|
|
49
49
|
addCurtainWall(spec: CurtainWallSpec): Result<LocalId, BimError>;
|