@ifc-lite/create 3.1.0 → 4.0.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.
Files changed (208) hide show
  1. package/README.md +9 -0
  2. package/dist/ifc-creator-math.d.ts +5 -7
  3. package/dist/ifc-creator-math.d.ts.map +1 -1
  4. package/dist/ifc-creator-math.js +8 -15
  5. package/dist/ifc-creator-math.js.map +1 -1
  6. package/dist/in-store/anchor.d.ts +25 -0
  7. package/dist/in-store/anchor.d.ts.map +1 -1
  8. package/dist/in-store/auto-space-detect.d.ts +1 -1
  9. package/dist/in-store/auto-space-detect.js +1 -1
  10. package/dist/in-store/beam.d.ts +10 -1
  11. package/dist/in-store/beam.d.ts.map +1 -1
  12. package/dist/in-store/beam.js +14 -25
  13. package/dist/in-store/beam.js.map +1 -1
  14. package/dist/in-store/column.d.ts +18 -1
  15. package/dist/in-store/column.d.ts.map +1 -1
  16. package/dist/in-store/column.js +37 -29
  17. package/dist/in-store/column.js.map +1 -1
  18. package/dist/in-store/copy-frame.d.ts +52 -0
  19. package/dist/in-store/copy-frame.d.ts.map +1 -0
  20. package/dist/in-store/copy-frame.js +99 -0
  21. package/dist/in-store/copy-frame.js.map +1 -0
  22. package/dist/in-store/copy-product.d.ts +96 -0
  23. package/dist/in-store/copy-product.d.ts.map +1 -0
  24. package/dist/in-store/copy-product.js +318 -0
  25. package/dist/in-store/copy-product.js.map +1 -0
  26. package/dist/in-store/curtain-wall.d.ts +87 -0
  27. package/dist/in-store/curtain-wall.d.ts.map +1 -0
  28. package/dist/in-store/curtain-wall.js +237 -0
  29. package/dist/in-store/curtain-wall.js.map +1 -0
  30. package/dist/in-store/door.d.ts +10 -4
  31. package/dist/in-store/door.d.ts.map +1 -1
  32. package/dist/in-store/door.js +23 -17
  33. package/dist/in-store/door.js.map +1 -1
  34. package/dist/in-store/element-type.d.ts +40 -0
  35. package/dist/in-store/element-type.d.ts.map +1 -0
  36. package/dist/in-store/element-type.js +60 -0
  37. package/dist/in-store/element-type.js.map +1 -0
  38. package/dist/in-store/extract-grids.d.ts +46 -0
  39. package/dist/in-store/extract-grids.d.ts.map +1 -0
  40. package/dist/in-store/extract-grids.js +211 -0
  41. package/dist/in-store/extract-grids.js.map +1 -0
  42. package/dist/in-store/extract-walls.d.ts +12 -23
  43. package/dist/in-store/extract-walls.d.ts.map +1 -1
  44. package/dist/in-store/extract-walls.js +14 -83
  45. package/dist/in-store/extract-walls.js.map +1 -1
  46. package/dist/in-store/generate-spaces.d.ts +1 -1
  47. package/dist/in-store/grid.d.ts +118 -0
  48. package/dist/in-store/grid.d.ts.map +1 -0
  49. package/dist/in-store/grid.js +194 -0
  50. package/dist/in-store/grid.js.map +1 -0
  51. package/dist/in-store/host-geometry-frame.d.ts +44 -0
  52. package/dist/in-store/host-geometry-frame.d.ts.map +1 -0
  53. package/dist/in-store/host-geometry-frame.js +146 -0
  54. package/dist/in-store/host-geometry-frame.js.map +1 -0
  55. package/dist/in-store/hosted-element-edit.d.ts +29 -0
  56. package/dist/in-store/hosted-element-edit.d.ts.map +1 -0
  57. package/dist/in-store/hosted-element-edit.js +120 -0
  58. package/dist/in-store/hosted-element-edit.js.map +1 -0
  59. package/dist/in-store/hosted-element.d.ts +41 -0
  60. package/dist/in-store/hosted-element.d.ts.map +1 -0
  61. package/dist/in-store/hosted-element.js +124 -0
  62. package/dist/in-store/hosted-element.js.map +1 -0
  63. package/dist/in-store/hosted-fill-read.d.ts +56 -0
  64. package/dist/in-store/hosted-fill-read.d.ts.map +1 -0
  65. package/dist/in-store/hosted-fill-read.js +197 -0
  66. package/dist/in-store/hosted-fill-read.js.map +1 -0
  67. package/dist/in-store/hosted-fill.d.ts +48 -0
  68. package/dist/in-store/hosted-fill.d.ts.map +1 -0
  69. package/dist/in-store/hosted-fill.js +58 -0
  70. package/dist/in-store/hosted-fill.js.map +1 -0
  71. package/dist/in-store/hosted-global-id.d.ts +8 -0
  72. package/dist/in-store/hosted-global-id.d.ts.map +1 -0
  73. package/dist/in-store/hosted-global-id.js +53 -0
  74. package/dist/in-store/hosted-global-id.js.map +1 -0
  75. package/dist/in-store/hosted-placement-edit.d.ts +30 -0
  76. package/dist/in-store/hosted-placement-edit.d.ts.map +1 -0
  77. package/dist/in-store/hosted-placement-edit.js +123 -0
  78. package/dist/in-store/hosted-placement-edit.js.map +1 -0
  79. package/dist/in-store/hosted-scale-chain.d.ts +12 -0
  80. package/dist/in-store/hosted-scale-chain.d.ts.map +1 -0
  81. package/dist/in-store/hosted-scale-chain.js +74 -0
  82. package/dist/in-store/hosted-scale-chain.js.map +1 -0
  83. package/dist/in-store/hosted-shape-edit.d.ts +9 -0
  84. package/dist/in-store/hosted-shape-edit.d.ts.map +1 -0
  85. package/dist/in-store/hosted-shape-edit.js +79 -0
  86. package/dist/in-store/hosted-shape-edit.js.map +1 -0
  87. package/dist/in-store/index.d.ts +59 -0
  88. package/dist/in-store/index.d.ts.map +1 -0
  89. package/dist/in-store/index.js +64 -0
  90. package/dist/in-store/index.js.map +1 -0
  91. package/dist/in-store/material.d.ts +62 -0
  92. package/dist/in-store/material.d.ts.map +1 -0
  93. package/dist/in-store/material.js +107 -0
  94. package/dist/in-store/material.js.map +1 -0
  95. package/dist/in-store/member.d.ts +8 -2
  96. package/dist/in-store/member.d.ts.map +1 -1
  97. package/dist/in-store/member.js +12 -14
  98. package/dist/in-store/member.js.map +1 -1
  99. package/dist/in-store/opening.d.ts +45 -0
  100. package/dist/in-store/opening.d.ts.map +1 -0
  101. package/dist/in-store/opening.js +104 -0
  102. package/dist/in-store/opening.js.map +1 -0
  103. package/dist/in-store/placement-frame.d.ts +9 -4
  104. package/dist/in-store/placement-frame.d.ts.map +1 -1
  105. package/dist/in-store/placement-frame.js +39 -39
  106. package/dist/in-store/placement-frame.js.map +1 -1
  107. package/dist/in-store/profile.d.ts +141 -0
  108. package/dist/in-store/profile.d.ts.map +1 -0
  109. package/dist/in-store/profile.js +174 -0
  110. package/dist/in-store/profile.js.map +1 -0
  111. package/dist/in-store/railing.d.ts +65 -0
  112. package/dist/in-store/railing.d.ts.map +1 -0
  113. package/dist/in-store/railing.js +112 -0
  114. package/dist/in-store/railing.js.map +1 -0
  115. package/dist/in-store/rel-connects-path.d.ts +43 -0
  116. package/dist/in-store/rel-connects-path.d.ts.map +1 -0
  117. package/dist/in-store/rel-connects-path.js +65 -0
  118. package/dist/in-store/rel-connects-path.js.map +1 -0
  119. package/dist/in-store/relate.d.ts +32 -0
  120. package/dist/in-store/relate.d.ts.map +1 -0
  121. package/dist/in-store/relate.js +39 -0
  122. package/dist/in-store/relate.js.map +1 -0
  123. package/dist/in-store/resolve-anchor.d.ts +21 -1
  124. package/dist/in-store/resolve-anchor.d.ts.map +1 -1
  125. package/dist/in-store/resolve-anchor.js +6 -2
  126. package/dist/in-store/resolve-anchor.js.map +1 -1
  127. package/dist/in-store/resolve-host.d.ts +16 -0
  128. package/dist/in-store/resolve-host.d.ts.map +1 -0
  129. package/dist/in-store/resolve-host.js +333 -0
  130. package/dist/in-store/resolve-host.js.map +1 -0
  131. package/dist/in-store/resolve-relations.d.ts +23 -0
  132. package/dist/in-store/resolve-relations.d.ts.map +1 -0
  133. package/dist/in-store/resolve-relations.js +57 -0
  134. package/dist/in-store/resolve-relations.js.map +1 -0
  135. package/dist/in-store/resolve-source.d.ts.map +1 -1
  136. package/dist/in-store/resolve-source.js +59 -63
  137. package/dist/in-store/resolve-source.js.map +1 -1
  138. package/dist/in-store/schema-attributes.d.ts +33 -0
  139. package/dist/in-store/schema-attributes.d.ts.map +1 -0
  140. package/dist/in-store/schema-attributes.js +102 -0
  141. package/dist/in-store/schema-attributes.js.map +1 -0
  142. package/dist/in-store/space-footprints.d.ts +55 -0
  143. package/dist/in-store/space-footprints.d.ts.map +1 -0
  144. package/dist/in-store/space-footprints.js +260 -0
  145. package/dist/in-store/space-footprints.js.map +1 -0
  146. package/dist/in-store/space.d.ts.map +1 -1
  147. package/dist/in-store/space.js +15 -3
  148. package/dist/in-store/space.js.map +1 -1
  149. package/dist/in-store/spatial-children.d.ts +1 -1
  150. package/dist/in-store/spatial-children.js +1 -1
  151. package/dist/in-store/stair-edit.d.ts +24 -0
  152. package/dist/in-store/stair-edit.d.ts.map +1 -0
  153. package/dist/in-store/stair-edit.js +190 -0
  154. package/dist/in-store/stair-edit.js.map +1 -0
  155. package/dist/in-store/stair.d.ts +58 -0
  156. package/dist/in-store/stair.d.ts.map +1 -0
  157. package/dist/in-store/stair.js +156 -0
  158. package/dist/in-store/stair.js.map +1 -0
  159. package/dist/in-store/wall-join-apply.d.ts +74 -0
  160. package/dist/in-store/wall-join-apply.d.ts.map +1 -0
  161. package/dist/in-store/wall-join-apply.js +137 -0
  162. package/dist/in-store/wall-join-apply.js.map +1 -0
  163. package/dist/in-store/wall-join-edit.d.ts +70 -0
  164. package/dist/in-store/wall-join-edit.d.ts.map +1 -0
  165. package/dist/in-store/wall-join-edit.js +217 -0
  166. package/dist/in-store/wall-join-edit.js.map +1 -0
  167. package/dist/in-store/wall-join-read.d.ts +60 -0
  168. package/dist/in-store/wall-join-read.d.ts.map +1 -0
  169. package/dist/in-store/wall-join-read.js +230 -0
  170. package/dist/in-store/wall-join-read.js.map +1 -0
  171. package/dist/in-store/wall-join.d.ts +122 -0
  172. package/dist/in-store/wall-join.d.ts.map +1 -0
  173. package/dist/in-store/wall-join.js +231 -0
  174. package/dist/in-store/wall-join.js.map +1 -0
  175. package/dist/in-store/wall-opening-fit.d.ts +11 -0
  176. package/dist/in-store/wall-opening-fit.d.ts.map +1 -0
  177. package/dist/in-store/wall-opening-fit.js +27 -0
  178. package/dist/in-store/wall-opening-fit.js.map +1 -0
  179. package/dist/in-store/wall.d.ts +32 -0
  180. package/dist/in-store/wall.d.ts.map +1 -1
  181. package/dist/in-store/wall.js +77 -13
  182. package/dist/in-store/wall.js.map +1 -1
  183. package/dist/in-store/window.d.ts +7 -0
  184. package/dist/in-store/window.d.ts.map +1 -1
  185. package/dist/in-store/window.js +24 -17
  186. package/dist/in-store/window.js.map +1 -1
  187. package/dist/index.d.ts +1 -31
  188. package/dist/index.d.ts.map +1 -1
  189. package/dist/index.js +2 -34
  190. package/dist/index.js.map +1 -1
  191. package/dist/landxml/cant-superelevation.d.ts +28 -0
  192. package/dist/landxml/cant-superelevation.d.ts.map +1 -0
  193. package/dist/landxml/cant-superelevation.js +31 -0
  194. package/dist/landxml/cant-superelevation.js.map +1 -0
  195. package/dist/landxml/landxml-to-ifc.d.ts +8 -2
  196. package/dist/landxml/landxml-to-ifc.d.ts.map +1 -1
  197. package/dist/landxml/landxml-to-ifc.js +34 -2
  198. package/dist/landxml/landxml-to-ifc.js.map +1 -1
  199. package/dist/landxml/refusals.d.ts.map +1 -1
  200. package/dist/landxml/refusals.js +8 -3
  201. package/dist/landxml/refusals.js.map +1 -1
  202. package/dist/landxml/result-types.d.ts +44 -0
  203. package/dist/landxml/result-types.d.ts.map +1 -1
  204. package/dist/landxml/writers.d.ts +4 -0
  205. package/dist/landxml/writers.d.ts.map +1 -1
  206. package/dist/landxml/writers.js +4 -2
  207. package/dist/landxml/writers.js.map +1 -1
  208. package/package.json +8 -7
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Anchored builder for a design grid (#6232): an IfcGrid contained in the
3
+ * storey with tagged IfcGridAxis U and V axes (and optionally W), plus
4
+ * `gridIntersectionPlacement`, the IfcGridPlacement an element needs to sit
5
+ * on a grid intersection.
6
+ *
7
+ * Axes are straight lines given in the grid's own frame (metres, XY): the
8
+ * grid is placed on the storey at `Position`, turned by `Direction` about Z.
9
+ * Each axis curve is a two-point IfcPolyline, and the grid's 'FootPrint'
10
+ * representation is an IfcGeometricCurveSet of those same curves, so a viewer
11
+ * that reads either the axes or the representation draws the same lines.
12
+ * `rectangularGridAxes` makes the usual numbered / lettered orthogonal grid.
13
+ *
14
+ * Schema gating (D2): attributes are laid out from the anchor schema's
15
+ * registry. `IfcGrid.PredefinedType` exists from IFC4 on (dropped on IFC2X3);
16
+ * IFC4X3's IfcGridPlacement carries `PlacementRelTo` (the grid's placement),
17
+ * IFC2X3/IFC4 place it implicitly in the grid's frame; IFC2X3 orients a grid
18
+ * placement only by a second intersection, not a direction; IFC5 is refused.
19
+ */
20
+ import type { StoreEditor } from '@ifc-lite/mutations';
21
+ import { type SpatialAnchor } from './anchor.js';
22
+ type Vec2 = [number, number];
23
+ export interface GridAxisInStoreParams {
24
+ /** The axis tag shown in its bubble ('1', 'A', ...). Unique within the grid. */
25
+ Tag: string;
26
+ /** Start of the axis line in the grid's frame (metres). */
27
+ Start: Vec2;
28
+ /** End of the axis line in the grid's frame (metres). */
29
+ End: Vec2;
30
+ }
31
+ export interface GridInStoreParams {
32
+ /** Grid origin, storey-local (metres). Default [0, 0, 0]. */
33
+ Position?: [number, number, number];
34
+ /** Rotation of the grid about Z, radians (0 = grid X along storey X). Default 0. */
35
+ Direction?: number;
36
+ /** At least one axis. */
37
+ UAxes: readonly GridAxisInStoreParams[];
38
+ /** At least one axis. */
39
+ VAxes: readonly GridAxisInStoreParams[];
40
+ /** Optional third family (triangular grids). */
41
+ WAxes?: readonly GridAxisInStoreParams[];
42
+ /** IfcGrid PredefinedType (IFC4+; dropped on IFC2X3). */
43
+ PredefinedType?: 'RECTANGULAR' | 'RADIAL' | 'TRIANGULAR' | 'IRREGULAR' | 'USERDEFINED' | 'NOTDEFINED';
44
+ Name?: string;
45
+ Description?: string;
46
+ ObjectType?: string;
47
+ /** Explicit GlobalId (22-char IFC GUID); generated when omitted. */
48
+ GlobalId?: string;
49
+ }
50
+ export interface GridBuildResult {
51
+ gridId: number;
52
+ placementId: number;
53
+ /** IfcGridAxis ids, in `UAxes` order. */
54
+ uAxisIds: number[];
55
+ /** IfcGridAxis ids, in `VAxes` order. */
56
+ vAxisIds: number[];
57
+ /** IfcGridAxis ids, in `WAxes` order (empty without W axes). */
58
+ wAxisIds: number[];
59
+ shapeRepId: number;
60
+ productShapeId: number;
61
+ relContainedId: number;
62
+ }
63
+ /**
64
+ * U and V axes of an orthogonal grid, in the grid's frame (metres): U axes are
65
+ * the lines x = each of `UOffsets` (tagged 1, 2, 3, ...), V axes the lines
66
+ * y = each of `VOffsets` (tagged A, B, C, ...). Every axis runs `Overhang`
67
+ * (default 1 m) past the outermost crossing axes.
68
+ */
69
+ export declare function rectangularGridAxes(options: {
70
+ UOffsets: readonly number[];
71
+ VOffsets: readonly number[];
72
+ UTags?: readonly string[];
73
+ VTags?: readonly string[];
74
+ Overhang?: number;
75
+ }): {
76
+ UAxes: GridAxisInStoreParams[];
77
+ VAxes: GridAxisInStoreParams[];
78
+ };
79
+ export declare function addGridToStore(editor: StoreEditor, anchor: SpatialAnchor, params: GridInStoreParams): GridBuildResult;
80
+ /** Two grid axes (IfcGridAxis ids) and optional offsets from them (metres). */
81
+ export interface GridIntersectionParams {
82
+ /** The two crossing axes, e.g. a U axis and a V axis of the same grid. */
83
+ Axes: readonly [number, number];
84
+ /**
85
+ * Offsets (metres): the distance of the point from the first and from the
86
+ * second axis, measured perpendicular to each (to its left, looking along
87
+ * the axis), and an optional height above the grid plane. Default [0, 0].
88
+ */
89
+ Offsets?: readonly [number, number] | readonly [number, number, number];
90
+ }
91
+ export interface GridPlacementParams extends GridIntersectionParams {
92
+ /**
93
+ * Local +X of the placed element: a direction in the grid plane ([x, y]),
94
+ * or a second intersection it points at. Default: the grid's X axis.
95
+ * IFC2X3 accepts only an intersection.
96
+ */
97
+ RefDirection?: readonly [number, number] | GridIntersectionParams;
98
+ /**
99
+ * The grid's ObjectPlacement (`GridBuildResult.placementId`). Written as
100
+ * `PlacementRelTo` on IFC4X3; IFC2X3/IFC4 have no such attribute, their grid
101
+ * placement is implicitly in the frame of the grid the axes belong to.
102
+ */
103
+ GridPlacementId?: number;
104
+ }
105
+ export interface GridPlacementResult {
106
+ placementId: number;
107
+ intersectionId: number;
108
+ /** The IfcDirection or second IfcVirtualGridIntersection, when a RefDirection was given. */
109
+ refDirectionId: number | null;
110
+ }
111
+ /**
112
+ * Emit an IfcGridPlacement on the intersection of two grid axes, for an
113
+ * element's `ObjectPlacement` (IfcProduct attribute 5). The element's own
114
+ * geometry is then relative to the intersection, oriented by `RefDirection`.
115
+ */
116
+ export declare function gridIntersectionPlacement(editor: StoreEditor, anchor: Pick<SpatialAnchor, 'schema' | 'lengthUnitScale'>, params: GridPlacementParams): GridPlacementResult;
117
+ export {};
118
+ //# sourceMappingURL=grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/in-store/grid.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAkC,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAUjF,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7B,MAAM,WAAW,qBAAqB;IACpC,gFAAgF;IAChF,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,KAAK,EAAE,IAAI,CAAC;IACZ,yDAAyD;IACzD,GAAG,EAAE,IAAI,CAAC;CACX;AAED,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,KAAK,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACxC,yBAAyB;IACzB,KAAK,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACxC,gDAAgD;IAChD,KAAK,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACzC,yDAAyD;IACzD,cAAc,CAAC,EAAE,aAAa,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,GAAG,aAAa,GAAG,YAAY,CAAC;IACtG,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,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sB;IACjE;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,sBAAsB,CAAC;IAClE;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,4FAA4F;IAC5F,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAgBD;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,iBAAiB,CAAC,EACzD,MAAM,EAAE,mBAAmB,GAC1B,mBAAmB,CAkDrB"}
@@ -0,0 +1,194 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ import { assertFinitePoint3 } from '../ifc-creator-math.js';
5
+ import { toNativeLength, toNativePoint3 } from './anchor.js';
6
+ import { emitLocalPlacement, emitRelContainedInSpatialStructure, ownerHistoryRef, productGuid, } from './_emit-helpers.js';
7
+ import { schemaAttributes, schemaRegistry } from './schema-attributes.js';
8
+ /** Spreadsheet-style letters: 0 -> A, 25 -> Z, 26 -> AA. */
9
+ function letters(index) {
10
+ let out = '';
11
+ for (let i = index + 1; i > 0; i = Math.floor((i - 1) / 26))
12
+ out = String.fromCharCode(65 + ((i - 1) % 26)) + out;
13
+ return out;
14
+ }
15
+ /**
16
+ * U and V axes of an orthogonal grid, in the grid's frame (metres): U axes are
17
+ * the lines x = each of `UOffsets` (tagged 1, 2, 3, ...), V axes the lines
18
+ * y = each of `VOffsets` (tagged A, B, C, ...). Every axis runs `Overhang`
19
+ * (default 1 m) past the outermost crossing axes.
20
+ */
21
+ export function rectangularGridAxes(options) {
22
+ const op = 'rectangularGridAxes';
23
+ const { UOffsets, VOffsets } = options;
24
+ for (const [name, offsets] of [['UOffsets', UOffsets], ['VOffsets', VOffsets]]) {
25
+ if (!Array.isArray(offsets) || offsets.length === 0 || offsets.some((v) => !Number.isFinite(v))) {
26
+ throw new Error(`${op}: ${name} must be a non-empty array of finite numbers`);
27
+ }
28
+ }
29
+ const overhang = options.Overhang ?? 1;
30
+ if (!Number.isFinite(overhang) || overhang < 0)
31
+ throw new Error(`${op}: Overhang must be a finite, non-negative number`);
32
+ const x0 = Math.min(...UOffsets) - overhang;
33
+ const x1 = Math.max(...UOffsets) + overhang;
34
+ const y0 = Math.min(...VOffsets) - overhang;
35
+ const y1 = Math.max(...VOffsets) + overhang;
36
+ return {
37
+ UAxes: UOffsets.map((x, i) => ({ Tag: options.UTags?.[i] ?? String(i + 1), Start: [x, y0], End: [x, y1] })),
38
+ VAxes: VOffsets.map((y, i) => ({ Tag: options.VTags?.[i] ?? letters(i), Start: [x0, y], End: [x1, y] })),
39
+ };
40
+ }
41
+ function assertGridParams(params, op) {
42
+ if (params.Position !== undefined)
43
+ assertFinitePoint3({ Position: params.Position }, op);
44
+ if (params.Direction !== undefined && !Number.isFinite(params.Direction)) {
45
+ throw new Error(`${op}: Direction must be a finite number (radians)`);
46
+ }
47
+ const tags = new Set();
48
+ const families = [
49
+ ['UAxes', params.UAxes, true],
50
+ ['VAxes', params.VAxes, true],
51
+ ['WAxes', params.WAxes, false],
52
+ ];
53
+ for (const [name, axes, required] of families) {
54
+ if (axes === undefined && !required)
55
+ continue;
56
+ if (!Array.isArray(axes) || (required && axes.length === 0)) {
57
+ throw new Error(`${op}: ${name} needs at least one axis`);
58
+ }
59
+ axes.forEach((axis, i) => {
60
+ if (typeof axis?.Tag !== 'string' || axis.Tag.trim() === '')
61
+ throw new Error(`${op}: ${name}[${i}].Tag must be a non-empty string`);
62
+ if (tags.has(axis.Tag))
63
+ throw new Error(`${op}: axis tag "${axis.Tag}" is used twice`);
64
+ tags.add(axis.Tag);
65
+ const points = [axis.Start, axis.End];
66
+ if (points.some((p) => !Array.isArray(p) || p.length !== 2 || !p.every(Number.isFinite))) {
67
+ throw new Error(`${op}: ${name}[${i}] Start and End must be finite [x, y] points`);
68
+ }
69
+ if (Math.hypot(axis.End[0] - axis.Start[0], axis.End[1] - axis.Start[1]) <= 1e-9) {
70
+ throw new Error(`${op}: ${name}[${i}] Start and End must be distinct points`);
71
+ }
72
+ });
73
+ }
74
+ }
75
+ export function addGridToStore(editor, anchor, params) {
76
+ const op = 'addGridToStore';
77
+ assertGridParams(params, op);
78
+ const registry = schemaRegistry(anchor.schema, op);
79
+ const isIfc2x3 = registry.name.toUpperCase() === 'IFC2X3';
80
+ const globalId = productGuid(params, anchor.guidRandom);
81
+ const gridValues = (placement, shape, u, v, w) => ({
82
+ GlobalId: globalId,
83
+ OwnerHistory: ownerHistoryRef(anchor.ownerHistoryId),
84
+ Name: params.Name ?? 'Grid',
85
+ Description: params.Description,
86
+ ObjectType: params.ObjectType,
87
+ ObjectPlacement: placement,
88
+ Representation: shape,
89
+ UAxes: u,
90
+ VAxes: v,
91
+ WAxes: w.length > 0 ? w : null,
92
+ ...(isIfc2x3 ? {} : { PredefinedType: params.PredefinedType }),
93
+ });
94
+ // Lay the grid record out before the first emit so a bad PredefinedType or
95
+ // a missing IFC2X3 OwnerHistory refuses cleanly.
96
+ schemaAttributes(registry, 'IfcGrid', gridValues(null, null, ['#0'], ['#0'], []), op);
97
+ const direction = params.Direction ?? 0;
98
+ const placementId = emitLocalPlacement(editor, anchor.storeyPlacementId, toNativePoint3(anchor, params.Position ?? [0, 0, 0]), [0, 0, 1], [Math.cos(direction), Math.sin(direction), 0]);
99
+ const curves = [];
100
+ const emitAxes = (axes) => (axes ?? []).map((axis) => {
101
+ const points = [axis.Start, axis.End].map((p) => editor.addEntity('IfcCartesianPoint', [
102
+ [toNativeLength(anchor, p[0]), toNativeLength(anchor, p[1])],
103
+ ]).expressId);
104
+ const curve = editor.addEntity('IfcPolyline', [points.map((id) => `#${id}`)]).expressId;
105
+ curves.push(curve);
106
+ return editor.addEntity('IfcGridAxis', schemaAttributes(registry, 'IfcGridAxis', {
107
+ AxisTag: axis.Tag,
108
+ AxisCurve: `#${curve}`,
109
+ SameSense: true,
110
+ }, op)).expressId;
111
+ });
112
+ const uAxisIds = emitAxes(params.UAxes);
113
+ const vAxisIds = emitAxes(params.VAxes);
114
+ const wAxisIds = emitAxes(params.WAxes);
115
+ // 'FootPrint' GeometricCurveSet of the axis curves, in the root 3D context
116
+ // (models rarely carry a FootPrint subcontext).
117
+ const curveSet = editor.addEntity('IfcGeometricCurveSet', [curves.map((id) => `#${id}`)]).expressId;
118
+ const shapeRepId = editor.addEntity('IfcShapeRepresentation', [
119
+ `#${anchor.rootContextId ?? anchor.axisContextId}`,
120
+ 'FootPrint',
121
+ 'GeometricCurveSet',
122
+ [`#${curveSet}`],
123
+ ]).expressId;
124
+ const productShapeId = editor.addEntity('IfcProductDefinitionShape', [null, null, [`#${shapeRepId}`]]).expressId;
125
+ const refs = (ids) => ids.map((id) => `#${id}`);
126
+ const gridId = editor.addEntity('IfcGrid', schemaAttributes(registry, 'IfcGrid', gridValues(`#${placementId}`, `#${productShapeId}`, refs(uAxisIds), refs(vAxisIds), refs(wAxisIds)), op)).expressId;
127
+ const relContainedId = emitRelContainedInSpatialStructure(editor, anchor.ownerHistoryId, gridId, anchor.storeyId, anchor.guidRandom);
128
+ return { gridId, placementId, uAxisIds, vAxisIds, wAxisIds, shapeRepId, productShapeId, relContainedId };
129
+ }
130
+ function assertIntersection(editor, params, name, op) {
131
+ if (!Array.isArray(params?.Axes) || params.Axes.length !== 2 || params.Axes[0] === params.Axes[1]) {
132
+ throw new Error(`${op}: ${name}.Axes must be two different IfcGridAxis ids`);
133
+ }
134
+ for (const id of params.Axes) {
135
+ const type = editor.getEntityType(id);
136
+ if (type !== 'IfcGridAxis')
137
+ throw new Error(`${op}: #${id} is ${type ?? 'not an entity'}, not an IfcGridAxis`);
138
+ }
139
+ const offsets = params.Offsets;
140
+ if (offsets !== undefined && (!Array.isArray(offsets) || offsets.length < 2 || offsets.length > 3 || !offsets.every(Number.isFinite))) {
141
+ throw new Error(`${op}: ${name}.Offsets must be two or three finite numbers`);
142
+ }
143
+ }
144
+ /**
145
+ * Emit an IfcGridPlacement on the intersection of two grid axes, for an
146
+ * element's `ObjectPlacement` (IfcProduct attribute 5). The element's own
147
+ * geometry is then relative to the intersection, oriented by `RefDirection`.
148
+ */
149
+ export function gridIntersectionPlacement(editor, anchor, params) {
150
+ const op = 'gridIntersectionPlacement';
151
+ const registry = schemaRegistry(anchor.schema, op);
152
+ const isIfc2x3 = registry.name.toUpperCase() === 'IFC2X3';
153
+ const isIfc4x3 = registry.name.toUpperCase().startsWith('IFC4X3');
154
+ assertIntersection(editor, params, 'Location', op);
155
+ const ref = params.RefDirection;
156
+ const refIsVector = Array.isArray(ref);
157
+ if (ref !== undefined) {
158
+ if (refIsVector) {
159
+ const [x, y] = ref;
160
+ if (ref.length !== 2 || !Number.isFinite(x) || !Number.isFinite(y) || Math.hypot(x, y) <= 1e-12) {
161
+ throw new Error(`${op}: RefDirection must be a non-zero finite [x, y] direction`);
162
+ }
163
+ if (isIfc2x3)
164
+ throw new Error(`${op}: IFC2X3 orients a grid placement only by a second intersection, not a direction`);
165
+ }
166
+ else {
167
+ assertIntersection(editor, ref, 'RefDirection', op);
168
+ }
169
+ }
170
+ if (params.GridPlacementId !== undefined && isIfc4x3) {
171
+ const type = editor.getEntityType(params.GridPlacementId);
172
+ if (type === undefined || !/Placement$/.test(type)) {
173
+ throw new Error(`${op}: GridPlacementId #${params.GridPlacementId} is ${type ?? 'not an entity'}, not an object placement`);
174
+ }
175
+ }
176
+ const emitIntersection = (p) => editor.addEntity('IfcVirtualGridIntersection', schemaAttributes(registry, 'IfcVirtualGridIntersection', {
177
+ IntersectingAxes: p.Axes.map((id) => `#${id}`),
178
+ OffsetDistances: (p.Offsets ?? [0, 0]).map((d) => ({ real: toNativeLength(anchor, d) })),
179
+ }, op)).expressId;
180
+ const intersectionId = emitIntersection(params);
181
+ let refDirectionId = null;
182
+ if (ref !== undefined) {
183
+ refDirectionId = refIsVector
184
+ ? editor.addEntity('IfcDirection', [[ref[0], ref[1], 0]]).expressId
185
+ : emitIntersection(ref);
186
+ }
187
+ const placementId = editor.addEntity('IfcGridPlacement', schemaAttributes(registry, 'IfcGridPlacement', {
188
+ ...(isIfc4x3 && params.GridPlacementId !== undefined ? { PlacementRelTo: `#${params.GridPlacementId}` } : {}),
189
+ PlacementLocation: `#${intersectionId}`,
190
+ PlacementRefDirection: refDirectionId === null ? null : `#${refDirectionId}`,
191
+ }, op)).expressId;
192
+ return { placementId, intersectionId, refDirectionId };
193
+ }
194
+ //# sourceMappingURL=grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/in-store/grid.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAuB/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AACjF,OAAO,EACL,kBAAkB,EAClB,kCAAkC,EAClC,eAAe,EACf,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAgD1E,4DAA4D;AAC5D,SAAS,OAAO,CAAC,KAAa;IAC5B,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QAAE,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;IACl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body and planar readers share the same
4
+ * placement validation without requiring an anchor's unrelated methods. */
5
+ export interface GeometryEntityReader {
6
+ entity(id: number): {
7
+ type: string;
8
+ attributes: readonly unknown[];
9
+ } | null;
10
+ }
11
+ export type Vec3 = [number, number, number];
12
+ export type Frame3 = {
13
+ o: Vec3;
14
+ x: Vec3;
15
+ y: Vec3;
16
+ z: Vec3;
17
+ };
18
+ /** Source extractors use numbers; overlay references use #id strings. */
19
+ export declare function refId(value: unknown): number | null;
20
+ export declare function num(value: unknown): number | null;
21
+ /** A 3D frame needs exactly three coordinates. A profile opts into two,
22
+ * embedded in XY; missing 3D coordinates must never be synthesized. */
23
+ export declare function vec3(value: unknown, dimension?: 2 | 3): Vec3 | null;
24
+ export declare function pointOf(reader: GeometryEntityReader, ref: unknown, type?: string, dimension?: 2 | 3): Vec3 | null;
25
+ export declare function unit(v: Vec3): Vec3 | null;
26
+ /** IfcAxis2Placement2D: Position is optional on a profile; Location is required. */
27
+ export declare function axis2d(reader: GeometryEntityReader, ref: unknown): {
28
+ o: [number, number];
29
+ x: [number, number];
30
+ } | null;
31
+ /** IfcAxis2Placement3D: only an omitted optional Position/Axis/RefDirection
32
+ * uses defaults. An explicit missing, zero or parallel axis is unreadable. */
33
+ export declare function axis3d(reader: GeometryEntityReader, ref: unknown): Frame3 | null;
34
+ export declare function applyFrame(f: Frame3, p: Vec3): Vec3;
35
+ export declare function transformBounds(bounds: HostBounds, frame: Frame3): HostBounds;
36
+ export declare function composeFrame(outer: Frame3, inner: Frame3): Frame3;
37
+ /** Rigid placement inverse; axis3d supplies orthonormal placement axes. */
38
+ export declare function inverseFrame(f: Frame3): Frame3;
39
+ /** Full 3D local-placement chain, including the opening's rotated frame.
40
+ * Missing references, cycles and excessive acyclic chains are unreadable. */
41
+ export declare function placementInAncestor(reader: AnchorEntityReader, placementId: number, ancestorId: number): Frame3 | null;
42
+ /** Subcontexts inherit CoordinateSpaceDimension from ParentContext. */
43
+ export declare function contextDimension(reader: AnchorEntityReader, contextId: number): 2 | 3 | null;
44
+ //# sourceMappingURL=host-geometry-frame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-geometry-frame.d.ts","sourceRoot":"","sources":["../../src/in-store/host-geometry-frame.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;2EAC2E;AAC3E,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,SAAS,OAAO,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;CAC7E;AAED,MAAM,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC5C,MAAM,MAAM,MAAM,GAAG;IAAE,CAAC,EAAE,IAAI,CAAC;IAAC,CAAC,EAAE,IAAI,CAAC;IAAC,CAAC,EAAE,IAAI,CAAC;IAAC,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAE5D,yEAAyE;AACzE,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAInD;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAEjD;AAED;uEACuE;AACvE,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,GAAE,CAAC,GAAG,CAAK,GAAG,IAAI,GAAG,IAAI,CAMtE;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,SAAsB,EAAE,SAAS,GAAE,CAAC,GAAG,CAAK,GAAG,IAAI,GAAG,IAAI,CAIjI;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAGzC;AAED,oFAAoF;AACpF,wBAAgB,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,EAAE,OAAO,GAAG;IAAE,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,IAAI,CAStH;AAED;8EAC8E;AAC9E,wBAAgB,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAiBhF;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,CAMnD;AAID,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAO7E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAGjE;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAK9C;AAED;6EAC6E;AAC7E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgBtH;AAED,uEAAuE;AACvE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAc5F"}
@@ -0,0 +1,146 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /** Package-private body frame reads: defaults belong only to omitted optional
5
+ * attributes, never to an explicit unreadable reference (#6232 / #6539). */
6
+ import { firstProjAxis } from '@ifc-lite/data';
7
+ /** Source extractors use numbers; overlay references use #id strings. */
8
+ export function refId(value) {
9
+ if (typeof value === 'number' && Number.isInteger(value) && value > 0)
10
+ return value;
11
+ if (typeof value === 'string' && /^#[1-9][0-9]*$/.test(value))
12
+ return Number(value.slice(1));
13
+ return null;
14
+ }
15
+ export function num(value) {
16
+ return typeof value === 'number' && Number.isFinite(value) ? value : null;
17
+ }
18
+ /** A 3D frame needs exactly three coordinates. A profile opts into two,
19
+ * embedded in XY; missing 3D coordinates must never be synthesized. */
20
+ export function vec3(value, dimension = 3) {
21
+ if (!Array.isArray(value) || value.length !== dimension)
22
+ return null;
23
+ const x = num(value[0]);
24
+ const y = num(value[1]);
25
+ const z = dimension === 3 ? num(value[2]) : 0;
26
+ return x === null || y === null || z === null ? null : [x, y, z];
27
+ }
28
+ export function pointOf(reader, ref, type = 'IFCCARTESIANPOINT', dimension = 3) {
29
+ const id = refId(ref);
30
+ const entity = id === null ? null : reader.entity(id);
31
+ return entity?.type.toUpperCase() === type ? vec3(entity.attributes[0], dimension) : null;
32
+ }
33
+ export function unit(v) {
34
+ const len = Math.hypot(v[0], v[1], v[2]);
35
+ return len > 1e-12 ? [v[0] / len, v[1] / len, v[2] / len] : null;
36
+ }
37
+ /** IfcAxis2Placement2D: Position is optional on a profile; Location is required. */
38
+ export function axis2d(reader, ref) {
39
+ if (ref === null || ref === undefined)
40
+ return { o: [0, 0], x: [1, 0] };
41
+ const id = refId(ref), placement = id === null ? null : reader.entity(id);
42
+ if (placement?.type.toUpperCase() !== 'IFCAXIS2PLACEMENT2D')
43
+ return null;
44
+ const o = pointOf(reader, placement.attributes[0], 'IFCCARTESIANPOINT', 2);
45
+ const refDirection = placement.attributes[1];
46
+ const dir = refDirection === null || refDirection === undefined ? [1, 0, 0] : pointOf(reader, refDirection, 'IFCDIRECTION', 2);
47
+ const x = dir ? unit([dir[0], dir[1], 0]) : null;
48
+ return o && x ? { o: [o[0], o[1]], x: [x[0], x[1]] } : null;
49
+ }
50
+ /** IfcAxis2Placement3D: only an omitted optional Position/Axis/RefDirection
51
+ * uses defaults. An explicit missing, zero or parallel axis is unreadable. */
52
+ export function axis3d(reader, ref) {
53
+ if (ref === null || ref === undefined)
54
+ return { o: [0, 0, 0], x: [1, 0, 0], y: [0, 1, 0], z: [0, 0, 1] };
55
+ const id = refId(ref), placement = id === null ? null : reader.entity(id);
56
+ if (placement?.type.toUpperCase() !== 'IFCAXIS2PLACEMENT3D')
57
+ return null;
58
+ const o = pointOf(reader, placement.attributes[0]);
59
+ const axis = placement.attributes[1], refDirection = placement.attributes[2];
60
+ const direction = axis === null || axis === undefined ? [0, 0, 1] : pointOf(reader, axis, 'IFCDIRECTION');
61
+ const z = direction ? unit(direction) : null;
62
+ if (!o || !z)
63
+ return null;
64
+ // An absent RefDirection uses the renderer's canonical fill (#5922).
65
+ const r = refDirection === null || refDirection === undefined ? firstProjAxis(z) : pointOf(reader, refDirection, 'IFCDIRECTION');
66
+ if (!r)
67
+ return null;
68
+ const dot = r[0] * z[0] + r[1] * z[1] + r[2] * z[2];
69
+ const x = unit([r[0] - dot * z[0], r[1] - dot * z[1], r[2] - dot * z[2]]);
70
+ if (!x)
71
+ return null;
72
+ const y = [z[1] * x[2] - z[2] * x[1], z[2] * x[0] - z[0] * x[2], z[0] * x[1] - z[1] * x[0]];
73
+ return { o, x, y, z };
74
+ }
75
+ export function applyFrame(f, p) {
76
+ return [
77
+ f.o[0] + f.x[0] * p[0] + f.y[0] * p[1] + f.z[0] * p[2],
78
+ f.o[1] + f.x[1] * p[0] + f.y[1] * p[1] + f.z[1] * p[2],
79
+ f.o[2] + f.x[2] * p[0] + f.y[2] * p[1] + f.z[2] * p[2],
80
+ ];
81
+ }
82
+ const IDENTITY_FRAME3 = { o: [0, 0, 0], x: [1, 0, 0], y: [0, 1, 0], z: [0, 0, 1] };
83
+ export function transformBounds(bounds, frame) {
84
+ const min = [Infinity, Infinity, Infinity], max = [-Infinity, -Infinity, -Infinity];
85
+ for (const x of [bounds.min[0], bounds.max[0]])
86
+ for (const y of [bounds.min[1], bounds.max[1]])
87
+ for (const z of [bounds.min[2], bounds.max[2]]) {
88
+ const p = applyFrame(frame, [x, y, z]);
89
+ for (let i = 0; i < 3; i++) {
90
+ min[i] = Math.min(min[i], p[i]);
91
+ max[i] = Math.max(max[i], p[i]);
92
+ }
93
+ }
94
+ return { min, max };
95
+ }
96
+ export function composeFrame(outer, inner) {
97
+ const direction = (p) => [0, 1, 2].map(i => outer.x[i] * p[0] + outer.y[i] * p[1] + outer.z[i] * p[2]);
98
+ return { o: applyFrame(outer, inner.o), x: direction(inner.x), y: direction(inner.y), z: direction(inner.z) };
99
+ }
100
+ /** Rigid placement inverse; axis3d supplies orthonormal placement axes. */
101
+ export function inverseFrame(f) {
102
+ return {
103
+ o: [f.x, f.y, f.z].map(v => -(v[0] * f.o[0] + v[1] * f.o[1] + v[2] * f.o[2])),
104
+ x: [f.x[0], f.y[0], f.z[0]], y: [f.x[1], f.y[1], f.z[1]], z: [f.x[2], f.y[2], f.z[2]],
105
+ };
106
+ }
107
+ /** Full 3D local-placement chain, including the opening's rotated frame.
108
+ * Missing references, cycles and excessive acyclic chains are unreadable. */
109
+ export function placementInAncestor(reader, placementId, ancestorId) {
110
+ let frame = IDENTITY_FRAME3;
111
+ let id = placementId;
112
+ const visited = new Set();
113
+ while (id !== null && id !== ancestorId) {
114
+ if (visited.size >= 10_000 || visited.has(id))
115
+ return null;
116
+ visited.add(id);
117
+ const placement = reader.entity(id);
118
+ const axisId = placement ? refId(placement.attributes[1]) : null;
119
+ if (placement?.type.toUpperCase() !== 'IFCLOCALPLACEMENT' || axisId === null)
120
+ return null;
121
+ const own = axis3d(reader, axisId);
122
+ if (!own)
123
+ return null;
124
+ frame = composeFrame(own, frame);
125
+ id = refId(placement.attributes[0]);
126
+ }
127
+ return id === ancestorId ? frame : null;
128
+ }
129
+ /** Subcontexts inherit CoordinateSpaceDimension from ParentContext. */
130
+ export function contextDimension(reader, contextId) {
131
+ let id = contextId;
132
+ const visited = new Set();
133
+ while (id !== null && visited.size < 10_000 && !visited.has(id)) {
134
+ visited.add(id);
135
+ const context = reader.entity(id);
136
+ if (context?.type.toUpperCase() === 'IFCGEOMETRICREPRESENTATIONCONTEXT') {
137
+ const dimension = context.attributes[2];
138
+ return dimension === 2 || dimension === 3 ? dimension : null;
139
+ }
140
+ if (context?.type.toUpperCase() !== 'IFCGEOMETRICREPRESENTATIONSUBCONTEXT')
141
+ return null;
142
+ id = refId(context.attributes[6]);
143
+ }
144
+ return null;
145
+ }
146
+ //# sourceMappingURL=host-geometry-frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-geometry-frame.js","sourceRoot":"","sources":["../../src/in-store/host-geometry-frame.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;4EAC4E;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAa/C,yEAAyE;AACzE,MAAM,UAAU,KAAK,CAAC,KAAc;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACpF,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7F,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,KAAc;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5E,CAAC;AAED;uEACuE;AACvE,MAAM,UAAU,IAAI,CAAC,KAAc,EAAE,YAAmB,CAAC;IACvD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,IAAI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CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACjC,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1C,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,gBAAgB,CAAC,MAA0B,EAAE,SAAiB;IAC5E,IAAI,EAAE,GAAkB,SAAS,CAAC;IAClC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,OAAO,EAAE,KAAK,IAAI,IAAI,OAAO,CAAC,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;QAChE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAClC,IAAI,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,mCAAmC,EAAE,CAAC;YACxE,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YACxC,OAAO,SAAS,KAAK,CAAC,IAAI,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/D,CAAC;QACD,IAAI,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,sCAAsC;YAAE,OAAO,IAAI,CAAC;QACxF,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,29 @@
1
+ /** Shared hosted size/position commit (#6232). Resize the actual occurrence's
2
+ * geometry and its cut together, preserving the source's topology and style.
3
+ * Placement, movement and resize share one conservative fit/overlap decision. */
4
+ import type { IfcDataStore } from '@ifc-lite/parser';
5
+ import type { MutablePropertyView, StoreEditor } from '@ifc-lite/mutations';
6
+ import { type HostedFillRead } from './hosted-fill-read.js';
7
+ export interface HostedElementSize {
8
+ /** Effective IfcDoor / IfcWindow dimension, metres. Geometry supplies the
9
+ * dimension when the optional EXPRESS attribute is omitted. */
10
+ readonly OverallWidth: number;
11
+ readonly OverallHeight: number;
12
+ }
13
+ export interface HostedElementEdit {
14
+ readonly OverallWidth?: number;
15
+ readonly OverallHeight?: number;
16
+ /** Along the host's local X to the opening placement origin, metres. */
17
+ readonly Offset?: number;
18
+ /** Height of the opening placement origin in the host frame, metres. */
19
+ readonly Sill?: number;
20
+ }
21
+ /** Read through the effective overlay, including imported mapped geometry.
22
+ * A missing or unsupported physical shape is unreadable, never a rectangle. */
23
+ export declare function readHostedElementSize(store: IfcDataStore, id: number, view?: MutablePropertyView | null): HostedElementSize | null;
24
+ /** Atomic params-to-commit operation. Affine resizing is centred across the
25
+ * existing cut and held at its bottom; host thickness stays unchanged. Only
26
+ * the occurrence's Representation/placement/dimensions change, never its type
27
+ * maps, GlobalId, metadata or relationships. Refusals leave no overlay writes. */
28
+ export declare function editHostedElementInStore(store: IfcDataStore, editor: StoreEditor, id: number, patch: HostedElementEdit): HostedFillRead;
29
+ //# sourceMappingURL=hosted-element-edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-element-edit.d.ts","sourceRoot":"","sources":["../../src/in-store/hosted-element-edit.ts"],"names":[],"mappings":"AAIA;;iFAEiF;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAI5E,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAO5E,MAAM,WAAW,iBAAiB;IAChC;mEAC+D;IAC/D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,wEAAwE;IACxE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,wEAAwE;IACxE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AA4CD;+EAC+E;AAC/E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAAG,iBAAiB,GAAG,IAAI,CAElI;AAED;;;kFAGkF;AAClF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,cAAc,CAoDvI"}