brepjs-bim 0.12.0 → 0.14.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/README.md CHANGED
@@ -43,7 +43,7 @@ export.
43
43
  | Spatial structure | project → site → building → storey aggregation; `placeIn` to assign elements to a storey |
44
44
  | Property sets | IFC pset templates + measure types; quantity sets for takeoff |
45
45
  | Data layers | materials (layer/profile/simple sets), classification refs, surface styles, zones/systems |
46
- | IFC export | `toIfc` → IFC-SPF (`Uint8Array`); IFC2X3 / IFC4 schema selection; owner history |
46
+ | IFC export | `toIfc` → IFC-SPF (`Uint8Array`); IFC4 / IFC4X3 schema selection; owner history |
47
47
  | IFC import | `fromIfc` / `SpfReader` → `ImportedModel` (elements, geometry, psets, materials, spatial tree) |
48
48
  | Validation | referential integrity, schema check, geometry validity, IFC round-trip report |
49
49
  | Interop | COBie 2.4 export (CSV/JSON), IDS 1.0 checking, BCF 3.0 read/write |
@@ -57,8 +57,9 @@ validator and generates geometry for every product. See [VALIDATION.md](./VALIDA
57
57
  to reproduce, and `examples/sampleBuilding.mjs` for the model it validates.
58
58
 
59
59
  > **Not yet:** the official buildingSMART Validation Service and desktop-tool
60
- > interop (Revit / ArchiCAD / Solibri) are unverified. This is an early-stage
61
- > (`0.1.x`) experimental package and the API will change.
60
+ > interop (Revit / Solibri) are unverified the fixtures and per-tool
61
+ > checklists are ready in [VALIDATION.md](./VALIDATION.md). This is an
62
+ > experimental pre-1.0 package and the API may change.
62
63
 
63
64
  ## Usage
64
65
 
@@ -6398,10 +6398,12 @@ var BimModel = class {
6398
6398
  this.#associateClassification(id, spec);
6399
6399
  return (0, brepjs.ok)(id);
6400
6400
  }
6401
- addSpace(spec) {
6401
+ addSpace(spec, options) {
6402
+ const keyCheck = this.#checkStableKey(options);
6403
+ if (!keyCheck.ok) return keyCheck;
6402
6404
  const geomResult = spaceToSolid(spec);
6403
6405
  if (!geomResult.ok) return (0, brepjs.err)(geomResult.error);
6404
- const id = this.#makeElement("SPACE", spec, geomResult.value);
6406
+ const id = this.#makeElement("SPACE", spec, geomResult.value, options?.stableKey);
6405
6407
  this.#associateMaterial(id, spec);
6406
6408
  this.#associateClassification(id, spec);
6407
6409
  return (0, brepjs.ok)(id);
@@ -6416,26 +6418,32 @@ var BimModel = class {
6416
6418
  this.#associateClassification(id, spec);
6417
6419
  return (0, brepjs.ok)(id);
6418
6420
  }
6419
- addCurtainWall(spec) {
6421
+ addCurtainWall(spec, options) {
6422
+ const keyCheck = this.#checkStableKey(options);
6423
+ if (!keyCheck.ok) return keyCheck;
6420
6424
  const gridResult = curtainWallToGrid(spec);
6421
6425
  if (!gridResult.ok) return (0, brepjs.err)(gridResult.error);
6422
- const id = this.#makeElement("CURTAIN_WALL", spec, gridResult.value);
6426
+ const id = this.#makeElement("CURTAIN_WALL", spec, gridResult.value, options?.stableKey);
6423
6427
  this.#associateMaterial(id, spec);
6424
6428
  this.#associateClassification(id, spec);
6425
6429
  return (0, brepjs.ok)(id);
6426
6430
  }
6427
- addFooting(spec) {
6431
+ addFooting(spec, options) {
6432
+ const keyCheck = this.#checkStableKey(options);
6433
+ if (!keyCheck.ok) return keyCheck;
6428
6434
  const geomResult = footingToSolid(spec);
6429
6435
  if (!geomResult.ok) return (0, brepjs.err)(geomResult.error);
6430
- const id = this.#makeElement("FOOTING", spec, geomResult.value);
6436
+ const id = this.#makeElement("FOOTING", spec, geomResult.value, options?.stableKey);
6431
6437
  this.#associateMaterial(id, spec);
6432
6438
  this.#associateClassification(id, spec);
6433
6439
  return (0, brepjs.ok)(id);
6434
6440
  }
6435
- addPile(spec) {
6441
+ addPile(spec, options) {
6442
+ const keyCheck = this.#checkStableKey(options);
6443
+ if (!keyCheck.ok) return keyCheck;
6436
6444
  const geomResult = pileToSolid(spec);
6437
6445
  if (!geomResult.ok) return (0, brepjs.err)(geomResult.error);
6438
- const id = this.#makeElement("PILE", spec, geomResult.value);
6446
+ const id = this.#makeElement("PILE", spec, geomResult.value, options?.stableKey);
6439
6447
  this.#associateMaterial(id, spec);
6440
6448
  this.#associateClassification(id, spec);
6441
6449
  return (0, brepjs.ok)(id);
@@ -6465,10 +6473,12 @@ var BimModel = class {
6465
6473
  this.#associateClassification(id, spec);
6466
6474
  return (0, brepjs.ok)(id);
6467
6475
  }
6468
- addRailing(spec) {
6476
+ addRailing(spec, options) {
6477
+ const keyCheck = this.#checkStableKey(options);
6478
+ if (!keyCheck.ok) return keyCheck;
6469
6479
  const geomResult = railingToSolid(spec);
6470
6480
  if (!geomResult.ok) return (0, brepjs.err)(geomResult.error);
6471
- const id = this.#makeElement("RAILING", spec, geomResult.value);
6481
+ const id = this.#makeElement("RAILING", spec, geomResult.value, options?.stableKey);
6472
6482
  this.#associateMaterial(id, spec);
6473
6483
  this.#associateClassification(id, spec);
6474
6484
  return (0, brepjs.ok)(id);
@@ -6478,10 +6488,12 @@ var BimModel = class {
6478
6488
  * IfcRelCoversBldgElements linking the covering to its host (e.g. a slab it
6479
6489
  * finishes) is recorded for export.
6480
6490
  */
6481
- addCovering(spec, hostLocalId) {
6491
+ addCovering(spec, hostLocalId, options) {
6492
+ const keyCheck = this.#checkStableKey(options);
6493
+ if (!keyCheck.ok) return keyCheck;
6482
6494
  const geomResult = coveringToSolid(spec);
6483
6495
  if (!geomResult.ok) return (0, brepjs.err)(geomResult.error);
6484
- const id = this.#makeElement("COVERING", spec, geomResult.value);
6496
+ const id = this.#makeElement("COVERING", spec, geomResult.value, options?.stableKey);
6485
6497
  this.#associateMaterial(id, spec);
6486
6498
  this.#associateClassification(id, spec);
6487
6499
  if (hostLocalId !== void 0) this.#makeRel({
@@ -6649,9 +6661,11 @@ var BimModel = class {
6649
6661
  * and disposes it on model disposal; the caller must not dispose it (see
6650
6662
  * {@link ProxySpec.solid}).
6651
6663
  */
6652
- addProxy(spec) {
6664
+ addProxy(spec, options) {
6665
+ const keyCheck = this.#checkStableKey(options);
6666
+ if (!keyCheck.ok) return keyCheck;
6653
6667
  if (spec.solid === null || spec.solid === void 0) return (0, brepjs.err)(specError("PROXY_NO_GEOMETRY", "ProxySpec.solid is required"));
6654
- const id = this.#makeElement("PROXY", spec, spec.solid);
6668
+ const id = this.#makeElement("PROXY", spec, spec.solid, options?.stableKey);
6655
6669
  if (spec.materialName !== void 0) this.#makeRel({
6656
6670
  kind: "ASSOCIATES_MATERIAL",
6657
6671
  materialName: spec.materialName,
@@ -8107,7 +8121,7 @@ function writeTessellation(w, solid, geomSubContextId, _localPlacementId, tolera
8107
8121
  type: web_ifc.IFCTRIANGULATEDFACESET,
8108
8122
  Coordinates: w.ref(pointListId),
8109
8123
  Normals: null,
8110
- Closed: true,
8124
+ Closed: w.mkType(web_ifc.IFCBOOLEAN, true),
8111
8125
  CoordIndex: coordIndex.map((tri) => tri.map((idx) => w.mkType(web_ifc.IFCPOSITIVEINTEGER, idx))),
8112
8126
  PnIndex: null
8113
8127
  });
@@ -8211,7 +8225,7 @@ function writeFacetedBrepFallback(w, geomSubContextId, reason) {
8211
8225
  expressID: faceOuterBoundId,
8212
8226
  type: web_ifc.IFCFACEOUTERBOUND,
8213
8227
  Bound: w.ref(loopId),
8214
- Orientation: true
8228
+ Orientation: w.mkType(web_ifc.IFCBOOLEAN, true)
8215
8229
  });
8216
8230
  const faceId = w.nextId();
8217
8231
  w.writeLine({
@@ -6375,10 +6375,12 @@ var BimModel = class {
6375
6375
  this.#associateClassification(id, spec);
6376
6376
  return ok(id);
6377
6377
  }
6378
- addSpace(spec) {
6378
+ addSpace(spec, options) {
6379
+ const keyCheck = this.#checkStableKey(options);
6380
+ if (!keyCheck.ok) return keyCheck;
6379
6381
  const geomResult = spaceToSolid(spec);
6380
6382
  if (!geomResult.ok) return err(geomResult.error);
6381
- const id = this.#makeElement("SPACE", spec, geomResult.value);
6383
+ const id = this.#makeElement("SPACE", spec, geomResult.value, options?.stableKey);
6382
6384
  this.#associateMaterial(id, spec);
6383
6385
  this.#associateClassification(id, spec);
6384
6386
  return ok(id);
@@ -6393,26 +6395,32 @@ var BimModel = class {
6393
6395
  this.#associateClassification(id, spec);
6394
6396
  return ok(id);
6395
6397
  }
6396
- addCurtainWall(spec) {
6398
+ addCurtainWall(spec, options) {
6399
+ const keyCheck = this.#checkStableKey(options);
6400
+ if (!keyCheck.ok) return keyCheck;
6397
6401
  const gridResult = curtainWallToGrid(spec);
6398
6402
  if (!gridResult.ok) return err(gridResult.error);
6399
- const id = this.#makeElement("CURTAIN_WALL", spec, gridResult.value);
6403
+ const id = this.#makeElement("CURTAIN_WALL", spec, gridResult.value, options?.stableKey);
6400
6404
  this.#associateMaterial(id, spec);
6401
6405
  this.#associateClassification(id, spec);
6402
6406
  return ok(id);
6403
6407
  }
6404
- addFooting(spec) {
6408
+ addFooting(spec, options) {
6409
+ const keyCheck = this.#checkStableKey(options);
6410
+ if (!keyCheck.ok) return keyCheck;
6405
6411
  const geomResult = footingToSolid(spec);
6406
6412
  if (!geomResult.ok) return err(geomResult.error);
6407
- const id = this.#makeElement("FOOTING", spec, geomResult.value);
6413
+ const id = this.#makeElement("FOOTING", spec, geomResult.value, options?.stableKey);
6408
6414
  this.#associateMaterial(id, spec);
6409
6415
  this.#associateClassification(id, spec);
6410
6416
  return ok(id);
6411
6417
  }
6412
- addPile(spec) {
6418
+ addPile(spec, options) {
6419
+ const keyCheck = this.#checkStableKey(options);
6420
+ if (!keyCheck.ok) return keyCheck;
6413
6421
  const geomResult = pileToSolid(spec);
6414
6422
  if (!geomResult.ok) return err(geomResult.error);
6415
- const id = this.#makeElement("PILE", spec, geomResult.value);
6423
+ const id = this.#makeElement("PILE", spec, geomResult.value, options?.stableKey);
6416
6424
  this.#associateMaterial(id, spec);
6417
6425
  this.#associateClassification(id, spec);
6418
6426
  return ok(id);
@@ -6442,10 +6450,12 @@ var BimModel = class {
6442
6450
  this.#associateClassification(id, spec);
6443
6451
  return ok(id);
6444
6452
  }
6445
- addRailing(spec) {
6453
+ addRailing(spec, options) {
6454
+ const keyCheck = this.#checkStableKey(options);
6455
+ if (!keyCheck.ok) return keyCheck;
6446
6456
  const geomResult = railingToSolid(spec);
6447
6457
  if (!geomResult.ok) return err(geomResult.error);
6448
- const id = this.#makeElement("RAILING", spec, geomResult.value);
6458
+ const id = this.#makeElement("RAILING", spec, geomResult.value, options?.stableKey);
6449
6459
  this.#associateMaterial(id, spec);
6450
6460
  this.#associateClassification(id, spec);
6451
6461
  return ok(id);
@@ -6455,10 +6465,12 @@ var BimModel = class {
6455
6465
  * IfcRelCoversBldgElements linking the covering to its host (e.g. a slab it
6456
6466
  * finishes) is recorded for export.
6457
6467
  */
6458
- addCovering(spec, hostLocalId) {
6468
+ addCovering(spec, hostLocalId, options) {
6469
+ const keyCheck = this.#checkStableKey(options);
6470
+ if (!keyCheck.ok) return keyCheck;
6459
6471
  const geomResult = coveringToSolid(spec);
6460
6472
  if (!geomResult.ok) return err(geomResult.error);
6461
- const id = this.#makeElement("COVERING", spec, geomResult.value);
6473
+ const id = this.#makeElement("COVERING", spec, geomResult.value, options?.stableKey);
6462
6474
  this.#associateMaterial(id, spec);
6463
6475
  this.#associateClassification(id, spec);
6464
6476
  if (hostLocalId !== void 0) this.#makeRel({
@@ -6626,9 +6638,11 @@ var BimModel = class {
6626
6638
  * and disposes it on model disposal; the caller must not dispose it (see
6627
6639
  * {@link ProxySpec.solid}).
6628
6640
  */
6629
- addProxy(spec) {
6641
+ addProxy(spec, options) {
6642
+ const keyCheck = this.#checkStableKey(options);
6643
+ if (!keyCheck.ok) return keyCheck;
6630
6644
  if (spec.solid === null || spec.solid === void 0) return err(specError("PROXY_NO_GEOMETRY", "ProxySpec.solid is required"));
6631
- const id = this.#makeElement("PROXY", spec, spec.solid);
6645
+ const id = this.#makeElement("PROXY", spec, spec.solid, options?.stableKey);
6632
6646
  if (spec.materialName !== void 0) this.#makeRel({
6633
6647
  kind: "ASSOCIATES_MATERIAL",
6634
6648
  materialName: spec.materialName,
@@ -8084,7 +8098,7 @@ function writeTessellation(w, solid, geomSubContextId, _localPlacementId, tolera
8084
8098
  type: WebIFC.IFCTRIANGULATEDFACESET,
8085
8099
  Coordinates: w.ref(pointListId),
8086
8100
  Normals: null,
8087
- Closed: true,
8101
+ Closed: w.mkType(WebIFC.IFCBOOLEAN, true),
8088
8102
  CoordIndex: coordIndex.map((tri) => tri.map((idx) => w.mkType(WebIFC.IFCPOSITIVEINTEGER, idx))),
8089
8103
  PnIndex: null
8090
8104
  });
@@ -8188,7 +8202,7 @@ function writeFacetedBrepFallback(w, geomSubContextId, reason) {
8188
8202
  expressID: faceOuterBoundId,
8189
8203
  type: WebIFC.IFCFACEOUTERBOUND,
8190
8204
  Bound: w.ref(loopId),
8191
- Orientation: true
8205
+ Orientation: w.mkType(WebIFC.IFCBOOLEAN, true)
8192
8206
  });
8193
8207
  const faceId = w.nextId();
8194
8208
  w.writeLine({
@@ -44,11 +44,11 @@ export declare class BimModel {
44
44
  addSlab(spec: SlabSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
45
45
  addBeam(spec: BeamSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
46
46
  addColumn(spec: ColumnSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
47
- addSpace(spec: SpaceSpec): Result<LocalId, BimError>;
47
+ addSpace(spec: SpaceSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
48
48
  addRoof(spec: RoofSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
49
- addCurtainWall(spec: CurtainWallSpec): Result<LocalId, BimError>;
50
- addFooting(spec: FootingSpec): Result<LocalId, BimError>;
51
- addPile(spec: PileSpec): Result<LocalId, BimError>;
49
+ addCurtainWall(spec: CurtainWallSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
50
+ addFooting(spec: FootingSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
51
+ addPile(spec: PileSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
52
52
  /**
53
53
  * Adds an IfcStair assembly. Geometry for each flight is built and written by
54
54
  * the IFC layer from `spec.flights`; the STAIR element itself carries no solid
@@ -60,13 +60,13 @@ export declare class BimModel {
60
60
  * IFC layer from `spec.flights`; the RAMP element carries no solid of its own.
61
61
  */
62
62
  addRamp(spec: RampSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
63
- addRailing(spec: RailingSpec): Result<LocalId, BimError>;
63
+ addRailing(spec: RailingSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
64
64
  /**
65
65
  * Adds an IfcCovering. When `hostLocalId` is supplied, an
66
66
  * IfcRelCoversBldgElements linking the covering to its host (e.g. a slab it
67
67
  * finishes) is recorded for export.
68
68
  */
69
- addCovering(spec: CoveringSpec, hostLocalId?: LocalId): Result<LocalId, BimError>;
69
+ addCovering(spec: CoveringSpec, hostLocalId?: LocalId, options?: ElementIdentityOptions): Result<LocalId, BimError>;
70
70
  /**
71
71
  * Adds an IfcElementAssembly grouping container. The assembly has no geometry;
72
72
  * attach parts with {@link aggregate} (IfcRelAggregates) or {@link nest}
@@ -130,7 +130,7 @@ export declare class BimModel {
130
130
  * and disposes it on model disposal; the caller must not dispose it (see
131
131
  * {@link ProxySpec.solid}).
132
132
  */
133
- addProxy(spec: ProxySpec): Result<LocalId, BimError>;
133
+ addProxy(spec: ProxySpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
134
134
  addDoor(spec: DoorSpec, options?: OpeningIdentityOptions): Result<LocalId, BimError>;
135
135
  addWindow(spec: WindowSpec, options?: OpeningIdentityOptions): Result<LocalId, BimError>;
136
136
  addSlabOpening(input: SlabOpeningInput, options?: ElementIdentityOptions): Result<LocalId, BimError>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brepjs-bim",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "BIM layer for brepjs — IFC4-aligned parametric building elements",
5
5
  "keywords": [
6
6
  "bim",