@ifc-lite/create 3.2.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 (149) hide show
  1. package/README.md +9 -0
  2. package/dist/in-store/auto-space-detect.d.ts +1 -1
  3. package/dist/in-store/auto-space-detect.js +1 -1
  4. package/dist/in-store/beam.d.ts +10 -1
  5. package/dist/in-store/beam.d.ts.map +1 -1
  6. package/dist/in-store/beam.js +14 -25
  7. package/dist/in-store/beam.js.map +1 -1
  8. package/dist/in-store/column.d.ts +10 -1
  9. package/dist/in-store/column.d.ts.map +1 -1
  10. package/dist/in-store/column.js +23 -22
  11. package/dist/in-store/column.js.map +1 -1
  12. package/dist/in-store/copy-frame.d.ts +52 -0
  13. package/dist/in-store/copy-frame.d.ts.map +1 -0
  14. package/dist/in-store/copy-frame.js +99 -0
  15. package/dist/in-store/copy-frame.js.map +1 -0
  16. package/dist/in-store/copy-product.d.ts +96 -0
  17. package/dist/in-store/copy-product.d.ts.map +1 -0
  18. package/dist/in-store/copy-product.js +318 -0
  19. package/dist/in-store/copy-product.js.map +1 -0
  20. package/dist/in-store/curtain-wall.d.ts +87 -0
  21. package/dist/in-store/curtain-wall.d.ts.map +1 -0
  22. package/dist/in-store/curtain-wall.js +237 -0
  23. package/dist/in-store/curtain-wall.js.map +1 -0
  24. package/dist/in-store/extract-grids.d.ts +46 -0
  25. package/dist/in-store/extract-grids.d.ts.map +1 -0
  26. package/dist/in-store/extract-grids.js +211 -0
  27. package/dist/in-store/extract-grids.js.map +1 -0
  28. package/dist/in-store/extract-walls.d.ts +12 -23
  29. package/dist/in-store/extract-walls.d.ts.map +1 -1
  30. package/dist/in-store/extract-walls.js +6 -69
  31. package/dist/in-store/extract-walls.js.map +1 -1
  32. package/dist/in-store/generate-spaces.d.ts +1 -1
  33. package/dist/in-store/grid.d.ts +118 -0
  34. package/dist/in-store/grid.d.ts.map +1 -0
  35. package/dist/in-store/grid.js +194 -0
  36. package/dist/in-store/grid.js.map +1 -0
  37. package/dist/in-store/host-geometry-frame.d.ts +44 -0
  38. package/dist/in-store/host-geometry-frame.d.ts.map +1 -0
  39. package/dist/in-store/host-geometry-frame.js +146 -0
  40. package/dist/in-store/host-geometry-frame.js.map +1 -0
  41. package/dist/in-store/hosted-element-edit.d.ts +29 -0
  42. package/dist/in-store/hosted-element-edit.d.ts.map +1 -0
  43. package/dist/in-store/hosted-element-edit.js +120 -0
  44. package/dist/in-store/hosted-element-edit.js.map +1 -0
  45. package/dist/in-store/hosted-element.d.ts +41 -0
  46. package/dist/in-store/hosted-element.d.ts.map +1 -0
  47. package/dist/in-store/hosted-element.js +124 -0
  48. package/dist/in-store/hosted-element.js.map +1 -0
  49. package/dist/in-store/hosted-fill-read.d.ts +56 -0
  50. package/dist/in-store/hosted-fill-read.d.ts.map +1 -0
  51. package/dist/in-store/hosted-fill-read.js +197 -0
  52. package/dist/in-store/hosted-fill-read.js.map +1 -0
  53. package/dist/in-store/hosted-global-id.d.ts +8 -0
  54. package/dist/in-store/hosted-global-id.d.ts.map +1 -0
  55. package/dist/in-store/hosted-global-id.js +53 -0
  56. package/dist/in-store/hosted-global-id.js.map +1 -0
  57. package/dist/in-store/hosted-placement-edit.d.ts +30 -0
  58. package/dist/in-store/hosted-placement-edit.d.ts.map +1 -0
  59. package/dist/in-store/hosted-placement-edit.js +123 -0
  60. package/dist/in-store/hosted-placement-edit.js.map +1 -0
  61. package/dist/in-store/hosted-scale-chain.d.ts +12 -0
  62. package/dist/in-store/hosted-scale-chain.d.ts.map +1 -0
  63. package/dist/in-store/hosted-scale-chain.js +74 -0
  64. package/dist/in-store/hosted-scale-chain.js.map +1 -0
  65. package/dist/in-store/hosted-shape-edit.d.ts +9 -0
  66. package/dist/in-store/hosted-shape-edit.d.ts.map +1 -0
  67. package/dist/in-store/hosted-shape-edit.js +79 -0
  68. package/dist/in-store/hosted-shape-edit.js.map +1 -0
  69. package/dist/in-store/index.d.ts +59 -0
  70. package/dist/in-store/index.d.ts.map +1 -0
  71. package/dist/in-store/index.js +64 -0
  72. package/dist/in-store/index.js.map +1 -0
  73. package/dist/in-store/member.d.ts +8 -2
  74. package/dist/in-store/member.d.ts.map +1 -1
  75. package/dist/in-store/member.js +12 -14
  76. package/dist/in-store/member.js.map +1 -1
  77. package/dist/in-store/placement-frame.d.ts +9 -4
  78. package/dist/in-store/placement-frame.d.ts.map +1 -1
  79. package/dist/in-store/placement-frame.js +20 -35
  80. package/dist/in-store/placement-frame.js.map +1 -1
  81. package/dist/in-store/profile.d.ts +141 -0
  82. package/dist/in-store/profile.d.ts.map +1 -0
  83. package/dist/in-store/profile.js +174 -0
  84. package/dist/in-store/profile.js.map +1 -0
  85. package/dist/in-store/railing.d.ts +65 -0
  86. package/dist/in-store/railing.d.ts.map +1 -0
  87. package/dist/in-store/railing.js +112 -0
  88. package/dist/in-store/railing.js.map +1 -0
  89. package/dist/in-store/rel-connects-path.d.ts +43 -0
  90. package/dist/in-store/rel-connects-path.d.ts.map +1 -0
  91. package/dist/in-store/rel-connects-path.js +65 -0
  92. package/dist/in-store/rel-connects-path.js.map +1 -0
  93. package/dist/in-store/resolve-host.d.ts +12 -1
  94. package/dist/in-store/resolve-host.d.ts.map +1 -1
  95. package/dist/in-store/resolve-host.js +169 -85
  96. package/dist/in-store/resolve-host.js.map +1 -1
  97. package/dist/in-store/resolve-source.d.ts.map +1 -1
  98. package/dist/in-store/resolve-source.js +39 -59
  99. package/dist/in-store/resolve-source.js.map +1 -1
  100. package/dist/in-store/schema-attributes.d.ts +5 -0
  101. package/dist/in-store/schema-attributes.d.ts.map +1 -1
  102. package/dist/in-store/schema-attributes.js +9 -2
  103. package/dist/in-store/schema-attributes.js.map +1 -1
  104. package/dist/in-store/space-footprints.d.ts +55 -0
  105. package/dist/in-store/space-footprints.d.ts.map +1 -0
  106. package/dist/in-store/space-footprints.js +260 -0
  107. package/dist/in-store/space-footprints.js.map +1 -0
  108. package/dist/in-store/space.d.ts.map +1 -1
  109. package/dist/in-store/space.js +15 -3
  110. package/dist/in-store/space.js.map +1 -1
  111. package/dist/in-store/spatial-children.d.ts +1 -1
  112. package/dist/in-store/spatial-children.js +1 -1
  113. package/dist/in-store/stair-edit.d.ts +24 -0
  114. package/dist/in-store/stair-edit.d.ts.map +1 -0
  115. package/dist/in-store/stair-edit.js +190 -0
  116. package/dist/in-store/stair-edit.js.map +1 -0
  117. package/dist/in-store/stair.d.ts +58 -0
  118. package/dist/in-store/stair.d.ts.map +1 -0
  119. package/dist/in-store/stair.js +156 -0
  120. package/dist/in-store/stair.js.map +1 -0
  121. package/dist/in-store/wall-join-apply.d.ts +74 -0
  122. package/dist/in-store/wall-join-apply.d.ts.map +1 -0
  123. package/dist/in-store/wall-join-apply.js +137 -0
  124. package/dist/in-store/wall-join-apply.js.map +1 -0
  125. package/dist/in-store/wall-join-edit.d.ts +70 -0
  126. package/dist/in-store/wall-join-edit.d.ts.map +1 -0
  127. package/dist/in-store/wall-join-edit.js +217 -0
  128. package/dist/in-store/wall-join-edit.js.map +1 -0
  129. package/dist/in-store/wall-join-read.d.ts +60 -0
  130. package/dist/in-store/wall-join-read.d.ts.map +1 -0
  131. package/dist/in-store/wall-join-read.js +230 -0
  132. package/dist/in-store/wall-join-read.js.map +1 -0
  133. package/dist/in-store/wall-join.d.ts +122 -0
  134. package/dist/in-store/wall-join.d.ts.map +1 -0
  135. package/dist/in-store/wall-join.js +231 -0
  136. package/dist/in-store/wall-join.js.map +1 -0
  137. package/dist/in-store/wall-opening-fit.d.ts +11 -0
  138. package/dist/in-store/wall-opening-fit.d.ts.map +1 -0
  139. package/dist/in-store/wall-opening-fit.js +27 -0
  140. package/dist/in-store/wall-opening-fit.js.map +1 -0
  141. package/dist/in-store/wall.d.ts +32 -0
  142. package/dist/in-store/wall.d.ts.map +1 -1
  143. package/dist/in-store/wall.js +77 -13
  144. package/dist/in-store/wall.js.map +1 -1
  145. package/dist/index.d.ts +1 -38
  146. package/dist/index.d.ts.map +1 -1
  147. package/dist/index.js +2 -40
  148. package/dist/index.js.map +1 -1
  149. package/package.json +6 -6
package/README.md CHANGED
@@ -26,6 +26,15 @@ const { content } = creator.toIfc(); // IFC STEP text
26
26
 
27
27
  - Element builders: walls, slabs, columns, beams, stairs, roofs, doors, windows, ramps, railings, plates, members, footings, piles, spaces, curtain walls, furnishing, proxies, and parametric profile shapes (I, L, T, U, C, hollow sections)
28
28
  - Openings: `addIfcWallDoor` and `addIfcWallWindow` cut hosted doors and windows into walls
29
+ - Loaded-model hosted placement: `addHostedElementInStore(store, editor, hostId, spec)`
30
+ is the shared atomic operation behind viewer tools, SDK methods and MCP
31
+ `place_opening` / `place_door` / `place_window`. Wall cuts must fit and avoid
32
+ existing openings; unreadable bounds or placements are refused. Omitted
33
+ optional axes use IFC defaults; explicit missing, zero or parallel axes and
34
+ incomplete body/profile references are refused.
35
+ - Loaded-model wall joins: `joinWallsInStore` atomically rewrites wall bodies,
36
+ axes and `IfcRelConnectsPathElements`. Hosted openings must remain inside
37
+ both joined end faces; unreadable cuts refuse the join.
29
38
  - Property sets, element quantities, materials, and colors
30
39
  - 4D scheduling entities: IfcWorkSchedule, IfcTask, IfcRelSequence
31
40
  - In-store builders (`addWallToStore`, `addSlabToStore`, ...) that emit elements into an existing parsed model
@@ -59,7 +59,7 @@ export declare function detectEnclosedAreas(segments: Segment[], options?: Detec
59
59
  /**
60
60
  * Same pipeline as `detectEnclosedAreas`, but returns the per-stage
61
61
  * counts alongside the spaces so callers can surface diagnostic
62
- * information (used by the orchestrator + viewer Auto Spaces panel).
62
+ * information (used by the orchestrator + viewer Room tool).
63
63
  */
64
64
  export declare function detectEnclosedAreasWithStats(segments: Segment[], options?: DetectOptions): {
65
65
  spaces: DetectedSpace[];
@@ -10,7 +10,7 @@ export function detectEnclosedAreas(segments, options = {}) {
10
10
  /**
11
11
  * Same pipeline as `detectEnclosedAreas`, but returns the per-stage
12
12
  * counts alongside the spaces so callers can surface diagnostic
13
- * information (used by the orchestrator + viewer Auto Spaces panel).
13
+ * information (used by the orchestrator + viewer Room tool).
14
14
  */
15
15
  export function detectEnclosedAreasWithStats(segments, options = {}) {
16
16
  const snap = options.snapTolerance ?? DEFAULT_SNAP;
@@ -1,5 +1,6 @@
1
1
  import type { StoreEditor } from '@ifc-lite/mutations';
2
2
  import { type SpatialAnchor } from './anchor.js';
3
+ import { type ProfileSection } from './profile.js';
3
4
  export interface BeamInStoreParams {
4
5
  Start: [number, number, number];
5
6
  End: [number, number, number];
@@ -14,6 +15,14 @@ export interface BeamInStoreParams {
14
15
  /** Explicit GlobalId (22-char IFC GUID); generated when omitted. */
15
16
  GlobalId?: string;
16
17
  }
18
+ /**
19
+ * A beam with a parameterised cross-section (I, L, T, U, C, circle, hollow;
20
+ * see `ProfileSection`) in place of the `Width` x `Height` rectangle. The
21
+ * profile is centred on the axis; its Y is the beam's local Y.
22
+ */
23
+ export interface ProfiledBeamInStoreParams extends Omit<BeamInStoreParams, 'Width' | 'Height'> {
24
+ Profile: ProfileSection;
25
+ }
17
26
  export interface BeamBuildResult {
18
27
  beamId: number;
19
28
  placementId: number;
@@ -23,5 +32,5 @@ export interface BeamBuildResult {
23
32
  productShapeId: number;
24
33
  relContainedId: number;
25
34
  }
26
- export declare function addBeamToStore(editor: StoreEditor, anchor: SpatialAnchor, params: BeamInStoreParams): BeamBuildResult;
35
+ export declare function addBeamToStore(editor: StoreEditor, anchor: SpatialAnchor, params: BeamInStoreParams | ProfiledBeamInStoreParams): BeamBuildResult;
27
36
  //# sourceMappingURL=beam.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"beam.d.ts","sourceRoot":"","sources":["../../src/in-store/beam.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,EAAkC,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjF,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM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AC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAA0B,SAAQ,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC5F,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB;AAUD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,iBAAiB,GAAG,yBAAyB,GACpD,eAAe,CAiGjB"}
@@ -11,7 +11,8 @@
11
11
  * - local X = a stable perpendicular to the beam axis (chosen via
12
12
  * cross product against world up, falling back to world X for
13
13
  * near-vertical beams to avoid degenerate placements)
14
- * - cross-section = rectangle(Width × Height) centred on the axis
14
+ * - cross-section = rectangle(Width × Height) centred on the axis, or a
15
+ * parameterised `Profile` (I, L, T, U, C, circle, hollow; see profile.ts)
15
16
  * - extruded along local Z by the beam length
16
17
  *
17
18
  * Pure: no I/O, no parser access — operates entirely through the editor.
@@ -19,7 +20,8 @@
19
20
  import { generateIfcGuid } from '@ifc-lite/encoding';
20
21
  import { vecCross, vecNorm, assertFinitePoint3 } from '../ifc-creator-math.js';
21
22
  import { toNativeLength, toNativePoint3 } from './anchor.js';
22
- import { assertPositiveFinite, ownerHistoryRef, productGuid } from './_emit-helpers.js';
23
+ import { emitRectangleProfile, ownerHistoryRef, productGuid } from './_emit-helpers.js';
24
+ import { emitProfileSection, linearSection } from './profile.js';
23
25
  /**
24
26
  * Stable perpendicular to a beam axis. Mirrors IfcCreator.computeRefDirection.
25
27
  */
@@ -33,27 +35,20 @@ export function addBeamToStore(editor, anchor, params) {
33
35
  // `NaN <= 0` is false, so the distinct-points check below never fires.
34
36
  // Validate the source coordinates instead of trusting the derived value.
35
37
  assertFinitePoint3({ Start: params.Start, End: params.End }, 'addBeamToStore');
36
- // Params are metres; convert dimensioned fields to the file's native
37
- // length unit before emit (see SpatialAnchor.lengthUnitScale).
38
- params = {
39
- ...params,
40
- Start: toNativePoint3(anchor, params.Start),
41
- End: toNativePoint3(anchor, params.End),
42
- Width: toNativeLength(anchor, params.Width),
43
- Height: toNativeLength(anchor, params.Height),
44
- };
45
- const dx = params.End[0] - params.Start[0];
46
- const dy = params.End[1] - params.Start[1];
47
- const dz = params.End[2] - params.Start[2];
38
+ const start = toNativePoint3(anchor, params.Start);
39
+ const end = toNativePoint3(anchor, params.End);
40
+ const dx = end[0] - start[0];
41
+ const dy = end[1] - start[1];
42
+ const dz = end[2] - start[2];
48
43
  const beamLen = Math.sqrt(dx * dx + dy * dy + dz * dz);
49
44
  if (beamLen <= 0) {
50
45
  throw new Error('addBeamToStore: Start and End must be distinct points');
51
46
  }
52
- assertPositiveFinite([params.Width, params.Height], 'addBeamToStore: Width and Height must be positive');
47
+ const section = linearSection(anchor, params, 'addBeamToStore');
53
48
  const dir = vecNorm([dx, dy, dz]);
54
49
  const refDir = computeRefDirection(dir);
55
50
  // Placement at Start with local Z along the beam axis.
56
- const beamOriginPt = editor.addEntity('IfcCartesianPoint', [params.Start]).expressId;
51
+ const beamOriginPt = editor.addEntity('IfcCartesianPoint', [start]).expressId;
57
52
  const axisVec = editor.addEntity('IfcDirection', [dir]).expressId;
58
53
  const refDirVec = editor.addEntity('IfcDirection', [refDir]).expressId;
59
54
  const beamAxis = editor.addEntity('IfcAxis2Placement3D', [
@@ -66,15 +61,9 @@ export function addBeamToStore(editor, anchor, params) {
66
61
  `#${beamAxis}`,
67
62
  ]).expressId;
68
63
  // Cross-section centred on the axis.
69
- const profileOriginPt = editor.addEntity('IfcCartesianPoint', [[0, 0]]).expressId;
70
- const profilePos = editor.addEntity('IfcAxis2Placement2D', [`#${profileOriginPt}`, null]).expressId;
71
- const profileId = editor.addEntity('IfcRectangleProfileDef', [
72
- '.AREA.',
73
- null,
74
- `#${profilePos}`,
75
- params.Width,
76
- params.Height,
77
- ]).expressId;
64
+ const profileId = section.Profile
65
+ ? emitProfileSection(editor, anchor, section.Profile, 'addBeamToStore')
66
+ : emitRectangleProfile(editor, toNativeLength(anchor, section.Width), toNativeLength(anchor, section.Height));
78
67
  // Extrude along local Z (= beam direction) for the beam length.
79
68
  const solidOriginPt = editor.addEntity('IfcCartesianPoint', [[0, 0, 0]]).expressId;
80
69
  const solidAxis = editor.addEntity('IfcAxis2Placement3D', [`#${solidOriginPt}`, null, null]).expressId;
@@ -1 +1 @@
1
- {"version":3,"file":"beam.js","sourceRoot":"","sources":["../../src/in-store/beam.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AA2BxF;;GAEG;AACH,SAAS,mBAAmB,CAAC,IAAa;IACxC,MAAM,EAAE,GAAY,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAA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AI;QAC1B,MAAM,CAAC,UAAU,IAAI,IAAI;QACzB,IAAI,WAAW,EAAE;QACjB,IAAI,cAAc,EAAE;QACpB,MAAM,CAAC,GAAG,IAAI,IAAI;KACnB,CAAC;IACF,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC3C,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,SAAoD,CAAC,CAAC,SAAS,CAAC;IAE3G,MAAM,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,mCAAmC,EAAE;QAC3E,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC;QAClC,eAAe,CAAC,cAAc,CAAC;QAC/B,IAAI;QACJ,IAAI;QACJ,CAAC,IAAI,MAAM,EAAE,CAAC;QACd,IAAI,QAAQ,EAAE;KACf,CAAC,CAAC,SAAS,CAAC;IAEb,OAAO;QACL,MAAM;QACN,WAAW;QACX,SAAS;QACT,OAAO;QACP,UAAU;QACV,cAAc;QACd,cAAc;KACf,CAAC;AACJ,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { StoreEditor } from '@ifc-lite/mutations';
2
2
  import { type SpatialAnchor } from './anchor.js';
3
+ import { type ProfileSection } from './profile.js';
3
4
  export interface ColumnInStoreParams {
4
5
  /** Base centre of the column, in storey-local coordinates (metres). */
5
6
  Position: [number, number, number];
@@ -25,6 +26,14 @@ export interface ColumnInStoreParams {
25
26
  /** Explicit GlobalId (22-char IFC GUID); generated when omitted. */
26
27
  GlobalId?: string;
27
28
  }
29
+ /**
30
+ * A column with a parameterised cross-section (I, L, T, U, C, circle, hollow;
31
+ * see `ProfileSection`) in place of the `Width` x `Depth` rectangle, centred
32
+ * on `Position`; the profile's X runs along `RefDirection`.
33
+ */
34
+ export interface ProfiledColumnInStoreParams extends Omit<ColumnInStoreParams, 'Width' | 'Depth'> {
35
+ Profile: ProfileSection;
36
+ }
28
37
  /**
29
38
  * Result of `addColumnToStore` — the new column's expressId plus a
30
39
  * tap into the dependent entities for callers that want to e.g. apply
@@ -48,5 +57,5 @@ export interface ColumnBuildResult {
48
57
  * (look up IfcOwnerHistory, the 'Body' representation context, and the
49
58
  * target IfcBuildingStorey + its ObjectPlacement).
50
59
  */
51
- export declare function addColumnToStore(editor: StoreEditor, anchor: SpatialAnchor, params: ColumnInStoreParams): ColumnBuildResult;
60
+ export declare function addColumnToStore(editor: StoreEditor, anchor: SpatialAnchor, params: ColumnInStoreParams | ProfiledColumnInStoreParams): ColumnBuildResult;
52
61
  //# sourceMappingURL=column.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"column.d.ts","sourceRoot":"","sources":["../../src/in-store/column.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAkC,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAcjF,MAAM,WAAW,mBAAmB;IAClC,uEAAuE;IACvE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM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;IAC/F,OAAO,EAAE,cAAc,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,8EAA8E;IAC9E,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,mBAAmB,GAAG,2BAA2B,GACxD,iBAAiB,CAyGnB"}
@@ -17,7 +17,8 @@
17
17
  import { generateIfcGuid } from '@ifc-lite/encoding';
18
18
  import { assertFinitePoint3 } from '../ifc-creator-math.js';
19
19
  import { toNativeLength, toNativePoint3 } from './anchor.js';
20
- import { assertPositiveFinite, emitLocalPlacement, ownerHistoryRef, productGuid } from './_emit-helpers.js';
20
+ import { assertPositiveFinite, emitLocalPlacement, emitRectangleProfile, ownerHistoryRef, productGuid } from './_emit-helpers.js';
21
+ import { assertProfileSectionAuthorable, emitProfileSection } from './profile.js';
21
22
  /** A column's RefDirection: horizontal and unit length (it must be orthogonal to Axis +Z). */
22
23
  function columnRefDirection(ref) {
23
24
  if (ref === undefined)
@@ -40,31 +41,31 @@ function columnRefDirection(ref) {
40
41
  export function addColumnToStore(editor, anchor, params) {
41
42
  const { ownerHistoryId, bodyContextId, storeyId, storeyPlacementId } = anchor;
42
43
  assertFinitePoint3({ Position: params.Position }, 'addColumnToStore');
43
- assertPositiveFinite([params.Width, params.Depth, params.Height], 'addColumnToStore: Width, Depth, and Height must be finite positive numbers');
44
+ const section = params;
45
+ if (section.Profile !== undefined) {
46
+ if (section.Width !== undefined || section.Depth !== undefined) {
47
+ throw new Error('addColumnToStore: give either Width and Depth or a Profile, not both');
48
+ }
49
+ assertPositiveFinite([params.Height], 'addColumnToStore: Height must be a finite positive number');
50
+ assertProfileSectionAuthorable(anchor, section.Profile, 'addColumnToStore');
51
+ }
52
+ else {
53
+ assertPositiveFinite([section.Width, section.Depth, params.Height], 'addColumnToStore: Width, Depth, and Height must be finite positive numbers');
54
+ }
44
55
  const refDirection = columnRefDirection(params.RefDirection);
45
56
  // Params are metres; convert dimensioned fields to the file's native
46
57
  // length unit before emit (see SpatialAnchor.lengthUnitScale).
47
- params = {
48
- ...params,
49
- Position: toNativePoint3(anchor, params.Position),
50
- Width: toNativeLength(anchor, params.Width),
51
- Depth: toNativeLength(anchor, params.Depth),
52
- Height: toNativeLength(anchor, params.Height),
53
- };
58
+ const position = toNativePoint3(anchor, params.Position);
59
+ const height = toNativeLength(anchor, params.Height);
54
60
  // Local placement chain: IfcCartesianPoint → IfcAxis2Placement3D (explicit
55
61
  // Axis + RefDirection) → IfcLocalPlacement (parent = storey placement).
56
- const placementId = emitLocalPlacement(editor, storeyPlacementId, params.Position, [0, 0, 1], refDirection);
57
- // Rectangle profile centred at origin: IfcCartesianPoint(0,0) →
58
- // IfcAxis2Placement2D → IfcRectangleProfileDef.
59
- const profileOriginPt = editor.addEntity('IfcCartesianPoint', [[0, 0]]).expressId;
60
- const profilePos = editor.addEntity('IfcAxis2Placement2D', [`#${profileOriginPt}`, null]).expressId;
61
- const profileId = editor.addEntity('IfcRectangleProfileDef', [
62
- '.AREA.',
63
- null,
64
- `#${profilePos}`,
65
- params.Width,
66
- params.Depth,
67
- ]).expressId;
62
+ const placementId = emitLocalPlacement(editor, storeyPlacementId, position, [0, 0, 1], refDirection);
63
+ // Cross-section centred at the origin: the Width x Depth rectangle
64
+ // (IfcCartesianPoint(0,0) → IfcAxis2Placement2D → IfcRectangleProfileDef)
65
+ // or the parameterised profile.
66
+ const profileId = section.Profile !== undefined
67
+ ? emitProfileSection(editor, anchor, section.Profile, 'addColumnToStore')
68
+ : emitRectangleProfile(editor, toNativeLength(anchor, section.Width), toNativeLength(anchor, section.Depth));
68
69
  // Extruded solid: another local origin point, axis placement, +Z direction,
69
70
  // then IfcExtrudedAreaSolid(Profile, Position, ExtrudedDirection, Depth).
70
71
  const solidOriginPt = editor.addEntity('IfcCartesianPoint', [[0, 0, 0]]).expressId;
@@ -74,7 +75,7 @@ export function addColumnToStore(editor, anchor, params) {
74
75
  `#${profileId}`,
75
76
  `#${solidAxis}`,
76
77
  `#${extrudeDirection}`,
77
- params.Height,
78
+ height,
78
79
  ]).expressId;
79
80
  // Shape representation in the Body context, then product shape.
80
81
  const shapeRepId = editor.addEntity('IfcShapeRepresentation', [
@@ -1 +1 @@
1
- {"version":3,"file":"column.js","sourceRoot":"","sources":["../../src/in-store/column.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE5G,8FAA8F;AAC9F,SAAS,kBAAkB,CAAC,GAAyC;IACnE,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;IACtB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAA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ChD,MAAM,WAAW,GAAmB;QAClC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC;QACtC,eAAe,CAAC,cAAc,CAAC;QAC/B,MAAM,CAAC,IAAI,IAAI,QAAQ;QACvB,MAAM,CAAC,WAAW,IAAI,IAAI;QAC1B,MAAM,CAAC,UAAU,IAAI,IAAI;QACzB,IAAI,WAAW,EAAE;QACjB,IAAI,cAAc,EAAE;QACpB,MAAM,CAAC,GAAG,IAAI,IAAI;KACnB,CAAC;IACF,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC3C,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC/B,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,WAAsD,CAAC,CAAC,SAAS,CAAC;IAEjH,sEAAsE;IACtE,uEAAuE;IACvE,4DAA4D;IAC5D,MAAM,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,mCAAmC,EAAE;QAC3E,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC;QAClC,eAAe,CAAC,cAAc,CAAC;QAC/B,IAAI;QACJ,IAAI;QACJ,CAAC,IAAI,QAAQ,EAAE,CAAC;QAChB,IAAI,QAAQ,EAAE;KACf,CAAC,CAAC,SAAS,CAAC;IAEb,OAAO;QACL,QAAQ;QACR,WAAW;QACX,SAAS;QACT,OAAO;QACP,UAAU;QACV,cAAc;QACd,cAAc;KACf,CAAC;AACJ,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The placement arithmetic behind copying a product (#6232 C3): an
3
+ * `IfcLocalPlacement` read as a rigid frame (a turn about the vertical plus
4
+ * a translation, in the file's native length unit), composed up to the
5
+ * storey's own placement, and the copy's turn-and-move applied to it.
6
+ *
7
+ * Frames here turn about the vertical only: a placement whose Axis is tilted
8
+ * contributes its RefDirection's plan projection, as every storey-local
9
+ * reader in this package does (`placement-frame.ts`).
10
+ */
11
+ import type { IfcAttributeValue } from '@ifc-lite/mutations';
12
+ export type CopyVec3 = [number, number, number];
13
+ /** A read of one live record (`createStyleEntityReader`). */
14
+ export type LiveRead = (id: number) => {
15
+ type: string;
16
+ attributes: readonly unknown[];
17
+ } | null;
18
+ /** `p ↦ R(c, s)·p + origin`; `z` just adds. */
19
+ export interface RigidFrame {
20
+ readonly origin: CopyVec3;
21
+ readonly c: number;
22
+ readonly s: number;
23
+ }
24
+ export declare const IDENTITY_FRAME: RigidFrame;
25
+ export declare function applyRigid(f: RigidFrame, p: readonly number[]): CopyVec3;
26
+ export declare function composeRigid(outer: RigidFrame, inner: RigidFrame): RigidFrame;
27
+ export declare function invertRigid(f: RigidFrame): RigidFrame;
28
+ /** The turn about the vertical through `pivot`, then the move `offset`: one rigid frame. */
29
+ export declare function turnThenMove(turn: number, pivot: readonly [number, number], offset: readonly number[]): RigidFrame;
30
+ export declare function numberTriple(value: unknown): CopyVec3 | null;
31
+ export interface OwnPlacement {
32
+ readonly frame: RigidFrame;
33
+ readonly parentId: number | null;
34
+ readonly location: CopyVec3;
35
+ readonly axis: CopyVec3 | null;
36
+ readonly refDirection: CopyVec3 | null;
37
+ }
38
+ /** One `IfcLocalPlacement`'s own frame in its parent's, or null when a link does not read. */
39
+ export declare function readOwnPlacement(read: LiveRead, placementId: number): OwnPlacement | null;
40
+ /**
41
+ * The frame of `placementId` in `ancestorId`'s frame: every placement from it
42
+ * up to (not including) the ancestor, composed. `placementId === ancestorId`
43
+ * is the identity. Null when the chain does not reach the ancestor (or loops).
44
+ */
45
+ export declare function frameInAncestor(read: LiveRead, placementId: number | null, ancestorId: number): RigidFrame | null;
46
+ /** `v` turned counter-clockwise about the vertical by the frame's turn (directions do not translate). */
47
+ export declare function turnDirection(f: Pick<RigidFrame, 'c' | 's'>, v: CopyVec3): CopyVec3;
48
+ /** A `#N` reference token, or null. */
49
+ export declare function refToken(id: number | null): string | null;
50
+ /** Rewrite every `#old` token in a (possibly nested) attribute value that `ids` maps. */
51
+ export declare function remapRefs(value: unknown, ids: ReadonlyMap<number, number>): IfcAttributeValue;
52
+ //# sourceMappingURL=copy-frame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-frame.d.ts","sourceRoot":"","sources":["../../src/in-store/copy-frame.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,MAAM,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEhD,6DAA6D;AAC7D,MAAM,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE,GAAG,IAAI,CAAC;AAE/F,+CAA+C;AAC/C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,EAAE,UAA8C,CAAC;AAE5E,wBAAgB,UAAU,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,QAAQ,CAExE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,UAAU,CAM7E;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU,CAGrD;AAED,4FAA4F;AAC5F,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,CASlH;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,IAAI,CAI5D;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,QAAQ,GAAG,IAAI,CAAC;CACxC;AAED,8FAA8F;AAC9F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAkBzF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAajH;AAED,yGAAyG;AACzG,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAEnF;AAED,uCAAuC;AACvC,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAEzD;AAED,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,iBAAiB,CAQ7F"}
@@ -0,0 +1,99 @@
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 { asRef } from './style-entity-reader.js';
5
+ export const IDENTITY_FRAME = { origin: [0, 0, 0], c: 1, s: 0 };
6
+ export function applyRigid(f, p) {
7
+ return [f.origin[0] + f.c * p[0] - f.s * p[1], f.origin[1] + f.s * p[0] + f.c * p[1], f.origin[2] + (p[2] ?? 0)];
8
+ }
9
+ export function composeRigid(outer, inner) {
10
+ return {
11
+ origin: applyRigid(outer, inner.origin),
12
+ c: outer.c * inner.c - outer.s * inner.s,
13
+ s: outer.s * inner.c + outer.c * inner.s,
14
+ };
15
+ }
16
+ export function invertRigid(f) {
17
+ const [x, y, z] = f.origin;
18
+ return { origin: [-(f.c * x + f.s * y), -(-f.s * x + f.c * y), -z], c: f.c, s: -f.s };
19
+ }
20
+ /** The turn about the vertical through `pivot`, then the move `offset`: one rigid frame. */
21
+ export function turnThenMove(turn, pivot, offset) {
22
+ const c = Math.cos(turn);
23
+ const s = Math.sin(turn);
24
+ // q = R(p - pivot) + pivot + offset = R p + (pivot - R pivot + offset)
25
+ return {
26
+ origin: [pivot[0] - (c * pivot[0] - s * pivot[1]) + offset[0], pivot[1] - (s * pivot[0] + c * pivot[1]) + offset[1], offset[2] ?? 0],
27
+ c,
28
+ s,
29
+ };
30
+ }
31
+ export function numberTriple(value) {
32
+ if (!Array.isArray(value) || value.length < 2)
33
+ return null;
34
+ const out = [0, 0, 0].map((_, i) => (i < value.length ? value[i] : 0));
35
+ return out.every((v) => typeof v === 'number' && Number.isFinite(v)) ? out : null;
36
+ }
37
+ /** One `IfcLocalPlacement`'s own frame in its parent's, or null when a link does not read. */
38
+ export function readOwnPlacement(read, placementId) {
39
+ const placement = read(placementId);
40
+ const axisPlacementId = asRef(placement?.attributes[1]);
41
+ const axisPlacement = axisPlacementId === null ? null : read(axisPlacementId);
42
+ if (!placement || !axisPlacement)
43
+ return null;
44
+ const locationId = asRef(axisPlacement.attributes[0]);
45
+ const location = locationId === null ? null : numberTriple(read(locationId)?.attributes[0]);
46
+ if (!location)
47
+ return null;
48
+ const direction = (slot) => {
49
+ const id = asRef(slot);
50
+ return id === null ? null : numberTriple(read(id)?.attributes[0]);
51
+ };
52
+ const axis = direction(axisPlacement.attributes[1]);
53
+ const refDirection = direction(axisPlacement.attributes[2]);
54
+ const [dx, dy] = refDirection ?? [1, 0, 0];
55
+ const length = Math.hypot(dx, dy);
56
+ const [c, s] = length > 1e-9 ? [dx / length, dy / length] : [1, 0];
57
+ return { frame: { origin: location, c, s }, parentId: asRef(placement.attributes[0]), location, axis, refDirection };
58
+ }
59
+ /**
60
+ * The frame of `placementId` in `ancestorId`'s frame: every placement from it
61
+ * up to (not including) the ancestor, composed. `placementId === ancestorId`
62
+ * is the identity. Null when the chain does not reach the ancestor (or loops).
63
+ */
64
+ export function frameInAncestor(read, placementId, ancestorId) {
65
+ let frame = IDENTITY_FRAME;
66
+ const visited = new Set();
67
+ let id = placementId;
68
+ while (id !== null && id !== ancestorId) {
69
+ if (visited.has(id))
70
+ return null;
71
+ visited.add(id);
72
+ const own = readOwnPlacement(read, id);
73
+ if (!own)
74
+ return null;
75
+ frame = composeRigid(own.frame, frame);
76
+ id = own.parentId;
77
+ }
78
+ return id === ancestorId ? frame : null;
79
+ }
80
+ /** `v` turned counter-clockwise about the vertical by the frame's turn (directions do not translate). */
81
+ export function turnDirection(f, v) {
82
+ return [f.c * v[0] - f.s * v[1], f.s * v[0] + f.c * v[1], v[2]];
83
+ }
84
+ /** A `#N` reference token, or null. */
85
+ export function refToken(id) {
86
+ return id === null ? null : `#${id}`;
87
+ }
88
+ /** Rewrite every `#old` token in a (possibly nested) attribute value that `ids` maps. */
89
+ export function remapRefs(value, ids) {
90
+ if (Array.isArray(value))
91
+ return value.map((v) => remapRefs(v, ids));
92
+ if (typeof value === 'string') {
93
+ const id = asRef(value);
94
+ const mapped = id === null ? undefined : ids.get(id);
95
+ return mapped === undefined ? value : `#${mapped}`;
96
+ }
97
+ return value;
98
+ }
99
+ //# sourceMappingURL=copy-frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-frame.js","sourceRoot":"","sources":["../../src/in-store/copy-frame.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAc/D,OAAO,EAAE,KAAK,EAAE,MAAM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CAAC,CAAC;QACrD,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC;IACrD,CAAC;IACD,OAAO,KAA0B,CAAC;AACpC,CAAC"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Copy a product, turned and moved, onto its own storey or another one
3
+ * (#6232 C3, decision D7): the one write behind the Model workspace's paste
4
+ * and array, built on `duplicateInStore`.
5
+ *
6
+ * - Every copy gets fresh GlobalIds (the product, its placement's rels).
7
+ * - The openings that void the product and the doors and windows that fill
8
+ * them are copied with it, and the IfcRelVoidsElement / IfcRelFillsElement
9
+ * are written again between the copies. One placed relative to its host
10
+ * (or its opening) keeps its local placement under the copy's.
11
+ * - A shape created this session is copied record by record (with the
12
+ * styles on its items), so the copy can be reshaped on its own. A shape
13
+ * read from the file is shared by reference, as Duplicate has always
14
+ * done.
15
+ *
16
+ * The turn and move are storey-local metres: a turn counter-clockwise about
17
+ * the vertical through `pivot`, then `offset`. On another storey the copy is
18
+ * placed relative to that storey's placement at the same plan position and
19
+ * height above the floor.
20
+ */
21
+ import { type StoreEditor } from '@ifc-lite/mutations';
22
+ import type { IfcDataStore } from '@ifc-lite/parser';
23
+ import { type RandomSource } from '@ifc-lite/encoding';
24
+ import { type CopyVec3, type LiveRead } from './copy-frame.js';
25
+ export interface CopyTransform {
26
+ /** Move after the turn, storey-local metres (IFC Z-up). */
27
+ readonly offset?: readonly [number, number, number];
28
+ /** Counter-clockwise turn about the vertical, radians. */
29
+ readonly turn?: number;
30
+ /** The plan point the turn is about, storey-local metres. Default: the storey origin. */
31
+ readonly pivot?: readonly [number, number];
32
+ /** The storey the copy goes on. Default: the source's own. */
33
+ readonly targetStoreyId?: number;
34
+ }
35
+ export interface CopyProductResult {
36
+ /** The copy of the product itself. */
37
+ readonly copyId: number;
38
+ readonly openingIds: readonly number[];
39
+ readonly fillingIds: readonly number[];
40
+ /** The copies of the assembly's parts, at every depth. */
41
+ readonly partIds: readonly number[];
42
+ /** Source product id for every copied product, including openings, fillings and assembly parts. */
43
+ readonly copiedFrom: ReadonlyMap<number, number>;
44
+ /** The storey the copy (and its doors and windows) is contained in. */
45
+ readonly storeyId: number | null;
46
+ /** Every element the copy wrote with a shape to mesh: the copy and its doors and windows. */
47
+ readonly meshed: readonly number[];
48
+ }
49
+ interface HostedLink {
50
+ readonly id: number;
51
+ readonly ownerHistory: string | null;
52
+ }
53
+ /** One IfcRelAggregates: the parts of an assembly, and the rel's OwnerHistory. */
54
+ interface PartsLink {
55
+ readonly ownerHistory: string | null;
56
+ readonly parts: readonly number[];
57
+ }
58
+ /**
59
+ * Everything one batch of copies reads once: the live reader, the styles and
60
+ * the void / fill links of the model as it was before the batch.
61
+ */
62
+ export interface CopyContext {
63
+ readonly store: IfcDataStore;
64
+ readonly editor: StoreEditor;
65
+ readonly read: LiveRead;
66
+ readonly guidRandom?: RandomSource;
67
+ readonly styledBy: ReadonlyMap<number, number>;
68
+ readonly voids: ReadonlyMap<number, readonly HostedLink[]>;
69
+ readonly fills: ReadonlyMap<number, readonly HostedLink[]>;
70
+ /** Fillings (door / window id → opening id). */
71
+ readonly filledBy: ReadonlyMap<number, number>;
72
+ /** Assembly id → its IfcRelAggregates parts (a spatial container's children are not parts). */
73
+ readonly parts: ReadonlyMap<number, readonly PartsLink[]>;
74
+ /** Part id → its assembly. */
75
+ readonly partOf: ReadonlyMap<number, number>;
76
+ }
77
+ export declare function createCopyContext(store: IfcDataStore, editor: StoreEditor, options?: {
78
+ guidRandom?: RandomSource;
79
+ }): CopyContext;
80
+ /** Why `sourceId` cannot be copied on its own, or null when it can. */
81
+ export declare function copyRefusal(ctx: CopyContext, sourceId: number): string | null;
82
+ /** Copy the complete product graph. `options.Name` overrides only the root product’s Name. */
83
+ export declare function copyProductInStore(ctx: CopyContext, sourceId: number, transform?: CopyTransform, options?: {
84
+ Name?: string;
85
+ }): CopyProductResult;
86
+ /**
87
+ * Where a product's placement origin is on its storey, metres: the point a
88
+ * paste lines up with the cursor. Null when its placement does not read;
89
+ * throws (with the reason) when it is not tied to its storey, as a copy would.
90
+ */
91
+ export declare function productStoreyOrigin(ctx: CopyContext, id: number): {
92
+ storeyId: number | null;
93
+ origin: CopyVec3;
94
+ } | null;
95
+ export {};
96
+ //# sourceMappingURL=copy-product.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-product.d.ts","sourceRoot":"","sources":["../../src/in-store/copy-product.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAqD,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIxE,OAAO,EAGL,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAC7B,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,aAAa;IAC5B,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpD,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,yFAAyF;IACzF,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,8DAA8D;IAC9D,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,mGA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