brepjs-bim 0.15.1 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7616,10 +7616,11 @@ function writeOwnerHistory(w, meta) {
7616
7616
  const appId = writeApplication(w, meta);
7617
7617
  const addressRefs = writePersonAddresses(w, meta.author.email);
7618
7618
  const personId = w.nextId();
7619
+ const hasName = meta.author.familyName !== void 0 || meta.author.givenName !== void 0;
7619
7620
  w.writeLine({
7620
7621
  expressID: personId,
7621
7622
  type: web_ifc.IFCPERSON,
7622
- Identification: null,
7623
+ Identification: hasName ? null : w.mkType(web_ifc.IFCIDENTIFIER, "unknown"),
7623
7624
  FamilyName: optionalLabel(w, meta.author.familyName),
7624
7625
  GivenName: optionalLabel(w, meta.author.givenName),
7625
7626
  MiddleNames: null,
@@ -7645,7 +7646,7 @@ function writeOwnerHistory(w, meta) {
7645
7646
  State: null,
7646
7647
  ChangeAction: {
7647
7648
  type: 3,
7648
- value: "ADDED"
7649
+ value: "NOTDEFINED"
7649
7650
  },
7650
7651
  LastModifiedDate: null,
7651
7652
  LastModifyingUser: null,
@@ -8015,7 +8016,7 @@ function writeWallEntity(w, guid, name, ownerHistoryId, localPlacementId, produc
8015
8016
  });
8016
8017
  return id;
8017
8018
  }
8018
- function writeSlabEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
8019
+ function writeSlabEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
8019
8020
  const id = w.nextId();
8020
8021
  w.writeLine({
8021
8022
  expressID: id,
@@ -8028,14 +8029,11 @@ function writeSlabEntity(w, guid, name, predefinedType, ownerHistoryId, localPla
8028
8029
  ObjectPlacement: w.ref(localPlacementId),
8029
8030
  Representation: w.ref(productDefinitionShapeId),
8030
8031
  Tag: null,
8031
- PredefinedType: {
8032
- type: 3,
8033
- value: predefinedType
8034
- }
8032
+ PredefinedType: null
8035
8033
  });
8036
8034
  return id;
8037
8035
  }
8038
- function writeBeamEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
8036
+ function writeBeamEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
8039
8037
  const id = w.nextId();
8040
8038
  w.writeLine({
8041
8039
  expressID: id,
@@ -8048,14 +8046,11 @@ function writeBeamEntity(w, guid, name, predefinedType, ownerHistoryId, localPla
8048
8046
  ObjectPlacement: w.ref(localPlacementId),
8049
8047
  Representation: w.ref(productDefinitionShapeId),
8050
8048
  Tag: null,
8051
- PredefinedType: {
8052
- type: 3,
8053
- value: predefinedType
8054
- }
8049
+ PredefinedType: null
8055
8050
  });
8056
8051
  return id;
8057
8052
  }
8058
- function writeColumnEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
8053
+ function writeColumnEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
8059
8054
  const id = w.nextId();
8060
8055
  w.writeLine({
8061
8056
  expressID: id,
@@ -8068,10 +8063,7 @@ function writeColumnEntity(w, guid, name, predefinedType, ownerHistoryId, localP
8068
8063
  ObjectPlacement: w.ref(localPlacementId),
8069
8064
  Representation: w.ref(productDefinitionShapeId),
8070
8065
  Tag: null,
8071
- PredefinedType: {
8072
- type: 3,
8073
- value: predefinedType
8074
- }
8066
+ PredefinedType: null
8075
8067
  });
8076
8068
  return id;
8077
8069
  }
@@ -8993,7 +8985,7 @@ function writeSpaceGeometry(w, spec, geomSubContextId, parentPlacementId) {
8993
8985
  productDefinitionShapeId
8994
8986
  };
8995
8987
  }
8996
- function writeSpaceEntity(w, guid, name, longName, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
8988
+ function writeSpaceEntity(w, guid, name, longName, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
8997
8989
  const id = w.nextId();
8998
8990
  w.writeLine({
8999
8991
  expressID: id,
@@ -9010,10 +9002,7 @@ function writeSpaceEntity(w, guid, name, longName, predefinedType, ownerHistoryI
9010
9002
  type: 3,
9011
9003
  value: "ELEMENT"
9012
9004
  },
9013
- PredefinedType: {
9014
- type: 3,
9015
- value: predefinedType
9016
- },
9005
+ PredefinedType: null,
9017
9006
  ElevationWithFlooring: null
9018
9007
  });
9019
9008
  return id;
@@ -9046,7 +9035,7 @@ function writeRelSpaceBoundary(w, guid, ownerHistoryId, spaceExpressId, elementE
9046
9035
  * are the IfcLocalPlacement and IfcProductDefinitionShape express IDs produced by
9047
9036
  * the geometry layer; pass `null` for either when not available.
9048
9037
  */
9049
- function writeRoofEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9038
+ function writeRoofEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9050
9039
  const id = w.nextId();
9051
9040
  w.writeLine({
9052
9041
  expressID: id,
@@ -9059,10 +9048,7 @@ function writeRoofEntity(w, guid, name, predefinedType, ownerHistoryId, localPla
9059
9048
  ObjectPlacement: localPlacementId === null ? null : w.ref(localPlacementId),
9060
9049
  Representation: productDefinitionShapeId === null ? null : w.ref(productDefinitionShapeId),
9061
9050
  Tag: null,
9062
- PredefinedType: {
9063
- type: 3,
9064
- value: predefinedType
9065
- }
9051
+ PredefinedType: null
9066
9052
  });
9067
9053
  return id;
9068
9054
  }
@@ -9078,7 +9064,7 @@ function writeRoofType(w, ownerHistoryId, typeGuid, relGuid, predefinedType, occ
9078
9064
  type: web_ifc.IFCROOFTYPE,
9079
9065
  GlobalId: w.mkType(web_ifc.IFCGLOBALLYUNIQUEID, typeGuid),
9080
9066
  OwnerHistory: w.ref(ownerHistoryId),
9081
- Name: null,
9067
+ Name: w.mkType(web_ifc.IFCLABEL, "Roof Type"),
9082
9068
  Description: null,
9083
9069
  ApplicableOccurrence: null,
9084
9070
  HasPropertySets: null,
@@ -9244,7 +9230,7 @@ function writeCurtainWall(w, spec, grid, stableKey, name, ownerHistoryId, geomSu
9244
9230
  PlacementRelTo: parentPlacementId !== null ? w.ref(parentPlacementId) : null,
9245
9231
  RelativePlacement: w.ref(placement3DId)
9246
9232
  });
9247
- const predefinedType = spec.predefinedType ?? "CURTAIN_WALL";
9233
+ const predefinedType = spec.predefinedType ?? "NOTDEFINED";
9248
9234
  const curtainWallId = w.nextId();
9249
9235
  w.writeLine({
9250
9236
  expressID: curtainWallId,
@@ -9407,7 +9393,7 @@ function finishRepresentation(w, extrusionId, geomSubContextId, localPlacementId
9407
9393
  productDefinitionShapeId
9408
9394
  };
9409
9395
  }
9410
- function writeFootingEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9396
+ function writeFootingEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9411
9397
  const id = w.nextId();
9412
9398
  w.writeLine({
9413
9399
  expressID: id,
@@ -9420,14 +9406,11 @@ function writeFootingEntity(w, guid, name, predefinedType, ownerHistoryId, local
9420
9406
  ObjectPlacement: w.ref(localPlacementId),
9421
9407
  Representation: w.ref(productDefinitionShapeId),
9422
9408
  Tag: null,
9423
- PredefinedType: {
9424
- type: 3,
9425
- value: predefinedType
9426
- }
9409
+ PredefinedType: null
9427
9410
  });
9428
9411
  return id;
9429
9412
  }
9430
- function writePileEntity(w, guid, name, predefinedType, constructionType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9413
+ function writePileEntity(w, guid, name, _predefinedType, constructionType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9431
9414
  const id = w.nextId();
9432
9415
  w.writeLine({
9433
9416
  expressID: id,
@@ -9440,10 +9423,7 @@ function writePileEntity(w, guid, name, predefinedType, constructionType, ownerH
9440
9423
  ObjectPlacement: w.ref(localPlacementId),
9441
9424
  Representation: w.ref(productDefinitionShapeId),
9442
9425
  Tag: null,
9443
- PredefinedType: {
9444
- type: 3,
9445
- value: predefinedType
9446
- },
9426
+ PredefinedType: null,
9447
9427
  ConstructionType: constructionType !== null ? {
9448
9428
  type: 3,
9449
9429
  value: constructionType
@@ -9549,14 +9529,14 @@ function writeLocalPlacement(w, origin, axisZ, axisX, parentPlacementId) {
9549
9529
  });
9550
9530
  return localPlacementId;
9551
9531
  }
9552
- function writeAssemblyType(w, typeConstant, typeGuid, relGuid, predefinedType, ownerHistoryId, occurrenceExpressIds) {
9532
+ function writeAssemblyType(w, typeConstant, typeName, typeGuid, relGuid, predefinedType, ownerHistoryId, occurrenceExpressIds) {
9553
9533
  const typeId = w.nextId();
9554
9534
  w.writeLine({
9555
9535
  expressID: typeId,
9556
9536
  type: typeConstant,
9557
9537
  GlobalId: w.mkType(web_ifc.IFCGLOBALLYUNIQUEID, typeGuid),
9558
9538
  OwnerHistory: w.ref(ownerHistoryId),
9559
- Name: null,
9539
+ Name: w.mkType(web_ifc.IFCLABEL, typeName),
9560
9540
  Description: null,
9561
9541
  ApplicableOccurrence: null,
9562
9542
  HasPropertySets: null,
@@ -9596,14 +9576,11 @@ function writeStairFlightEntity(w, guid, name, flight, ownerHistoryId, localPlac
9596
9576
  NumberOfTreads: w.mkType(web_ifc.IFCINTEGER, flight.numberOfRisers - 1),
9597
9577
  RiserHeight: w.mkType(web_ifc.IFCPOSITIVELENGTHMEASURE, toIfcLengthM(flight.riserHeight)),
9598
9578
  TreadLength: w.mkType(web_ifc.IFCPOSITIVELENGTHMEASURE, toIfcLengthM(flight.treadLength)),
9599
- PredefinedType: {
9600
- type: 3,
9601
- value: "STRAIGHT"
9602
- }
9579
+ PredefinedType: null
9603
9580
  });
9604
9581
  return id;
9605
9582
  }
9606
- function writeStairEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId) {
9583
+ function writeStairEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId) {
9607
9584
  const id = w.nextId();
9608
9585
  w.writeLine({
9609
9586
  expressID: id,
@@ -9616,14 +9593,11 @@ function writeStairEntity(w, guid, name, predefinedType, ownerHistoryId, localPl
9616
9593
  ObjectPlacement: w.ref(localPlacementId),
9617
9594
  Representation: null,
9618
9595
  Tag: null,
9619
- PredefinedType: {
9620
- type: 3,
9621
- value: predefinedType
9622
- }
9596
+ PredefinedType: null
9623
9597
  });
9624
9598
  return id;
9625
9599
  }
9626
- function writeRampFlightEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9600
+ function writeRampFlightEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9627
9601
  const id = w.nextId();
9628
9602
  w.writeLine({
9629
9603
  expressID: id,
@@ -9636,14 +9610,11 @@ function writeRampFlightEntity(w, guid, name, predefinedType, ownerHistoryId, lo
9636
9610
  ObjectPlacement: w.ref(localPlacementId),
9637
9611
  Representation: w.ref(productDefinitionShapeId),
9638
9612
  Tag: null,
9639
- PredefinedType: {
9640
- type: 3,
9641
- value: predefinedType
9642
- }
9613
+ PredefinedType: null
9643
9614
  });
9644
9615
  return id;
9645
9616
  }
9646
- function writeRampEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId) {
9617
+ function writeRampEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId) {
9647
9618
  const id = w.nextId();
9648
9619
  w.writeLine({
9649
9620
  expressID: id,
@@ -9656,10 +9627,7 @@ function writeRampEntity(w, guid, name, predefinedType, ownerHistoryId, localPla
9656
9627
  ObjectPlacement: w.ref(localPlacementId),
9657
9628
  Representation: null,
9658
9629
  Tag: null,
9659
- PredefinedType: {
9660
- type: 3,
9661
- value: predefinedType
9662
- }
9630
+ PredefinedType: null
9663
9631
  });
9664
9632
  return id;
9665
9633
  }
@@ -9718,8 +9686,8 @@ function writeStairAssembly(w, spec, stairKey, assemblyGuid, ownerHistoryId, geo
9718
9686
  _usingCtx$2.d();
9719
9687
  }
9720
9688
  writeRelAggregates(w, deriveIfcGuidSync(`rel:AGGREGATES:STAIR:${stairKey}`), ownerHistoryId, assemblyExpressId, flightExpressIds);
9721
- writeAssemblyType(w, web_ifc.IFCSTAIRTYPE, deriveIfcGuidSync(`type:STAIR:${stairKey}`), deriveIfcGuidSync(`rel-type:STAIR:${stairKey}`), predefinedType, ownerHistoryId, [assemblyExpressId]);
9722
- if (flightExpressIds.length > 0) writeAssemblyType(w, web_ifc.IFCSTAIRFLIGHTTYPE, deriveIfcGuidSync(`type:STAIR_FLIGHT:${stairKey}`), deriveIfcGuidSync(`rel-type:STAIR_FLIGHT:${stairKey}`), "STRAIGHT", ownerHistoryId, flightExpressIds);
9689
+ writeAssemblyType(w, web_ifc.IFCSTAIRTYPE, "Stair Type", deriveIfcGuidSync(`type:STAIR:${stairKey}`), deriveIfcGuidSync(`rel-type:STAIR:${stairKey}`), predefinedType, ownerHistoryId, [assemblyExpressId]);
9690
+ if (flightExpressIds.length > 0) writeAssemblyType(w, web_ifc.IFCSTAIRFLIGHTTYPE, "Stair Flight Type", deriveIfcGuidSync(`type:STAIR_FLIGHT:${stairKey}`), deriveIfcGuidSync(`rel-type:STAIR_FLIGHT:${stairKey}`), "STRAIGHT", ownerHistoryId, flightExpressIds);
9723
9691
  return {
9724
9692
  ok: true,
9725
9693
  value: {
@@ -9779,8 +9747,8 @@ function writeRampAssembly(w, spec, rampKey, assemblyGuid, ownerHistoryId, geomS
9779
9747
  _usingCtx3.d();
9780
9748
  }
9781
9749
  writeRelAggregates(w, deriveIfcGuidSync(`rel:AGGREGATES:RAMP:${rampKey}`), ownerHistoryId, assemblyExpressId, flightExpressIds);
9782
- writeAssemblyType(w, web_ifc.IFCRAMPTYPE, deriveIfcGuidSync(`type:RAMP:${rampKey}`), deriveIfcGuidSync(`rel-type:RAMP:${rampKey}`), predefinedType, ownerHistoryId, [assemblyExpressId]);
9783
- if (flightExpressIds.length > 0) writeAssemblyType(w, web_ifc.IFCRAMPFLIGHTTYPE, deriveIfcGuidSync(`type:RAMP_FLIGHT:${rampKey}`), deriveIfcGuidSync(`rel-type:RAMP_FLIGHT:${rampKey}`), "STRAIGHT", ownerHistoryId, flightExpressIds);
9750
+ writeAssemblyType(w, web_ifc.IFCRAMPTYPE, "Ramp Type", deriveIfcGuidSync(`type:RAMP:${rampKey}`), deriveIfcGuidSync(`rel-type:RAMP:${rampKey}`), predefinedType, ownerHistoryId, [assemblyExpressId]);
9751
+ if (flightExpressIds.length > 0) writeAssemblyType(w, web_ifc.IFCRAMPFLIGHTTYPE, "Ramp Flight Type", deriveIfcGuidSync(`type:RAMP_FLIGHT:${rampKey}`), deriveIfcGuidSync(`rel-type:RAMP_FLIGHT:${rampKey}`), "STRAIGHT", ownerHistoryId, flightExpressIds);
9784
9752
  return {
9785
9753
  ok: true,
9786
9754
  value: {
@@ -9890,7 +9858,7 @@ function writeRailingGeometry(w, spec, solid, geomSubContextId, parentPlacementI
9890
9858
  usedFallback: false
9891
9859
  };
9892
9860
  }
9893
- function writeRailingEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9861
+ function writeRailingEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9894
9862
  const id = w.nextId();
9895
9863
  w.writeLine({
9896
9864
  expressID: id,
@@ -9903,10 +9871,7 @@ function writeRailingEntity(w, guid, name, predefinedType, ownerHistoryId, local
9903
9871
  ObjectPlacement: w.ref(localPlacementId),
9904
9872
  Representation: w.ref(productDefinitionShapeId),
9905
9873
  Tag: null,
9906
- PredefinedType: {
9907
- type: 3,
9908
- value: predefinedType
9909
- }
9874
+ PredefinedType: null
9910
9875
  });
9911
9876
  return id;
9912
9877
  }
@@ -9992,7 +9957,7 @@ function writeCoveringGeometry(w, spec, geomSubContextId, parentPlacementId) {
9992
9957
  bodyItemId: extrusionId
9993
9958
  };
9994
9959
  }
9995
- function writeCoveringEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9960
+ function writeCoveringEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9996
9961
  const id = w.nextId();
9997
9962
  w.writeLine({
9998
9963
  expressID: id,
@@ -10005,10 +9970,7 @@ function writeCoveringEntity(w, guid, name, predefinedType, ownerHistoryId, loca
10005
9970
  ObjectPlacement: w.ref(localPlacementId),
10006
9971
  Representation: w.ref(productDefinitionShapeId),
10007
9972
  Tag: null,
10008
- PredefinedType: {
10009
- type: 3,
10010
- value: predefinedType
10011
- }
9973
+ PredefinedType: null
10012
9974
  });
10013
9975
  return id;
10014
9976
  }
@@ -10954,7 +10916,7 @@ function writeElementQuantity(w, ownerHistoryId, qtoName, quantityIds) {
10954
10916
  OwnerHistory: w.ref(ownerHistoryId),
10955
10917
  Name: w.mkType(web_ifc.IFCLABEL, qtoName),
10956
10918
  Description: null,
10957
- MethodOfMeasurement: null,
10919
+ MethodOfMeasurement: w.mkType(web_ifc.IFCLABEL, "BaseQuantities"),
10958
10920
  Quantities: quantityIds.map((id) => w.ref(id))
10959
10921
  });
10960
10922
  return qtoId;
@@ -11634,11 +11596,11 @@ var TYPE_CONSTANT = {
11634
11596
  IFCRAILINGTYPE: web_ifc.IFCRAILINGTYPE,
11635
11597
  IFCCOVERINGTYPE: web_ifc.IFCCOVERINGTYPE
11636
11598
  };
11637
- function commonTypeFields(w, guid, ownerHistoryId) {
11599
+ function commonTypeFields(w, guid, ownerHistoryId, name) {
11638
11600
  return {
11639
11601
  GlobalId: w.mkType(web_ifc.IFCGLOBALLYUNIQUEID, guid),
11640
11602
  OwnerHistory: w.ref(ownerHistoryId),
11641
- Name: null,
11603
+ Name: w.mkType(web_ifc.IFCLABEL, name),
11642
11604
  Description: null,
11643
11605
  ApplicableOccurrence: null,
11644
11606
  HasPropertySets: null,
@@ -11648,7 +11610,7 @@ function commonTypeFields(w, guid, ownerHistoryId) {
11648
11610
  }
11649
11611
  function writeTypeObject(w, typeName, guid, ownerHistoryId, predefinedType) {
11650
11612
  const id = w.nextId();
11651
- const base = commonTypeFields(w, guid, ownerHistoryId);
11613
+ const base = commonTypeFields(w, guid, ownerHistoryId, `${typeName.slice(3, -4).replace("CURTAINWALL", "CURTAIN WALL").toLowerCase().replace(/(^|\s)\S/g, (c) => c.toUpperCase())} Type`);
11652
11614
  if (typeName === "IFCDOORTYPE") {
11653
11615
  w.writeLine({
11654
11616
  expressID: id,
@@ -13983,10 +13945,11 @@ async function fromIfc(bytes, options = {}) {
13983
13945
  const scale = readLengthScale(reader);
13984
13946
  const spatialRoot = buildSpatialTree(reader, scale);
13985
13947
  const containment = buildElementContainmentMap(reader);
13948
+ const typeEnums = buildTypePredefinedMap(reader);
13986
13949
  const elements = [];
13987
13950
  const byExpressId = /* @__PURE__ */ new Map();
13988
13951
  for (const [type, category] of ELEMENT_TYPES) for (const expressId of reader.getLinesOfType(type)) {
13989
- const element = readElement(reader, expressId, category, scale, containment, options.skipGeometry ?? false, diagnostics);
13952
+ const element = readElement(reader, expressId, category, scale, containment, typeEnums, options.skipGeometry ?? false, diagnostics);
13990
13953
  if (element === null) continue;
13991
13954
  elements.push(element);
13992
13955
  byExpressId.set(element.expressId, element);
@@ -14013,7 +13976,7 @@ async function fromIfc(bytes, options = {}) {
14013
13976
  * element line itself is unreadable (an `error` diagnostic is recorded). Any
14014
13977
  * sub-read failure is isolated by its own reader and never aborts the element.
14015
13978
  */
14016
- function readElement(reader, expressId, category, scale, containment, skipGeometry, diagnostics) {
13979
+ function readElement(reader, expressId, category, scale, containment, typeEnums, skipGeometry, diagnostics) {
14017
13980
  try {
14018
13981
  const line = reader.getLine(expressId);
14019
13982
  if (line === null) {
@@ -14022,7 +13985,7 @@ function readElement(reader, expressId, category, scale, containment, skipGeomet
14022
13985
  }
14023
13986
  const guid = readGuid(line);
14024
13987
  const name = readName(reader, line);
14025
- const predefinedType = readPredefinedType(line);
13988
+ const predefinedType = readPredefinedType(line) ?? typeEnums.get(expressId);
14026
13989
  const voidedBy = readVoids(reader, expressId).map((v) => v.openingExpressId);
14027
13990
  const fills = findFills(reader, expressId);
14028
13991
  const geometry = skipGeometry ? {
@@ -14141,6 +14104,27 @@ function readName(reader, line) {
14141
14104
  const raw = line["Name"]?.value;
14142
14105
  return typeof raw === "string" ? reader.decodeText(raw) : "";
14143
14106
  }
14107
+ /** occurrence expressId -> the relating type object's PredefinedType literal. */
14108
+ function buildTypePredefinedMap(reader) {
14109
+ const map = /* @__PURE__ */ new Map();
14110
+ for (const relId of reader.getLinesOfType(web_ifc.IFCRELDEFINESBYTYPE)) {
14111
+ const rel = reader.getLine(relId);
14112
+ if (rel === null) continue;
14113
+ const typeId = refValue(rel["RelatingType"]);
14114
+ if (typeId === void 0) continue;
14115
+ const typeLine = reader.getLine(typeId);
14116
+ if (typeLine === null) continue;
14117
+ const pred = readPredefinedType(typeLine);
14118
+ if (pred === void 0) continue;
14119
+ const related = rel["RelatedObjects"];
14120
+ if (!Array.isArray(related)) continue;
14121
+ for (const ref of related) {
14122
+ const id = refValue(ref);
14123
+ if (id !== void 0) map.set(id, pred);
14124
+ }
14125
+ }
14126
+ return map;
14127
+ }
14144
14128
  function readPredefinedType(line) {
14145
14129
  const raw = line["PredefinedType"]?.value;
14146
14130
  return typeof raw === "string" ? raw : void 0;
@@ -14545,11 +14529,7 @@ var CurtainWallSpecSchema = object({
14545
14529
  axisX: unitVec$5,
14546
14530
  axisZ: unitVec$5,
14547
14531
  materialName: string().min(1),
14548
- predefinedType: _enum([
14549
- "CURTAIN_WALL",
14550
- "NOTDEFINED",
14551
- "USERDEFINED"
14552
- ]).optional(),
14532
+ predefinedType: _enum(["NOTDEFINED", "USERDEFINED"]).optional(),
14553
14533
  panelMaterialName: string().min(1).optional(),
14554
14534
  mullionMaterialName: string().min(1).optional(),
14555
14535
  isExternal: boolean().optional(),
@@ -16776,6 +16756,8 @@ function familiesToBim(root, options) {
16776
16756
  return buildingResult;
16777
16757
  }
16778
16758
  const buildingId = buildingResult.value;
16759
+ const project = model.getProject();
16760
+ if (project !== null) model.aggregate(project.localId, siteResult.value);
16779
16761
  model.aggregate(siteResult.value, buildingId);
16780
16762
  const idByKeyPath = /* @__PURE__ */ new Map();
16781
16763
  const walk = (el, storeyId) => {
@@ -7593,10 +7593,11 @@ function writeOwnerHistory(w, meta) {
7593
7593
  const appId = writeApplication(w, meta);
7594
7594
  const addressRefs = writePersonAddresses(w, meta.author.email);
7595
7595
  const personId = w.nextId();
7596
+ const hasName = meta.author.familyName !== void 0 || meta.author.givenName !== void 0;
7596
7597
  w.writeLine({
7597
7598
  expressID: personId,
7598
7599
  type: WebIFC.IFCPERSON,
7599
- Identification: null,
7600
+ Identification: hasName ? null : w.mkType(WebIFC.IFCIDENTIFIER, "unknown"),
7600
7601
  FamilyName: optionalLabel(w, meta.author.familyName),
7601
7602
  GivenName: optionalLabel(w, meta.author.givenName),
7602
7603
  MiddleNames: null,
@@ -7622,7 +7623,7 @@ function writeOwnerHistory(w, meta) {
7622
7623
  State: null,
7623
7624
  ChangeAction: {
7624
7625
  type: 3,
7625
- value: "ADDED"
7626
+ value: "NOTDEFINED"
7626
7627
  },
7627
7628
  LastModifiedDate: null,
7628
7629
  LastModifyingUser: null,
@@ -7992,7 +7993,7 @@ function writeWallEntity(w, guid, name, ownerHistoryId, localPlacementId, produc
7992
7993
  });
7993
7994
  return id;
7994
7995
  }
7995
- function writeSlabEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
7996
+ function writeSlabEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
7996
7997
  const id = w.nextId();
7997
7998
  w.writeLine({
7998
7999
  expressID: id,
@@ -8005,14 +8006,11 @@ function writeSlabEntity(w, guid, name, predefinedType, ownerHistoryId, localPla
8005
8006
  ObjectPlacement: w.ref(localPlacementId),
8006
8007
  Representation: w.ref(productDefinitionShapeId),
8007
8008
  Tag: null,
8008
- PredefinedType: {
8009
- type: 3,
8010
- value: predefinedType
8011
- }
8009
+ PredefinedType: null
8012
8010
  });
8013
8011
  return id;
8014
8012
  }
8015
- function writeBeamEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
8013
+ function writeBeamEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
8016
8014
  const id = w.nextId();
8017
8015
  w.writeLine({
8018
8016
  expressID: id,
@@ -8025,14 +8023,11 @@ function writeBeamEntity(w, guid, name, predefinedType, ownerHistoryId, localPla
8025
8023
  ObjectPlacement: w.ref(localPlacementId),
8026
8024
  Representation: w.ref(productDefinitionShapeId),
8027
8025
  Tag: null,
8028
- PredefinedType: {
8029
- type: 3,
8030
- value: predefinedType
8031
- }
8026
+ PredefinedType: null
8032
8027
  });
8033
8028
  return id;
8034
8029
  }
8035
- function writeColumnEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
8030
+ function writeColumnEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
8036
8031
  const id = w.nextId();
8037
8032
  w.writeLine({
8038
8033
  expressID: id,
@@ -8045,10 +8040,7 @@ function writeColumnEntity(w, guid, name, predefinedType, ownerHistoryId, localP
8045
8040
  ObjectPlacement: w.ref(localPlacementId),
8046
8041
  Representation: w.ref(productDefinitionShapeId),
8047
8042
  Tag: null,
8048
- PredefinedType: {
8049
- type: 3,
8050
- value: predefinedType
8051
- }
8043
+ PredefinedType: null
8052
8044
  });
8053
8045
  return id;
8054
8046
  }
@@ -8970,7 +8962,7 @@ function writeSpaceGeometry(w, spec, geomSubContextId, parentPlacementId) {
8970
8962
  productDefinitionShapeId
8971
8963
  };
8972
8964
  }
8973
- function writeSpaceEntity(w, guid, name, longName, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
8965
+ function writeSpaceEntity(w, guid, name, longName, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
8974
8966
  const id = w.nextId();
8975
8967
  w.writeLine({
8976
8968
  expressID: id,
@@ -8987,10 +8979,7 @@ function writeSpaceEntity(w, guid, name, longName, predefinedType, ownerHistoryI
8987
8979
  type: 3,
8988
8980
  value: "ELEMENT"
8989
8981
  },
8990
- PredefinedType: {
8991
- type: 3,
8992
- value: predefinedType
8993
- },
8982
+ PredefinedType: null,
8994
8983
  ElevationWithFlooring: null
8995
8984
  });
8996
8985
  return id;
@@ -9023,7 +9012,7 @@ function writeRelSpaceBoundary(w, guid, ownerHistoryId, spaceExpressId, elementE
9023
9012
  * are the IfcLocalPlacement and IfcProductDefinitionShape express IDs produced by
9024
9013
  * the geometry layer; pass `null` for either when not available.
9025
9014
  */
9026
- function writeRoofEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9015
+ function writeRoofEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9027
9016
  const id = w.nextId();
9028
9017
  w.writeLine({
9029
9018
  expressID: id,
@@ -9036,10 +9025,7 @@ function writeRoofEntity(w, guid, name, predefinedType, ownerHistoryId, localPla
9036
9025
  ObjectPlacement: localPlacementId === null ? null : w.ref(localPlacementId),
9037
9026
  Representation: productDefinitionShapeId === null ? null : w.ref(productDefinitionShapeId),
9038
9027
  Tag: null,
9039
- PredefinedType: {
9040
- type: 3,
9041
- value: predefinedType
9042
- }
9028
+ PredefinedType: null
9043
9029
  });
9044
9030
  return id;
9045
9031
  }
@@ -9055,7 +9041,7 @@ function writeRoofType(w, ownerHistoryId, typeGuid, relGuid, predefinedType, occ
9055
9041
  type: WebIFC.IFCROOFTYPE,
9056
9042
  GlobalId: w.mkType(WebIFC.IFCGLOBALLYUNIQUEID, typeGuid),
9057
9043
  OwnerHistory: w.ref(ownerHistoryId),
9058
- Name: null,
9044
+ Name: w.mkType(WebIFC.IFCLABEL, "Roof Type"),
9059
9045
  Description: null,
9060
9046
  ApplicableOccurrence: null,
9061
9047
  HasPropertySets: null,
@@ -9221,7 +9207,7 @@ function writeCurtainWall(w, spec, grid, stableKey, name, ownerHistoryId, geomSu
9221
9207
  PlacementRelTo: parentPlacementId !== null ? w.ref(parentPlacementId) : null,
9222
9208
  RelativePlacement: w.ref(placement3DId)
9223
9209
  });
9224
- const predefinedType = spec.predefinedType ?? "CURTAIN_WALL";
9210
+ const predefinedType = spec.predefinedType ?? "NOTDEFINED";
9225
9211
  const curtainWallId = w.nextId();
9226
9212
  w.writeLine({
9227
9213
  expressID: curtainWallId,
@@ -9384,7 +9370,7 @@ function finishRepresentation(w, extrusionId, geomSubContextId, localPlacementId
9384
9370
  productDefinitionShapeId
9385
9371
  };
9386
9372
  }
9387
- function writeFootingEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9373
+ function writeFootingEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9388
9374
  const id = w.nextId();
9389
9375
  w.writeLine({
9390
9376
  expressID: id,
@@ -9397,14 +9383,11 @@ function writeFootingEntity(w, guid, name, predefinedType, ownerHistoryId, local
9397
9383
  ObjectPlacement: w.ref(localPlacementId),
9398
9384
  Representation: w.ref(productDefinitionShapeId),
9399
9385
  Tag: null,
9400
- PredefinedType: {
9401
- type: 3,
9402
- value: predefinedType
9403
- }
9386
+ PredefinedType: null
9404
9387
  });
9405
9388
  return id;
9406
9389
  }
9407
- function writePileEntity(w, guid, name, predefinedType, constructionType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9390
+ function writePileEntity(w, guid, name, _predefinedType, constructionType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9408
9391
  const id = w.nextId();
9409
9392
  w.writeLine({
9410
9393
  expressID: id,
@@ -9417,10 +9400,7 @@ function writePileEntity(w, guid, name, predefinedType, constructionType, ownerH
9417
9400
  ObjectPlacement: w.ref(localPlacementId),
9418
9401
  Representation: w.ref(productDefinitionShapeId),
9419
9402
  Tag: null,
9420
- PredefinedType: {
9421
- type: 3,
9422
- value: predefinedType
9423
- },
9403
+ PredefinedType: null,
9424
9404
  ConstructionType: constructionType !== null ? {
9425
9405
  type: 3,
9426
9406
  value: constructionType
@@ -9526,14 +9506,14 @@ function writeLocalPlacement(w, origin, axisZ, axisX, parentPlacementId) {
9526
9506
  });
9527
9507
  return localPlacementId;
9528
9508
  }
9529
- function writeAssemblyType(w, typeConstant, typeGuid, relGuid, predefinedType, ownerHistoryId, occurrenceExpressIds) {
9509
+ function writeAssemblyType(w, typeConstant, typeName, typeGuid, relGuid, predefinedType, ownerHistoryId, occurrenceExpressIds) {
9530
9510
  const typeId = w.nextId();
9531
9511
  w.writeLine({
9532
9512
  expressID: typeId,
9533
9513
  type: typeConstant,
9534
9514
  GlobalId: w.mkType(WebIFC.IFCGLOBALLYUNIQUEID, typeGuid),
9535
9515
  OwnerHistory: w.ref(ownerHistoryId),
9536
- Name: null,
9516
+ Name: w.mkType(WebIFC.IFCLABEL, typeName),
9537
9517
  Description: null,
9538
9518
  ApplicableOccurrence: null,
9539
9519
  HasPropertySets: null,
@@ -9573,14 +9553,11 @@ function writeStairFlightEntity(w, guid, name, flight, ownerHistoryId, localPlac
9573
9553
  NumberOfTreads: w.mkType(WebIFC.IFCINTEGER, flight.numberOfRisers - 1),
9574
9554
  RiserHeight: w.mkType(WebIFC.IFCPOSITIVELENGTHMEASURE, toIfcLengthM(flight.riserHeight)),
9575
9555
  TreadLength: w.mkType(WebIFC.IFCPOSITIVELENGTHMEASURE, toIfcLengthM(flight.treadLength)),
9576
- PredefinedType: {
9577
- type: 3,
9578
- value: "STRAIGHT"
9579
- }
9556
+ PredefinedType: null
9580
9557
  });
9581
9558
  return id;
9582
9559
  }
9583
- function writeStairEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId) {
9560
+ function writeStairEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId) {
9584
9561
  const id = w.nextId();
9585
9562
  w.writeLine({
9586
9563
  expressID: id,
@@ -9593,14 +9570,11 @@ function writeStairEntity(w, guid, name, predefinedType, ownerHistoryId, localPl
9593
9570
  ObjectPlacement: w.ref(localPlacementId),
9594
9571
  Representation: null,
9595
9572
  Tag: null,
9596
- PredefinedType: {
9597
- type: 3,
9598
- value: predefinedType
9599
- }
9573
+ PredefinedType: null
9600
9574
  });
9601
9575
  return id;
9602
9576
  }
9603
- function writeRampFlightEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9577
+ function writeRampFlightEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9604
9578
  const id = w.nextId();
9605
9579
  w.writeLine({
9606
9580
  expressID: id,
@@ -9613,14 +9587,11 @@ function writeRampFlightEntity(w, guid, name, predefinedType, ownerHistoryId, lo
9613
9587
  ObjectPlacement: w.ref(localPlacementId),
9614
9588
  Representation: w.ref(productDefinitionShapeId),
9615
9589
  Tag: null,
9616
- PredefinedType: {
9617
- type: 3,
9618
- value: predefinedType
9619
- }
9590
+ PredefinedType: null
9620
9591
  });
9621
9592
  return id;
9622
9593
  }
9623
- function writeRampEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId) {
9594
+ function writeRampEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId) {
9624
9595
  const id = w.nextId();
9625
9596
  w.writeLine({
9626
9597
  expressID: id,
@@ -9633,10 +9604,7 @@ function writeRampEntity(w, guid, name, predefinedType, ownerHistoryId, localPla
9633
9604
  ObjectPlacement: w.ref(localPlacementId),
9634
9605
  Representation: null,
9635
9606
  Tag: null,
9636
- PredefinedType: {
9637
- type: 3,
9638
- value: predefinedType
9639
- }
9607
+ PredefinedType: null
9640
9608
  });
9641
9609
  return id;
9642
9610
  }
@@ -9695,8 +9663,8 @@ function writeStairAssembly(w, spec, stairKey, assemblyGuid, ownerHistoryId, geo
9695
9663
  _usingCtx$2.d();
9696
9664
  }
9697
9665
  writeRelAggregates(w, deriveIfcGuidSync(`rel:AGGREGATES:STAIR:${stairKey}`), ownerHistoryId, assemblyExpressId, flightExpressIds);
9698
- writeAssemblyType(w, WebIFC.IFCSTAIRTYPE, deriveIfcGuidSync(`type:STAIR:${stairKey}`), deriveIfcGuidSync(`rel-type:STAIR:${stairKey}`), predefinedType, ownerHistoryId, [assemblyExpressId]);
9699
- if (flightExpressIds.length > 0) writeAssemblyType(w, WebIFC.IFCSTAIRFLIGHTTYPE, deriveIfcGuidSync(`type:STAIR_FLIGHT:${stairKey}`), deriveIfcGuidSync(`rel-type:STAIR_FLIGHT:${stairKey}`), "STRAIGHT", ownerHistoryId, flightExpressIds);
9666
+ writeAssemblyType(w, WebIFC.IFCSTAIRTYPE, "Stair Type", deriveIfcGuidSync(`type:STAIR:${stairKey}`), deriveIfcGuidSync(`rel-type:STAIR:${stairKey}`), predefinedType, ownerHistoryId, [assemblyExpressId]);
9667
+ if (flightExpressIds.length > 0) writeAssemblyType(w, WebIFC.IFCSTAIRFLIGHTTYPE, "Stair Flight Type", deriveIfcGuidSync(`type:STAIR_FLIGHT:${stairKey}`), deriveIfcGuidSync(`rel-type:STAIR_FLIGHT:${stairKey}`), "STRAIGHT", ownerHistoryId, flightExpressIds);
9700
9668
  return {
9701
9669
  ok: true,
9702
9670
  value: {
@@ -9756,8 +9724,8 @@ function writeRampAssembly(w, spec, rampKey, assemblyGuid, ownerHistoryId, geomS
9756
9724
  _usingCtx3.d();
9757
9725
  }
9758
9726
  writeRelAggregates(w, deriveIfcGuidSync(`rel:AGGREGATES:RAMP:${rampKey}`), ownerHistoryId, assemblyExpressId, flightExpressIds);
9759
- writeAssemblyType(w, WebIFC.IFCRAMPTYPE, deriveIfcGuidSync(`type:RAMP:${rampKey}`), deriveIfcGuidSync(`rel-type:RAMP:${rampKey}`), predefinedType, ownerHistoryId, [assemblyExpressId]);
9760
- if (flightExpressIds.length > 0) writeAssemblyType(w, WebIFC.IFCRAMPFLIGHTTYPE, deriveIfcGuidSync(`type:RAMP_FLIGHT:${rampKey}`), deriveIfcGuidSync(`rel-type:RAMP_FLIGHT:${rampKey}`), "STRAIGHT", ownerHistoryId, flightExpressIds);
9727
+ writeAssemblyType(w, WebIFC.IFCRAMPTYPE, "Ramp Type", deriveIfcGuidSync(`type:RAMP:${rampKey}`), deriveIfcGuidSync(`rel-type:RAMP:${rampKey}`), predefinedType, ownerHistoryId, [assemblyExpressId]);
9728
+ if (flightExpressIds.length > 0) writeAssemblyType(w, WebIFC.IFCRAMPFLIGHTTYPE, "Ramp Flight Type", deriveIfcGuidSync(`type:RAMP_FLIGHT:${rampKey}`), deriveIfcGuidSync(`rel-type:RAMP_FLIGHT:${rampKey}`), "STRAIGHT", ownerHistoryId, flightExpressIds);
9761
9729
  return {
9762
9730
  ok: true,
9763
9731
  value: {
@@ -9867,7 +9835,7 @@ function writeRailingGeometry(w, spec, solid, geomSubContextId, parentPlacementI
9867
9835
  usedFallback: false
9868
9836
  };
9869
9837
  }
9870
- function writeRailingEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9838
+ function writeRailingEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9871
9839
  const id = w.nextId();
9872
9840
  w.writeLine({
9873
9841
  expressID: id,
@@ -9880,10 +9848,7 @@ function writeRailingEntity(w, guid, name, predefinedType, ownerHistoryId, local
9880
9848
  ObjectPlacement: w.ref(localPlacementId),
9881
9849
  Representation: w.ref(productDefinitionShapeId),
9882
9850
  Tag: null,
9883
- PredefinedType: {
9884
- type: 3,
9885
- value: predefinedType
9886
- }
9851
+ PredefinedType: null
9887
9852
  });
9888
9853
  return id;
9889
9854
  }
@@ -9969,7 +9934,7 @@ function writeCoveringGeometry(w, spec, geomSubContextId, parentPlacementId) {
9969
9934
  bodyItemId: extrusionId
9970
9935
  };
9971
9936
  }
9972
- function writeCoveringEntity(w, guid, name, predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9937
+ function writeCoveringEntity(w, guid, name, _predefinedType, ownerHistoryId, localPlacementId, productDefinitionShapeId) {
9973
9938
  const id = w.nextId();
9974
9939
  w.writeLine({
9975
9940
  expressID: id,
@@ -9982,10 +9947,7 @@ function writeCoveringEntity(w, guid, name, predefinedType, ownerHistoryId, loca
9982
9947
  ObjectPlacement: w.ref(localPlacementId),
9983
9948
  Representation: w.ref(productDefinitionShapeId),
9984
9949
  Tag: null,
9985
- PredefinedType: {
9986
- type: 3,
9987
- value: predefinedType
9988
- }
9950
+ PredefinedType: null
9989
9951
  });
9990
9952
  return id;
9991
9953
  }
@@ -10931,7 +10893,7 @@ function writeElementQuantity(w, ownerHistoryId, qtoName, quantityIds) {
10931
10893
  OwnerHistory: w.ref(ownerHistoryId),
10932
10894
  Name: w.mkType(WebIFC.IFCLABEL, qtoName),
10933
10895
  Description: null,
10934
- MethodOfMeasurement: null,
10896
+ MethodOfMeasurement: w.mkType(WebIFC.IFCLABEL, "BaseQuantities"),
10935
10897
  Quantities: quantityIds.map((id) => w.ref(id))
10936
10898
  });
10937
10899
  return qtoId;
@@ -11611,11 +11573,11 @@ var TYPE_CONSTANT = {
11611
11573
  IFCRAILINGTYPE: WebIFC.IFCRAILINGTYPE,
11612
11574
  IFCCOVERINGTYPE: WebIFC.IFCCOVERINGTYPE
11613
11575
  };
11614
- function commonTypeFields(w, guid, ownerHistoryId) {
11576
+ function commonTypeFields(w, guid, ownerHistoryId, name) {
11615
11577
  return {
11616
11578
  GlobalId: w.mkType(WebIFC.IFCGLOBALLYUNIQUEID, guid),
11617
11579
  OwnerHistory: w.ref(ownerHistoryId),
11618
- Name: null,
11580
+ Name: w.mkType(WebIFC.IFCLABEL, name),
11619
11581
  Description: null,
11620
11582
  ApplicableOccurrence: null,
11621
11583
  HasPropertySets: null,
@@ -11625,7 +11587,7 @@ function commonTypeFields(w, guid, ownerHistoryId) {
11625
11587
  }
11626
11588
  function writeTypeObject(w, typeName, guid, ownerHistoryId, predefinedType) {
11627
11589
  const id = w.nextId();
11628
- const base = commonTypeFields(w, guid, ownerHistoryId);
11590
+ const base = commonTypeFields(w, guid, ownerHistoryId, `${typeName.slice(3, -4).replace("CURTAINWALL", "CURTAIN WALL").toLowerCase().replace(/(^|\s)\S/g, (c) => c.toUpperCase())} Type`);
11629
11591
  if (typeName === "IFCDOORTYPE") {
11630
11592
  w.writeLine({
11631
11593
  expressID: id,
@@ -13960,10 +13922,11 @@ async function fromIfc(bytes, options = {}) {
13960
13922
  const scale = readLengthScale(reader);
13961
13923
  const spatialRoot = buildSpatialTree(reader, scale);
13962
13924
  const containment = buildElementContainmentMap(reader);
13925
+ const typeEnums = buildTypePredefinedMap(reader);
13963
13926
  const elements = [];
13964
13927
  const byExpressId = /* @__PURE__ */ new Map();
13965
13928
  for (const [type, category] of ELEMENT_TYPES) for (const expressId of reader.getLinesOfType(type)) {
13966
- const element = readElement(reader, expressId, category, scale, containment, options.skipGeometry ?? false, diagnostics);
13929
+ const element = readElement(reader, expressId, category, scale, containment, typeEnums, options.skipGeometry ?? false, diagnostics);
13967
13930
  if (element === null) continue;
13968
13931
  elements.push(element);
13969
13932
  byExpressId.set(element.expressId, element);
@@ -13990,7 +13953,7 @@ async function fromIfc(bytes, options = {}) {
13990
13953
  * element line itself is unreadable (an `error` diagnostic is recorded). Any
13991
13954
  * sub-read failure is isolated by its own reader and never aborts the element.
13992
13955
  */
13993
- function readElement(reader, expressId, category, scale, containment, skipGeometry, diagnostics) {
13956
+ function readElement(reader, expressId, category, scale, containment, typeEnums, skipGeometry, diagnostics) {
13994
13957
  try {
13995
13958
  const line = reader.getLine(expressId);
13996
13959
  if (line === null) {
@@ -13999,7 +13962,7 @@ function readElement(reader, expressId, category, scale, containment, skipGeomet
13999
13962
  }
14000
13963
  const guid = readGuid(line);
14001
13964
  const name = readName(reader, line);
14002
- const predefinedType = readPredefinedType(line);
13965
+ const predefinedType = readPredefinedType(line) ?? typeEnums.get(expressId);
14003
13966
  const voidedBy = readVoids(reader, expressId).map((v) => v.openingExpressId);
14004
13967
  const fills = findFills(reader, expressId);
14005
13968
  const geometry = skipGeometry ? {
@@ -14118,6 +14081,27 @@ function readName(reader, line) {
14118
14081
  const raw = line["Name"]?.value;
14119
14082
  return typeof raw === "string" ? reader.decodeText(raw) : "";
14120
14083
  }
14084
+ /** occurrence expressId -> the relating type object's PredefinedType literal. */
14085
+ function buildTypePredefinedMap(reader) {
14086
+ const map = /* @__PURE__ */ new Map();
14087
+ for (const relId of reader.getLinesOfType(WebIFC.IFCRELDEFINESBYTYPE)) {
14088
+ const rel = reader.getLine(relId);
14089
+ if (rel === null) continue;
14090
+ const typeId = refValue(rel["RelatingType"]);
14091
+ if (typeId === void 0) continue;
14092
+ const typeLine = reader.getLine(typeId);
14093
+ if (typeLine === null) continue;
14094
+ const pred = readPredefinedType(typeLine);
14095
+ if (pred === void 0) continue;
14096
+ const related = rel["RelatedObjects"];
14097
+ if (!Array.isArray(related)) continue;
14098
+ for (const ref of related) {
14099
+ const id = refValue(ref);
14100
+ if (id !== void 0) map.set(id, pred);
14101
+ }
14102
+ }
14103
+ return map;
14104
+ }
14121
14105
  function readPredefinedType(line) {
14122
14106
  const raw = line["PredefinedType"]?.value;
14123
14107
  return typeof raw === "string" ? raw : void 0;
@@ -14522,11 +14506,7 @@ var CurtainWallSpecSchema = object({
14522
14506
  axisX: unitVec$5,
14523
14507
  axisZ: unitVec$5,
14524
14508
  materialName: string().min(1),
14525
- predefinedType: _enum([
14526
- "CURTAIN_WALL",
14527
- "NOTDEFINED",
14528
- "USERDEFINED"
14529
- ]).optional(),
14509
+ predefinedType: _enum(["NOTDEFINED", "USERDEFINED"]).optional(),
14530
14510
  panelMaterialName: string().min(1).optional(),
14531
14511
  mullionMaterialName: string().min(1).optional(),
14532
14512
  isExternal: boolean().optional(),
@@ -16753,6 +16733,8 @@ function familiesToBim(root, options) {
16753
16733
  return buildingResult;
16754
16734
  }
16755
16735
  const buildingId = buildingResult.value;
16736
+ const project = model.getProject();
16737
+ if (project !== null) model.aggregate(project.localId, siteResult.value);
16756
16738
  model.aggregate(siteResult.value, buildingId);
16757
16739
  const idByKeyPath = /* @__PURE__ */ new Map();
16758
16740
  const walk = (el, storeyId) => {
@@ -8,5 +8,5 @@ export interface CoveringRepresentationIds {
8
8
  bodyItemId: number;
9
9
  }
10
10
  export declare function writeCoveringGeometry(w: IfcWriter, spec: CoveringSpec, geomSubContextId: number, parentPlacementId: number | null): CoveringRepresentationIds;
11
- export declare function writeCoveringEntity(w: IfcWriter, guid: IfcGuid, name: string, predefinedType: CoveringPredefinedType, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
11
+ export declare function writeCoveringEntity(w: IfcWriter, guid: IfcGuid, name: string, _predefinedType: CoveringPredefinedType, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
12
12
  export declare function writeRelCoversBldgElements(w: IfcWriter, guid: IfcGuid, ownerHistoryId: number, relatingBuildingElementId: number, relatedCoveringIds: readonly number[]): number;
@@ -14,8 +14,8 @@ export declare function writeStorey(w: IfcWriter, guid: IfcGuid, name: string, e
14
14
  placementId: number;
15
15
  };
16
16
  export declare function writeWallEntity(w: IfcWriter, guid: IfcGuid, name: string, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
17
- export declare function writeSlabEntity(w: IfcWriter, guid: IfcGuid, name: string, predefinedType: 'FLOOR' | 'ROOF' | 'LANDING' | 'BASESLAB', ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
17
+ export declare function writeSlabEntity(w: IfcWriter, guid: IfcGuid, name: string, _predefinedType: 'FLOOR' | 'ROOF' | 'LANDING' | 'BASESLAB', ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
18
18
  export type BeamPredefinedTypeIfc = 'BEAM' | 'JOIST' | 'LINTEL' | 'HOLLOWCORE' | 'PURLIN' | 'RAFTER' | 'SPANDREL' | 'T_BEAM' | 'NOTDEFINED';
19
- export declare function writeBeamEntity(w: IfcWriter, guid: IfcGuid, name: string, predefinedType: BeamPredefinedTypeIfc, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
19
+ export declare function writeBeamEntity(w: IfcWriter, guid: IfcGuid, name: string, _predefinedType: BeamPredefinedTypeIfc, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
20
20
  export type ColumnPredefinedTypeIfc = 'COLUMN' | 'PILASTER' | 'NOTDEFINED';
21
- export declare function writeColumnEntity(w: IfcWriter, guid: IfcGuid, name: string, predefinedType: ColumnPredefinedTypeIfc, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
21
+ export declare function writeColumnEntity(w: IfcWriter, guid: IfcGuid, name: string, _predefinedType: ColumnPredefinedTypeIfc, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
@@ -7,5 +7,5 @@ export interface FoundationRepresentationIds {
7
7
  }
8
8
  export declare function writeFootingGeometry(w: IfcWriter, spec: FootingSpec, geomSubContextId: number, parentPlacementId: number | null): FoundationRepresentationIds;
9
9
  export declare function writePileGeometry(w: IfcWriter, spec: PileSpec, geomSubContextId: number, parentPlacementId: number | null): FoundationRepresentationIds;
10
- export declare function writeFootingEntity(w: IfcWriter, guid: IfcGuid, name: string, predefinedType: FootingPredefinedType, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
11
- export declare function writePileEntity(w: IfcWriter, guid: IfcGuid, name: string, predefinedType: PilePredefinedType, constructionType: PileConstructionType | null, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
10
+ export declare function writeFootingEntity(w: IfcWriter, guid: IfcGuid, name: string, _predefinedType: FootingPredefinedType, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
11
+ export declare function writePileEntity(w: IfcWriter, guid: IfcGuid, name: string, _predefinedType: PilePredefinedType, constructionType: PileConstructionType | null, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
@@ -14,4 +14,4 @@ export interface RailingRepresentationIds {
14
14
  usedFallback: boolean;
15
15
  }
16
16
  export declare function writeRailingGeometry(w: IfcWriter, spec: RailingSpec, solid: ValidSolid, geomSubContextId: number, parentPlacementId: number | null): RailingRepresentationIds;
17
- export declare function writeRailingEntity(w: IfcWriter, guid: IfcGuid, name: string, predefinedType: RailingPredefinedType, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
17
+ export declare function writeRailingEntity(w: IfcWriter, guid: IfcGuid, name: string, _predefinedType: RailingPredefinedType, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
@@ -8,7 +8,7 @@ export type RoofTypeEnum = RoofPredefinedType;
8
8
  * are the IfcLocalPlacement and IfcProductDefinitionShape express IDs produced by
9
9
  * the geometry layer; pass `null` for either when not available.
10
10
  */
11
- export declare function writeRoofEntity(w: IfcWriter, guid: IfcGuid, name: string, predefinedType: RoofTypeEnum, ownerHistoryId: number, localPlacementId: number | null, productDefinitionShapeId: number | null): number;
11
+ export declare function writeRoofEntity(w: IfcWriter, guid: IfcGuid, name: string, _predefinedType: RoofTypeEnum, ownerHistoryId: number, localPlacementId: number | null, productDefinitionShapeId: number | null): number;
12
12
  export interface RoofTypeWriteResult {
13
13
  typeExpressId: number;
14
14
  relExpressId: number;
@@ -6,6 +6,6 @@ export interface SpaceRepresentationIds {
6
6
  productDefinitionShapeId: number;
7
7
  }
8
8
  export declare function writeSpaceGeometry(w: IfcWriter, spec: SpaceSpec, geomSubContextId: number, parentPlacementId: number | null): SpaceRepresentationIds;
9
- export declare function writeSpaceEntity(w: IfcWriter, guid: IfcGuid, name: string, longName: string | null, predefinedType: SpacePredefinedType, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
9
+ export declare function writeSpaceEntity(w: IfcWriter, guid: IfcGuid, name: string, longName: string | null, _predefinedType: SpacePredefinedType, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
10
10
  export type SpaceBoundaryConnectionType = 'PHYSICAL' | 'VIRTUAL' | 'NOTDEFINED';
11
11
  export declare function writeRelSpaceBoundary(w: IfcWriter, guid: IfcGuid, ownerHistoryId: number, spaceExpressId: number, elementExpressId: number, connectionType: SpaceBoundaryConnectionType): void;
package/dist/index.d.ts CHANGED
@@ -34,7 +34,7 @@ export { checkReferentialIntegrity } from './validation/referentialIntegrity.js'
34
34
  export { checkSchema } from './validation/schemaCheck.js';
35
35
  export { checkRoundTrip } from './validation/roundTrip.js';
36
36
  export { checkGeometryValidity } from './validation/geometryValidity.js';
37
- export { issue, emptyReport, hasErrors, countBySeverity, } from './validation/severity.js';
37
+ export { issue, emptyReport, hasErrors, countBySeverity } from './validation/severity.js';
38
38
  export { writeIfcType } from './ifc-writer/typeWriter.js';
39
39
  export { writeZoneEntity, writeSystemEntity, writeRelAssignsToGroup, } from './ifc-writer/groupWriter.js';
40
40
  export { IFC_SCHEMAS, DEFAULT_IFC_SCHEMA, fileSchemaString, isIfcSchema, schemaSupports, } from './ifc-writer/schemaVersion.js';
@@ -57,7 +57,7 @@ export type { RoofSpec, RoofPredefinedType } from './specs/roofSpec.js';
57
57
  export type { CurtainWallSpec, CurtainWallPredefinedType } from './specs/curtainWallSpec.js';
58
58
  export type { CurtainWallGrid, CurtainWallComponent } from './elementFns/curtainWallFns.js';
59
59
  export type { FootingSpec, PileSpec, FootingPredefinedType, PilePredefinedType, PileConstructionType, } from './specs/foundationSpec.js';
60
- export type { StairSpec, StairFlightSpec, StairPredefinedType, } from './specs/stairSpec.js';
60
+ export type { StairSpec, StairFlightSpec, StairPredefinedType } from './specs/stairSpec.js';
61
61
  export type { RampSpec, RampFlightSpec, RampPredefinedType, RampFlightPredefinedType, } from './specs/rampSpec.js';
62
62
  export type { RailingSpec, RailingPredefinedType } from './specs/railingSpec.js';
63
63
  export type { CoveringSpec, CoveringPredefinedType } from './specs/coveringSpec.js';
@@ -69,7 +69,7 @@ export type { PathConnectionTypeIfc } from './ifc-writer/connectivityWriter.js';
69
69
  export type { DoorSpec, WindowSpec, SlabOpeningInput } from './specs/openingSpec.js';
70
70
  export type { ProxySpec } from './specs/proxySpec.js';
71
71
  export type { ProjectSpec, SiteSpec, BuildingSpec, StoreySpec } from './specs/spatialSpec.js';
72
- export type { BimCategory, BimElement, AnyBimElement, OpeningSpec, WallOpeningSpec, SlabOpeningSpec } from './types/bimTypes.js';
72
+ export type { BimCategory, BimElement, AnyBimElement, OpeningSpec, WallOpeningSpec, SlabOpeningSpec, } from './types/bimTypes.js';
73
73
  export { isWallOpening, isSlabOpening } from './types/bimTypes.js';
74
74
  export type { BimRelationship, AssociatesMaterialRel, AssociatesClassificationRel, VoidsWallRel, VoidsSlabRel, FillsOpeningRel, SpaceBoundaryRel, NestsRel, ConnectsElementsRel, ConnectsPathElementsRel, CoversElementRel, AssignsToGroupRel, } from './types/relationships.js';
75
75
  export type { MaterialLayer } from './types/materialTypes.js';
@@ -1,7 +1,7 @@
1
1
  import { BimError } from '../errors/bimError.js';
2
2
  import { Result } from 'brepjs';
3
3
  import { ClassificationRef } from '../types/classificationTypes.js';
4
- export type CurtainWallPredefinedType = 'CURTAIN_WALL' | 'NOTDEFINED' | 'USERDEFINED';
4
+ export type CurtainWallPredefinedType = 'NOTDEFINED' | 'USERDEFINED';
5
5
  /**
6
6
  * A planar curtain wall, modelled as a rectangular grid of glazing panels
7
7
  * (IfcPlate) framed by mullions (IfcMember). The wall spans `width` (along the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brepjs-bim",
3
- "version": "0.15.1",
3
+ "version": "0.15.2",
4
4
  "description": "BIM layer for brepjs — IFC4-aligned parametric building elements",
5
5
  "keywords": [
6
6
  "bim",