@ifc-lite/create 1.17.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @ifc-lite/create
2
2
 
3
- Create valid IFC4 STEP files from scratch, programmatically. `IfcCreator` builds a complete spatial structure (project, site, building, storeys) and adds building elements with real geometry, property sets, quantities, and materials. Inputs are in metres and elements are placed relative to an identity placement unless you specify otherwise.
3
+ Create valid IFC4 STEP files from scratch, programmatically. `IfcCreator` builds a complete spatial structure (project, site, building, storeys) and adds building elements with real geometry, property sets, quantities, and materials. Inputs are in metres. Element coordinates are relative to the storey you add the element to: the storey placement carries `Elevation` and every element chains to it, so an element standing on a storey at `Elevation: 3` is created with `Z = 0`.
4
4
 
5
5
  ## Install
6
6
 
@@ -14,6 +14,27 @@
14
14
  * All values in metres unless LengthUnit is overridden.
15
15
  */
16
16
  import type { Point3D, Point2D, Placement3D, ElementAttributes, ProfileDef, GenericElementParams, AxisElementParams, WallParams, SlabParams, ColumnParams, BeamParams, StairParams, RoofParams, GableRoofParams, WallDoorParams, WallWindowParams, DoorParams, WindowParams, RampParams, RailingParams, PlateParams, MemberParams, FootingParams, PileParams, SpaceParams, CurtainWallParams, FurnishingParams, ProxyParams, ProjectParams, StoreyParams, PropertySetDef, QuantitySetDef, MaterialDef, WorkScheduleParams, WorkPlanParams, TaskParams, SequenceParams, CreateResult } from './types.js';
17
+ /**
18
+ * PLACEMENT CONTRACT
19
+ *
20
+ * Every `addIfcXxx(storeyId, …)` / `addElement(storeyId, …)` method takes the
21
+ * storey as its first argument and emits an `IfcRelContainedInSpatialStructure`
22
+ * putting the product in that storey. The product's `IfcLocalPlacement` is
23
+ * therefore chained to the STOREY's placement, never to the world: the
24
+ * placement hierarchy has to agree with the containment hierarchy, or moving a
25
+ * storey leaves its own contents behind.
26
+ *
27
+ * Consequence for callers: **coordinates passed to these methods are
28
+ * storey-relative.** `IfcBuildingStorey.Elevation` is applied exactly once, by
29
+ * the storey's own placement (`[0, 0, Elevation]`, the only placement in this
30
+ * class that is chained to the world). A wall whose floor sits on a storey at
31
+ * `Elevation: 3` is created with `Z = 0`, not `Z = 3`.
32
+ *
33
+ * Before 2.0.0 only `addIfcWall`, `addIfcSlab`, `addIfcColumn`, `addIfcBeam`,
34
+ * `addIfcStair`, `addIfcRoof` and `addIfcGableRoof` behaved this way; the other
35
+ * 21 constructors chained to the world, so a caller mixing them on a storey
36
+ * with a non-zero elevation got two different datums in one model.
37
+ */
17
38
  export declare class IfcCreator {
18
39
  private nextId;
19
40
  private lines;
@@ -61,7 +82,16 @@ export declare class IfcCreator {
61
82
  private newGlobalId;
62
83
  /** Add a building storey. Returns the storey expressId for use with element creation. */
63
84
  addIfcBuildingStorey(params: StoreyParams): number;
64
- /** Get the IfcLocalPlacement for a storey (falls back to world if unknown) */
85
+ /**
86
+ * The `IfcLocalPlacement` every product of this storey chains to.
87
+ *
88
+ * Throws on an unknown storey rather than falling back to the world
89
+ * placement: the fallback silently produced a product on a different datum
90
+ * from its siblings, which is the exact failure this parent is here to make
91
+ * impossible. `trackElement` rejects the same id a few lines later anyway,
92
+ * so failing here only means the half-built placement entities are never
93
+ * emitted.
94
+ */
65
95
  private getStoreyPlacement;
66
96
  /**
67
97
  * Create a wall from Start to End with given Thickness and Height.
@@ -1 +1 @@
1
- {"version":3,"file":"ifc-creator.d.ts","sourceRoot":"","sources":["../src/ifc-creator.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,OAAO,EAAE,OAAO,EAAE,WAAW,EAC7B,iBAAiB,EAAE,UAAU,EAC7B,oBAAoB,EAAE,iBAAiB,EACvC,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAC1F,cAAc,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAC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EAAE,OAAO,GAAG,MAAM;IAIlC;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM;IAqD1C;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,GAAG,MAAM;IAwClE;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,MAAM;IAuDnE;;;;OAIG;IACH,OAAO,CAAC,cAAc;IA8CtB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IA8BtB,OAAO,CAAC,sBAAsB;IAmB9B,OAAO,CAAC,kBAAkB;IAkB1B,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,oCAAoC;IAQ5C,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,EAAE;IAIV,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,0BAA0B;IAelC,OAAO,CAAC,YAAY;IASpB,kEAAkE;IAClE,OAAO,CAAC,mBAAmB;CAK5B"}
@@ -25,6 +25,27 @@ function optReal(v) {
25
25
  // ============================================================================
26
26
  // IfcCreator
27
27
  // ============================================================================
28
+ /**
29
+ * PLACEMENT CONTRACT
30
+ *
31
+ * Every `addIfcXxx(storeyId, …)` / `addElement(storeyId, …)` method takes the
32
+ * storey as its first argument and emits an `IfcRelContainedInSpatialStructure`
33
+ * putting the product in that storey. The product's `IfcLocalPlacement` is
34
+ * therefore chained to the STOREY's placement, never to the world: the
35
+ * placement hierarchy has to agree with the containment hierarchy, or moving a
36
+ * storey leaves its own contents behind.
37
+ *
38
+ * Consequence for callers: **coordinates passed to these methods are
39
+ * storey-relative.** `IfcBuildingStorey.Elevation` is applied exactly once, by
40
+ * the storey's own placement (`[0, 0, Elevation]`, the only placement in this
41
+ * class that is chained to the world). A wall whose floor sits on a storey at
42
+ * `Elevation: 3` is created with `Z = 0`, not `Z = 3`.
43
+ *
44
+ * Before 2.0.0 only `addIfcWall`, `addIfcSlab`, `addIfcColumn`, `addIfcBeam`,
45
+ * `addIfcStair`, `addIfcRoof` and `addIfcGableRoof` behaved this way; the other
46
+ * 21 constructors chained to the world, so a caller mixing them on a storey
47
+ * with a non-zero elevation got two different datums in one model.
48
+ */
28
49
  export class IfcCreator {
29
50
  nextId = 1;
30
51
  lines = [];
@@ -131,9 +152,22 @@ export class IfcCreator {
131
152
  this.entities.push({ expressId: id, type: 'IfcBuildingStorey', Name: name });
132
153
  return id;
133
154
  }
134
- /** Get the IfcLocalPlacement for a storey (falls back to world if unknown) */
155
+ /**
156
+ * The `IfcLocalPlacement` every product of this storey chains to.
157
+ *
158
+ * Throws on an unknown storey rather than falling back to the world
159
+ * placement: the fallback silently produced a product on a different datum
160
+ * from its siblings, which is the exact failure this parent is here to make
161
+ * impossible. `trackElement` rejects the same id a few lines later anyway,
162
+ * so failing here only means the half-built placement entities are never
163
+ * emitted.
164
+ */
135
165
  getStoreyPlacement(storeyId) {
136
- return this.storeyPlacements.get(storeyId) ?? this.worldPlacementId;
166
+ const placementId = this.storeyPlacements.get(storeyId);
167
+ if (placementId === undefined) {
168
+ throw new Error(`Unknown storeyId #${storeyId} — call addIfcBuildingStorey() first`);
169
+ }
170
+ return placementId;
137
171
  }
138
172
  // ============================================================================
139
173
  // Public API — Building Elements
@@ -499,7 +533,7 @@ export class IfcCreator {
499
533
  * Create a door element. Width × Height × Thickness panel.
500
534
  */
501
535
  addIfcDoor(storeyId, params) {
502
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
536
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
503
537
  Location: params.Position,
504
538
  });
505
539
  const thickness = params.Thickness ?? 0.05;
@@ -525,7 +559,7 @@ export class IfcCreator {
525
559
  * Create a window element. Width × Height × Thickness frame.
526
560
  */
527
561
  addIfcWindow(storeyId, params) {
528
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
562
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
529
563
  Location: params.Position,
530
564
  });
531
565
  const thickness = params.Thickness ?? 0.05;
@@ -559,7 +593,7 @@ export class IfcCreator {
559
593
  axis = [Math.sin(slopeAngle), 0, Math.cos(slopeAngle)];
560
594
  refDir = [Math.cos(slopeAngle), 0, -Math.sin(slopeAngle)];
561
595
  }
562
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
596
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
563
597
  Location: params.Position,
564
598
  Axis: axis,
565
599
  RefDirection: refDir,
@@ -590,7 +624,7 @@ export class IfcCreator {
590
624
  const railLen = Math.sqrt(dx * dx + dy * dy + dz * dz);
591
625
  const dir = vecNorm([dx, dy, dz]);
592
626
  // Use identity orientation so posts can extrude vertically along world Z
593
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
627
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
594
628
  Location: params.Start,
595
629
  });
596
630
  const railWidth = params.Width ?? 0.05;
@@ -638,7 +672,7 @@ export class IfcCreator {
638
672
  * Create a plate (thin flat element, e.g. steel plate).
639
673
  */
640
674
  addIfcPlate(storeyId, params) {
641
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
675
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
642
676
  Location: params.Position,
643
677
  });
644
678
  let profileId;
@@ -672,7 +706,7 @@ export class IfcCreator {
672
706
  const dz = params.End[2] - params.Start[2];
673
707
  const memberLen = Math.sqrt(dx * dx + dy * dy + dz * dz);
674
708
  const dir = vecNorm([dx, dy, dz]);
675
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
709
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
676
710
  Location: params.Start,
677
711
  Axis: dir,
678
712
  RefDirection: this.computeRefDirection(dir),
@@ -698,7 +732,7 @@ export class IfcCreator {
698
732
  */
699
733
  addIfcFooting(storeyId, params) {
700
734
  // Offset placement downward so extrusion starts at bottom
701
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
735
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
702
736
  Location: [params.Position[0], params.Position[1], params.Position[2] - params.Height],
703
737
  });
704
738
  const profileId = this.addRectangleProfile(params.Width, params.Depth);
@@ -723,7 +757,7 @@ export class IfcCreator {
723
757
  * Uses circular cross-section by default, rectangular if IsRectangular is set.
724
758
  */
725
759
  addIfcPile(storeyId, params) {
726
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
760
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
727
761
  Location: [params.Position[0], params.Position[1], params.Position[2] - params.Length],
728
762
  });
729
763
  let profileId;
@@ -753,7 +787,7 @@ export class IfcCreator {
753
787
  * Create a space (room volume).
754
788
  */
755
789
  addIfcSpace(storeyId, params) {
756
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
790
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
757
791
  Location: params.Position,
758
792
  });
759
793
  let profileId;
@@ -789,7 +823,7 @@ export class IfcCreator {
789
823
  const wallLen = Math.sqrt(dx * dx + dy * dy + dz * dz);
790
824
  const dir = vecNorm([dx, dy, dz]);
791
825
  const thickness = params.Thickness ?? 0.05;
792
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
826
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
793
827
  Location: params.Start,
794
828
  RefDirection: dir,
795
829
  });
@@ -814,7 +848,7 @@ export class IfcCreator {
814
848
  */
815
849
  addIfcFurnishingElement(storeyId, params) {
816
850
  const direction = params.Direction ?? 0;
817
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
851
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
818
852
  Location: params.Position,
819
853
  RefDirection: direction !== 0 ? [Math.cos(direction), Math.sin(direction), 0] : undefined,
820
854
  });
@@ -838,7 +872,7 @@ export class IfcCreator {
838
872
  * Create a proxy element (generic element for custom/unclassified objects).
839
873
  */
840
874
  addIfcBuildingElementProxy(storeyId, params) {
841
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
875
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
842
876
  Location: params.Position,
843
877
  });
844
878
  let profileId;
@@ -871,7 +905,7 @@ export class IfcCreator {
871
905
  * Create a column with circular cross-section.
872
906
  */
873
907
  addIfcCircularColumn(storeyId, params) {
874
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
908
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
875
909
  Location: params.Position,
876
910
  });
877
911
  const profileId = this.addCircleProfile(params.Radius);
@@ -899,7 +933,7 @@ export class IfcCreator {
899
933
  const dz = params.End[2] - params.Start[2];
900
934
  const beamLen = Math.sqrt(dx * dx + dy * dy + dz * dz);
901
935
  const dir = vecNorm([dx, dy, dz]);
902
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
936
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
903
937
  Location: params.Start,
904
938
  Axis: dir,
905
939
  RefDirection: this.computeRefDirection(dir),
@@ -929,7 +963,7 @@ export class IfcCreator {
929
963
  const dz = params.End[2] - params.Start[2];
930
964
  const memberLen = Math.sqrt(dx * dx + dy * dy + dz * dz);
931
965
  const dir = vecNorm([dx, dy, dz]);
932
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
966
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
933
967
  Location: params.Start,
934
968
  Axis: dir,
935
969
  RefDirection: this.computeRefDirection(dir),
@@ -959,7 +993,7 @@ export class IfcCreator {
959
993
  const dz = params.End[2] - params.Start[2];
960
994
  const memberLen = Math.sqrt(dx * dx + dy * dy + dz * dz);
961
995
  const dir = vecNorm([dx, dy, dz]);
962
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
996
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
963
997
  Location: params.Start,
964
998
  Axis: dir,
965
999
  RefDirection: this.computeRefDirection(dir),
@@ -989,7 +1023,7 @@ export class IfcCreator {
989
1023
  const dz = params.End[2] - params.Start[2];
990
1024
  const memberLen = Math.sqrt(dx * dx + dy * dy + dz * dz);
991
1025
  const dir = vecNorm([dx, dy, dz]);
992
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
1026
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
993
1027
  Location: params.Start,
994
1028
  Axis: dir,
995
1029
  RefDirection: this.computeRefDirection(dir),
@@ -1014,7 +1048,7 @@ export class IfcCreator {
1014
1048
  * Create a column or pile with hollow circular cross-section.
1015
1049
  */
1016
1050
  addIfcHollowCircularColumn(storeyId, params) {
1017
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
1051
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
1018
1052
  Location: params.Position,
1019
1053
  });
1020
1054
  const profileId = this.addCircleHollowProfile(params.Radius, params.WallThickness);
@@ -1042,7 +1076,7 @@ export class IfcCreator {
1042
1076
  const dz = params.End[2] - params.Start[2];
1043
1077
  const beamLen = Math.sqrt(dx * dx + dy * dy + dz * dz);
1044
1078
  const dir = vecNorm([dx, dy, dz]);
1045
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
1079
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
1046
1080
  Location: params.Start,
1047
1081
  Axis: dir,
1048
1082
  RefDirection: this.computeRefDirection(dir),
@@ -1841,7 +1875,7 @@ ENDSEC;
1841
1875
  * ```
1842
1876
  */
1843
1877
  addElement(storeyId, params) {
1844
- const placementId = this.addLocalPlacement(this.worldPlacementId, params.Placement);
1878
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), params.Placement);
1845
1879
  const profileId = this.createProfile(params.Profile);
1846
1880
  // Handle custom extrusion direction
1847
1881
  let extrusionDirId;
@@ -1911,7 +1945,7 @@ ENDSEC;
1911
1945
  perp = vecCross(dir, [1, 0, 0]);
1912
1946
  }
1913
1947
  perp = vecNorm(perp);
1914
- const placementId = this.addLocalPlacement(this.worldPlacementId, {
1948
+ const placementId = this.addLocalPlacement(this.getStoreyPlacement(storeyId), {
1915
1949
  Location: params.Start,
1916
1950
  Axis: dir, // local Z = along axis (extrusion direction)
1917
1951
  RefDirection: perp, // local X = perpendicular to axis