@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.
- package/README.md +9 -0
- package/dist/in-store/auto-space-detect.d.ts +1 -1
- package/dist/in-store/auto-space-detect.js +1 -1
- package/dist/in-store/beam.d.ts +10 -1
- package/dist/in-store/beam.d.ts.map +1 -1
- package/dist/in-store/beam.js +14 -25
- package/dist/in-store/beam.js.map +1 -1
- package/dist/in-store/column.d.ts +10 -1
- package/dist/in-store/column.d.ts.map +1 -1
- package/dist/in-store/column.js +23 -22
- package/dist/in-store/column.js.map +1 -1
- package/dist/in-store/copy-frame.d.ts +52 -0
- package/dist/in-store/copy-frame.d.ts.map +1 -0
- package/dist/in-store/copy-frame.js +99 -0
- package/dist/in-store/copy-frame.js.map +1 -0
- package/dist/in-store/copy-product.d.ts +96 -0
- package/dist/in-store/copy-product.d.ts.map +1 -0
- package/dist/in-store/copy-product.js +318 -0
- package/dist/in-store/copy-product.js.map +1 -0
- package/dist/in-store/curtain-wall.d.ts +87 -0
- package/dist/in-store/curtain-wall.d.ts.map +1 -0
- package/dist/in-store/curtain-wall.js +237 -0
- package/dist/in-store/curtain-wall.js.map +1 -0
- package/dist/in-store/extract-grids.d.ts +46 -0
- package/dist/in-store/extract-grids.d.ts.map +1 -0
- package/dist/in-store/extract-grids.js +211 -0
- package/dist/in-store/extract-grids.js.map +1 -0
- package/dist/in-store/extract-walls.d.ts +12 -23
- package/dist/in-store/extract-walls.d.ts.map +1 -1
- package/dist/in-store/extract-walls.js +6 -69
- package/dist/in-store/extract-walls.js.map +1 -1
- package/dist/in-store/generate-spaces.d.ts +1 -1
- package/dist/in-store/grid.d.ts +118 -0
- package/dist/in-store/grid.d.ts.map +1 -0
- package/dist/in-store/grid.js +194 -0
- package/dist/in-store/grid.js.map +1 -0
- package/dist/in-store/host-geometry-frame.d.ts +44 -0
- package/dist/in-store/host-geometry-frame.d.ts.map +1 -0
- package/dist/in-store/host-geometry-frame.js +146 -0
- package/dist/in-store/host-geometry-frame.js.map +1 -0
- package/dist/in-store/hosted-element-edit.d.ts +29 -0
- package/dist/in-store/hosted-element-edit.d.ts.map +1 -0
- package/dist/in-store/hosted-element-edit.js +120 -0
- package/dist/in-store/hosted-element-edit.js.map +1 -0
- package/dist/in-store/hosted-element.d.ts +41 -0
- package/dist/in-store/hosted-element.d.ts.map +1 -0
- package/dist/in-store/hosted-element.js +124 -0
- package/dist/in-store/hosted-element.js.map +1 -0
- package/dist/in-store/hosted-fill-read.d.ts +56 -0
- package/dist/in-store/hosted-fill-read.d.ts.map +1 -0
- package/dist/in-store/hosted-fill-read.js +197 -0
- package/dist/in-store/hosted-fill-read.js.map +1 -0
- package/dist/in-store/hosted-global-id.d.ts +8 -0
- package/dist/in-store/hosted-global-id.d.ts.map +1 -0
- package/dist/in-store/hosted-global-id.js +53 -0
- package/dist/in-store/hosted-global-id.js.map +1 -0
- package/dist/in-store/hosted-placement-edit.d.ts +30 -0
- package/dist/in-store/hosted-placement-edit.d.ts.map +1 -0
- package/dist/in-store/hosted-placement-edit.js +123 -0
- package/dist/in-store/hosted-placement-edit.js.map +1 -0
- package/dist/in-store/hosted-scale-chain.d.ts +12 -0
- package/dist/in-store/hosted-scale-chain.d.ts.map +1 -0
- package/dist/in-store/hosted-scale-chain.js +74 -0
- package/dist/in-store/hosted-scale-chain.js.map +1 -0
- package/dist/in-store/hosted-shape-edit.d.ts +9 -0
- package/dist/in-store/hosted-shape-edit.d.ts.map +1 -0
- package/dist/in-store/hosted-shape-edit.js +79 -0
- package/dist/in-store/hosted-shape-edit.js.map +1 -0
- package/dist/in-store/index.d.ts +59 -0
- package/dist/in-store/index.d.ts.map +1 -0
- package/dist/in-store/index.js +64 -0
- package/dist/in-store/index.js.map +1 -0
- package/dist/in-store/member.d.ts +8 -2
- package/dist/in-store/member.d.ts.map +1 -1
- package/dist/in-store/member.js +12 -14
- package/dist/in-store/member.js.map +1 -1
- package/dist/in-store/placement-frame.d.ts +9 -4
- package/dist/in-store/placement-frame.d.ts.map +1 -1
- package/dist/in-store/placement-frame.js +20 -35
- package/dist/in-store/placement-frame.js.map +1 -1
- package/dist/in-store/profile.d.ts +141 -0
- package/dist/in-store/profile.d.ts.map +1 -0
- package/dist/in-store/profile.js +174 -0
- package/dist/in-store/profile.js.map +1 -0
- package/dist/in-store/railing.d.ts +65 -0
- package/dist/in-store/railing.d.ts.map +1 -0
- package/dist/in-store/railing.js +112 -0
- package/dist/in-store/railing.js.map +1 -0
- package/dist/in-store/rel-connects-path.d.ts +43 -0
- package/dist/in-store/rel-connects-path.d.ts.map +1 -0
- package/dist/in-store/rel-connects-path.js +65 -0
- package/dist/in-store/rel-connects-path.js.map +1 -0
- package/dist/in-store/resolve-host.d.ts +12 -1
- package/dist/in-store/resolve-host.d.ts.map +1 -1
- package/dist/in-store/resolve-host.js +169 -85
- package/dist/in-store/resolve-host.js.map +1 -1
- package/dist/in-store/resolve-source.d.ts.map +1 -1
- package/dist/in-store/resolve-source.js +39 -59
- package/dist/in-store/resolve-source.js.map +1 -1
- package/dist/in-store/schema-attributes.d.ts +5 -0
- package/dist/in-store/schema-attributes.d.ts.map +1 -1
- package/dist/in-store/schema-attributes.js +9 -2
- package/dist/in-store/schema-attributes.js.map +1 -1
- package/dist/in-store/space-footprints.d.ts +55 -0
- package/dist/in-store/space-footprints.d.ts.map +1 -0
- package/dist/in-store/space-footprints.js +260 -0
- package/dist/in-store/space-footprints.js.map +1 -0
- package/dist/in-store/space.d.ts.map +1 -1
- package/dist/in-store/space.js +15 -3
- package/dist/in-store/space.js.map +1 -1
- package/dist/in-store/spatial-children.d.ts +1 -1
- package/dist/in-store/spatial-children.js +1 -1
- package/dist/in-store/stair-edit.d.ts +24 -0
- package/dist/in-store/stair-edit.d.ts.map +1 -0
- package/dist/in-store/stair-edit.js +190 -0
- package/dist/in-store/stair-edit.js.map +1 -0
- package/dist/in-store/stair.d.ts +58 -0
- package/dist/in-store/stair.d.ts.map +1 -0
- package/dist/in-store/stair.js +156 -0
- package/dist/in-store/stair.js.map +1 -0
- package/dist/in-store/wall-join-apply.d.ts +74 -0
- package/dist/in-store/wall-join-apply.d.ts.map +1 -0
- package/dist/in-store/wall-join-apply.js +137 -0
- package/dist/in-store/wall-join-apply.js.map +1 -0
- package/dist/in-store/wall-join-edit.d.ts +70 -0
- package/dist/in-store/wall-join-edit.d.ts.map +1 -0
- package/dist/in-store/wall-join-edit.js +217 -0
- package/dist/in-store/wall-join-edit.js.map +1 -0
- package/dist/in-store/wall-join-read.d.ts +60 -0
- package/dist/in-store/wall-join-read.d.ts.map +1 -0
- package/dist/in-store/wall-join-read.js +230 -0
- package/dist/in-store/wall-join-read.js.map +1 -0
- package/dist/in-store/wall-join.d.ts +122 -0
- package/dist/in-store/wall-join.d.ts.map +1 -0
- package/dist/in-store/wall-join.js +231 -0
- package/dist/in-store/wall-join.js.map +1 -0
- package/dist/in-store/wall-opening-fit.d.ts +11 -0
- package/dist/in-store/wall-opening-fit.d.ts.map +1 -0
- package/dist/in-store/wall-opening-fit.js +27 -0
- package/dist/in-store/wall-opening-fit.js.map +1 -0
- package/dist/in-store/wall.d.ts +32 -0
- package/dist/in-store/wall.d.ts.map +1 -1
- package/dist/in-store/wall.js +77 -13
- package/dist/in-store/wall.js.map +1 -1
- package/dist/index.d.ts +1 -38
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -40
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,137 @@
|
|
|
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 { relConnectsPathElementsAttributes } from './rel-connects-path.js';
|
|
5
|
+
import { schemaRegistry } from './schema-attributes.js';
|
|
6
|
+
import { emitWallAxisRepresentation, emitWallBodyProfile, wallJoinWallFromParams } from './wall.js';
|
|
7
|
+
import { computeWallJoin } from './wall-join.js';
|
|
8
|
+
/** The join target for a wall `addWallToStore` just built from `params`. */
|
|
9
|
+
export function wallJoinTargetFromBuild(build, params) {
|
|
10
|
+
return {
|
|
11
|
+
wallId: build.wallId,
|
|
12
|
+
solidId: build.solidId,
|
|
13
|
+
profileId: build.profileId,
|
|
14
|
+
productShapeId: build.productShapeId,
|
|
15
|
+
representationIds: build.axisRepId === null ? [build.shapeRepId] : [build.shapeRepId, build.axisRepId],
|
|
16
|
+
axisRepId: build.axisRepId,
|
|
17
|
+
origin: [params.Start[0], params.Start[1]],
|
|
18
|
+
wall: wallJoinWallFromParams(params),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Join walls `a` and `b` in the store. See `computeWallJoin` for the geometry
|
|
23
|
+
* and `options`. Refuses IFC5 / IFCX anchors; IFC2X3, IFC4 and IFC4X3 are
|
|
24
|
+
* written by their own attribute layouts.
|
|
25
|
+
*/
|
|
26
|
+
export function applyWallJoinToStore(editor, anchor, a, b, options = {}) {
|
|
27
|
+
const op = 'applyWallJoinToStore';
|
|
28
|
+
schemaRegistry(anchor.schema, op);
|
|
29
|
+
if (a.wallId === b.wallId)
|
|
30
|
+
throw new Error(`${op}: a wall cannot join itself`);
|
|
31
|
+
for (const target of [a, b]) {
|
|
32
|
+
for (const id of [target.wallId, target.solidId, target.profileId, target.productShapeId]) {
|
|
33
|
+
if (!editor.hasEntity(id))
|
|
34
|
+
throw new Error(`${op}: #${id} of wall #${target.wallId} is not a live entity`);
|
|
35
|
+
}
|
|
36
|
+
if (editor.getEntityType(target.solidId)?.toUpperCase() !== 'IFCEXTRUDEDAREASOLID') {
|
|
37
|
+
throw new Error(`${op}: wall #${target.wallId} body #${target.solidId} is not an IfcExtrudedAreaSolid`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Everything that can refuse runs before the first write: the geometry, then
|
|
41
|
+
// the relationship's attributes (schema layout, element classes, OwnerHistory).
|
|
42
|
+
const join = computeWallJoin(a.wall, b.wall, options);
|
|
43
|
+
const relatingIsA = join.relating === 'a';
|
|
44
|
+
const [relating, related] = relatingIsA ? [join.a, join.b] : [join.b, join.a];
|
|
45
|
+
const relAttributes = relConnectsPathElementsAttributes(editor, anchor, {
|
|
46
|
+
RelatingElement: (relatingIsA ? a : b).wallId,
|
|
47
|
+
RelatedElement: (relatingIsA ? b : a).wallId,
|
|
48
|
+
RelatingConnectionType: relating.connection,
|
|
49
|
+
RelatedConnectionType: related.connection,
|
|
50
|
+
RelatingPriorities: relatingIsA ? options.priorities?.a : options.priorities?.b,
|
|
51
|
+
RelatedPriorities: relatingIsA ? options.priorities?.b : options.priorities?.a,
|
|
52
|
+
Name: options.Name,
|
|
53
|
+
}, op);
|
|
54
|
+
// The through wall of a T keeps its body; it only gains an Axis if it has none,
|
|
55
|
+
// so every joined wall carries one.
|
|
56
|
+
const nextA = join.a.connection === 'ATPATH' ? ensureAxis(editor, anchor, a) : rewriteWall(editor, anchor, a, join.a.wall);
|
|
57
|
+
const nextB = join.b.connection === 'ATPATH' ? ensureAxis(editor, anchor, b) : rewriteWall(editor, anchor, b, join.b.wall);
|
|
58
|
+
const relId = editor.addEntity('IfcRelConnectsPathElements', relAttributes).expressId;
|
|
59
|
+
return { join, relId, a: nextA, b: nextB };
|
|
60
|
+
}
|
|
61
|
+
/** Where plan point `p` sits along the wall frame's X, metres from the placement origin. */
|
|
62
|
+
function alongFrame(target, p) {
|
|
63
|
+
const { start, end } = target.wall;
|
|
64
|
+
const length = Math.hypot(end[0] - start[0], end[1] - start[1]);
|
|
65
|
+
return ((p[0] - target.origin[0]) * (end[0] - start[0]) + (p[1] - target.origin[1]) * (end[1] - start[1])) / length;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Give `target` the body and `Axis` of `wall`, written in the frame of the
|
|
69
|
+
* placement at `target.origin` (`wall`'s axis runs along that frame's +X).
|
|
70
|
+
*/
|
|
71
|
+
export function rewriteWall(editor, anchor, target, wall) {
|
|
72
|
+
const startX = alongFrame(target, wall.start);
|
|
73
|
+
const endX = alongFrame(target, wall.end);
|
|
74
|
+
const profileId = emitWallBodyProfile(editor, anchor, wall, startX);
|
|
75
|
+
editor.setPositionalAttribute(target.solidId, 0, `#${profileId}`);
|
|
76
|
+
removeOverlayProfile(editor, target.profileId);
|
|
77
|
+
return { ...writeAxis(editor, anchor, target, startX, endX), profileId, wall };
|
|
78
|
+
}
|
|
79
|
+
/** Replace the wall's Axis representation (or append one) with `startX..endX` in its frame. */
|
|
80
|
+
function writeAxis(editor, anchor, target, startX, endX) {
|
|
81
|
+
const axisRepId = emitWallAxisRepresentation(editor, anchor, startX, endX);
|
|
82
|
+
const representationIds = target.axisRepId !== null && target.representationIds.includes(target.axisRepId)
|
|
83
|
+
? target.representationIds.map((id) => (id === target.axisRepId ? axisRepId : id))
|
|
84
|
+
: [...target.representationIds, axisRepId];
|
|
85
|
+
editor.setPositionalAttribute(target.productShapeId, 2, representationIds.map((id) => `#${id}`));
|
|
86
|
+
if (target.axisRepId !== null)
|
|
87
|
+
removeOverlayAxis(editor, target.axisRepId);
|
|
88
|
+
return { ...target, representationIds, axisRepId };
|
|
89
|
+
}
|
|
90
|
+
/** A wall the join leaves as it is: give it an Axis when it has none. */
|
|
91
|
+
function ensureAxis(editor, anchor, target) {
|
|
92
|
+
if (target.axisRepId !== null)
|
|
93
|
+
return { ...target };
|
|
94
|
+
return writeAxis(editor, anchor, target, alongFrame(target, target.wall.start), alongFrame(target, target.wall.end));
|
|
95
|
+
}
|
|
96
|
+
function refId(value) {
|
|
97
|
+
return typeof value === 'string' && /^#\d+$/.test(value) ? Number(value.slice(1)) : null;
|
|
98
|
+
}
|
|
99
|
+
/** Remove overlay entity `id` when it is one of `types`; returns its attributes, else null. */
|
|
100
|
+
function removeOverlay(editor, id, types) {
|
|
101
|
+
if (id === null)
|
|
102
|
+
return null;
|
|
103
|
+
const entity = editor.getNewEntity(id);
|
|
104
|
+
const type = editor.getEntityType(id)?.toUpperCase();
|
|
105
|
+
if (!entity || !types.some((t) => t.toUpperCase() === type))
|
|
106
|
+
return null;
|
|
107
|
+
editor.removeEntity(id);
|
|
108
|
+
return entity.attributes;
|
|
109
|
+
}
|
|
110
|
+
/** A profile this session built: the profile, its Position and origin point, or its polyline and points. */
|
|
111
|
+
function removeOverlayProfile(editor, profileId) {
|
|
112
|
+
const profile = removeOverlay(editor, profileId, ['IfcRectangleProfileDef', 'IfcArbitraryClosedProfileDef']);
|
|
113
|
+
if (!profile)
|
|
114
|
+
return;
|
|
115
|
+
// IfcRectangleProfileDef.Position (slot 2) / IfcArbitraryClosedProfileDef.OuterCurve (slot 2).
|
|
116
|
+
const inner = refId(profile[2]);
|
|
117
|
+
const position = removeOverlay(editor, inner, ['IfcAxis2Placement2D']);
|
|
118
|
+
if (position)
|
|
119
|
+
removeOverlay(editor, refId(position[0]), ['IfcCartesianPoint']);
|
|
120
|
+
const polyline = position ? null : removeOverlay(editor, inner, ['IfcPolyline']);
|
|
121
|
+
// A closed polyline repeats its first point; remove each point once.
|
|
122
|
+
const points = new Set(Array.isArray(polyline?.[0]) ? polyline[0].map(refId) : []);
|
|
123
|
+
for (const point of points)
|
|
124
|
+
removeOverlay(editor, point, ['IfcCartesianPoint']);
|
|
125
|
+
}
|
|
126
|
+
/** An Axis representation this session built: the representation, its polyline and points. */
|
|
127
|
+
function removeOverlayAxis(editor, axisRepId) {
|
|
128
|
+
const rep = removeOverlay(editor, axisRepId, ['IfcShapeRepresentation']);
|
|
129
|
+
const items = Array.isArray(rep?.[3]) ? rep[3] : [];
|
|
130
|
+
for (const item of items) {
|
|
131
|
+
const polyline = removeOverlay(editor, refId(item), ['IfcPolyline']);
|
|
132
|
+
const points = new Set(Array.isArray(polyline?.[0]) ? polyline[0].map(refId) : []);
|
|
133
|
+
for (const point of points)
|
|
134
|
+
removeOverlay(editor, point, ['IfcCartesianPoint']);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=wall-join-apply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wall-join-apply.js","sourceRoot":"","sources":["../../src/in-store/wall-join-apply.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAyB/D,OAAO,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,sBAAsB,EAAgD,MAAM,WAAW,CAAC;AAClJ,OAAO,EAAE,eAAe,EAA0E,MAAM,gBAAgB,CAAC;AAuCzH,4EAA4E;AAC5E,MAAM,UAAU,uBAAuB,CAAC,KAAsB,EAAE,MAAyB;IACvF,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,iBAAiB,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;QACtG,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC1C,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;KACrC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAmB,EACnB,MAAkB,EAClB,CAAiB,EACjB,CAAiB,EACjB,UAAgC,EAAE;IAElC,MAAM,EAAE,GAAG,sBAAsB,CAAC;IAClC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClC,IA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,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,QAAQ,CAAC,CAAC,CAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAClG,KAAK,MAAM,KAAK,IAAI,MAAM;YAAE,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAClF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editing joined walls in the store (#6232 B2): join two walls that are
|
|
3
|
+
* already there, and move wall ends with their joins following.
|
|
4
|
+
*
|
|
5
|
+
* - `joinWallsInStore` reads both walls, then writes the join. Two walls that
|
|
6
|
+
* are already joined get the new `IfcRelConnectsPathElements` in place of
|
|
7
|
+
* the old one, never a second beside it.
|
|
8
|
+
* - `reshapeWallsInStore` gives walls new axis ends. A dragged corner brings
|
|
9
|
+
* the walls joined at that end along, changed ends are made square while
|
|
10
|
+
* unchanged ends retain their cuts, and every affected join is recomputed. A join that
|
|
11
|
+
* no longer holds (the axes no longer meet) is removed and the wall that did
|
|
12
|
+
* not move stops square at its own end.
|
|
13
|
+
*
|
|
14
|
+
* Both write through the editor only. Joining is atomic; reshaping runs inside
|
|
15
|
+
* the caller's transaction. Hosts record either as one undo step. Every length
|
|
16
|
+
* in and out is metres, storey-local.
|
|
17
|
+
*/
|
|
18
|
+
import type { StoreEditor } from '@ifc-lite/mutations';
|
|
19
|
+
import type { IfcDataStore } from '@ifc-lite/parser';
|
|
20
|
+
import { resolveAuthoringAnchor } from './resolve-relations.js';
|
|
21
|
+
import { type JoinAnchor, type WallJoinApplyOptions, type WallJoinApplyResult } from './wall-join-apply.js';
|
|
22
|
+
import { type PlanPoint } from './wall-join.js';
|
|
23
|
+
/** What a join write needs from the model: the authoring anchor plus the context an `Axis` representation lives in. */
|
|
24
|
+
export declare function resolveWallJoinAnchor(store: IfcDataStore, view?: Parameters<typeof resolveAuthoringAnchor>[1]): JoinAnchor;
|
|
25
|
+
export interface WallJoinInStoreResult extends WallJoinApplyResult {
|
|
26
|
+
/** The relationships this join replaced, now removed. */
|
|
27
|
+
replacedRelIds: number[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Join walls `aId` and `bId`. See `computeWallJoin` for the geometry and
|
|
31
|
+
* options. When the pair is already joined, the old relationship is removed
|
|
32
|
+
* (its name and priorities carried over) and the wall that ran through then
|
|
33
|
+
* still does, unless `options.priority` says otherwise. Nothing is written
|
|
34
|
+
* when the join is refused.
|
|
35
|
+
*/
|
|
36
|
+
export declare function joinWallsInStore(editor: StoreEditor, store: IfcDataStore, anchor: JoinAnchor, aId: number, bId: number, options?: WallJoinApplyOptions): WallJoinInStoreResult;
|
|
37
|
+
/** A wall's new axis ends and thickness, storey-local metres. What is left out stays. */
|
|
38
|
+
export interface WallReshape {
|
|
39
|
+
wallId: number;
|
|
40
|
+
start?: PlanPoint;
|
|
41
|
+
end?: PlanPoint;
|
|
42
|
+
thickness?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface WallReshapeOptions {
|
|
45
|
+
/** A moved end takes the walls joined end to end with it (an L corner or a butt join) along. */
|
|
46
|
+
moveJoinedEnds?: boolean;
|
|
47
|
+
/** Tolerance of the recomputed joins, see `computeWallJoin`. */
|
|
48
|
+
tolerance?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Walls that were moved as a whole (a rigid move or turn) and are NOT
|
|
51
|
+
* rewritten here: the joins they are part of are recomputed against the
|
|
52
|
+
* walls that are.
|
|
53
|
+
*/
|
|
54
|
+
refresh?: readonly number[];
|
|
55
|
+
}
|
|
56
|
+
export interface WallReshapeResult {
|
|
57
|
+
/** Every wall whose geometry was written, moved or re-cut: the ones to re-mesh. */
|
|
58
|
+
walls: number[];
|
|
59
|
+
/** The relationships written. */
|
|
60
|
+
relIds: number[];
|
|
61
|
+
/** Relationships removed because their walls no longer meet. */
|
|
62
|
+
droppedRelIds: number[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Give walls new axis ends and keep every join that touches them current.
|
|
66
|
+
* Refuses (writing nothing) a wall this module cannot read, a wall that would
|
|
67
|
+
* have no length or leave its storey plane is the caller's to check.
|
|
68
|
+
*/
|
|
69
|
+
export declare function reshapeWallsInStore(editor: StoreEditor, store: IfcDataStore, anchor: JoinAnchor, edits: readonly WallReshape[], options?: WallReshapeOptions): WallReshapeResult;
|
|
70
|
+
//# sourceMappingURL=wall-join-edit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wall-join-edit.d.ts","sourceRoot":"","sources":["../../src/in-store/wall-join-edit.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAAqC,KAAK,UAAU,EAAE,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE/I,OAAO,EAAoC,KAAK,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAGrG,uHAAuH;AACvH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAM1H;AAQD,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IAChE,yDAAyD;IACzD,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,oBAAyB,GACjC,qBAAqB,CAEvB;AA4BD,yFAAyF;AACzF,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,gGAAgG;IAChG,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,iCAAiC;IACjC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,gEAAgE;IAChE,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAKD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CAkFnB"}
|
|
@@ -0,0 +1,217 @@
|
|
|
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 { toNativeLength } from './anchor.js';
|
|
5
|
+
import { resolveAuthoringAnchor } from './resolve-relations.js';
|
|
6
|
+
import { AnchorEntityReader } from './resolve-anchor.js';
|
|
7
|
+
import { applyWallJoinToStore, rewriteWall } from './wall-join-apply.js';
|
|
8
|
+
import { readWallJoinRels, readWallJoinTarget } from './wall-join-read.js';
|
|
9
|
+
import { computeWallJoin, reshapeWallAxis } from './wall-join.js';
|
|
10
|
+
import { assertWallOpeningsFit } from './wall-opening-fit.js';
|
|
11
|
+
/** What a join write needs from the model: the authoring anchor plus the context an `Axis` representation lives in. */
|
|
12
|
+
export function resolveWallJoinAnchor(store, view) {
|
|
13
|
+
const base = resolveAuthoringAnchor(store, view);
|
|
14
|
+
const reader = new AnchorEntityReader(store, view);
|
|
15
|
+
const axisContextId = reader.contextId('axis', reader.rootContextId());
|
|
16
|
+
if (axisContextId === null)
|
|
17
|
+
throw new Error('resolveWallJoinAnchor: no IfcGeometricRepresentationContext (or Axis subcontext) found in store');
|
|
18
|
+
return { ownerHistoryId: base.ownerHistoryId, schema: base.schema, lengthUnitScale: base.lengthUnitScale, axisContextId };
|
|
19
|
+
}
|
|
20
|
+
function mustRead(store, editor, wallId, scale, op) {
|
|
21
|
+
const read = readWallJoinTarget(store, editor.getMutationView(), wallId, scale);
|
|
22
|
+
if (!read)
|
|
23
|
+
throw new Error(`${op}: #${wallId} is not a straight wall with a body this editor can rewrite`);
|
|
24
|
+
return read;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Join walls `aId` and `bId`. See `computeWallJoin` for the geometry and
|
|
28
|
+
* options. When the pair is already joined, the old relationship is removed
|
|
29
|
+
* (its name and priorities carried over) and the wall that ran through then
|
|
30
|
+
* still does, unless `options.priority` says otherwise. Nothing is written
|
|
31
|
+
* when the join is refused.
|
|
32
|
+
*/
|
|
33
|
+
export function joinWallsInStore(editor, store, anchor, aId, bId, options = {}) {
|
|
34
|
+
return editor.runAtomic(draft => joinWalls(draft, store, anchor, aId, bId, options));
|
|
35
|
+
}
|
|
36
|
+
function joinWalls(editor, store, anchor, aId, bId, options) {
|
|
37
|
+
const op = 'joinWallsInStore';
|
|
38
|
+
const a = mustRead(store, editor, aId, anchor.lengthUnitScale ?? 1, op);
|
|
39
|
+
const b = mustRead(store, editor, bId, anchor.lengthUnitScale ?? 1, op);
|
|
40
|
+
if (a.parentPlacementId !== b.parentPlacementId)
|
|
41
|
+
throw new Error(`${op}: walls #${aId} and #${bId} are not placed in the same frame`);
|
|
42
|
+
const existing = readWallJoinRels(store, editor.getMutationView(), new Set([aId, bId]))
|
|
43
|
+
.filter((rel) => (rel.relatingId === aId && rel.relatedId === bId) || (rel.relatingId === bId && rel.relatedId === aId));
|
|
44
|
+
const first = existing[0];
|
|
45
|
+
const priority = options.priority ?? (first ? (first.relatingId === aId ? 'a' : 'b') : undefined);
|
|
46
|
+
const priorities = options.priorities ?? (first
|
|
47
|
+
? (first.relatingId === aId
|
|
48
|
+
? { a: first.relatingPriorities, b: first.relatedPriorities }
|
|
49
|
+
: { a: first.relatedPriorities, b: first.relatingPriorities })
|
|
50
|
+
: undefined);
|
|
51
|
+
const joinOptions = { ...options, priority, priorities, Name: options.Name ?? first?.name ?? undefined };
|
|
52
|
+
// Refuse before the old relationship is touched.
|
|
53
|
+
const join = computeWallJoin(a.wall, b.wall, joinOptions);
|
|
54
|
+
assertWallOpeningsFit(store, editor.getMutationView(), a, join.a.wall, anchor.lengthUnitScale ?? 1);
|
|
55
|
+
assertWallOpeningsFit(store, editor.getMutationView(), b, join.b.wall, anchor.lengthUnitScale ?? 1);
|
|
56
|
+
for (const rel of existing)
|
|
57
|
+
editor.removeEntity(rel.relId);
|
|
58
|
+
return { ...applyWallJoinToStore(editor, anchor, a, b, joinOptions), replacedRelIds: existing.map((rel) => rel.relId) };
|
|
59
|
+
}
|
|
60
|
+
const MOVE_EPS = 1e-9;
|
|
61
|
+
const MIN_LENGTH = 1e-6;
|
|
62
|
+
/**
|
|
63
|
+
* Give walls new axis ends and keep every join that touches them current.
|
|
64
|
+
* Refuses (writing nothing) a wall this module cannot read, a wall that would
|
|
65
|
+
* have no length or leave its storey plane is the caller's to check.
|
|
66
|
+
*/
|
|
67
|
+
export function reshapeWallsInStore(editor, store, anchor, edits, options = {}) {
|
|
68
|
+
const op = 'reshapeWallsInStore';
|
|
69
|
+
const scale = anchor.lengthUnitScale ?? 1;
|
|
70
|
+
const view = () => editor.getMutationView();
|
|
71
|
+
const targets = new Map();
|
|
72
|
+
const load = (id) => {
|
|
73
|
+
let read = targets.get(id);
|
|
74
|
+
if (!read)
|
|
75
|
+
targets.set(id, (read = mustRead(store, editor, id, scale, op)));
|
|
76
|
+
return read;
|
|
77
|
+
};
|
|
78
|
+
// The requested axes, then the walls a moved corner drags along.
|
|
79
|
+
const axes = new Map();
|
|
80
|
+
for (const edit of edits) {
|
|
81
|
+
const read = load(edit.wallId);
|
|
82
|
+
const start = edit.start ?? read.wall.start;
|
|
83
|
+
const end = edit.end ?? read.wall.end;
|
|
84
|
+
if (![...start, ...end].every(Number.isFinite))
|
|
85
|
+
throw new Error(`${op}: wall #${edit.wallId} has a non-finite end`);
|
|
86
|
+
if (Math.hypot(end[0] - start[0], end[1] - start[1]) < MIN_LENGTH)
|
|
87
|
+
throw new Error(`${op}: wall #${edit.wallId} would have no length`);
|
|
88
|
+
if (edit.thickness !== undefined && !(Number.isFinite(edit.thickness) && edit.thickness > 0)) {
|
|
89
|
+
throw new Error(`${op}: wall #${edit.wallId} thickness must be positive`);
|
|
90
|
+
}
|
|
91
|
+
axes.set(edit.wallId, { start, end, thickness: edit.thickness });
|
|
92
|
+
}
|
|
93
|
+
if (options.moveJoinedEnds) {
|
|
94
|
+
for (const rel of readWallJoinRels(store, view(), new Set(axes.keys()))) {
|
|
95
|
+
for (const [self, other, selfConn, otherConn] of [
|
|
96
|
+
[rel.relatingId, rel.relatedId, rel.relatingConnection, rel.relatedConnection],
|
|
97
|
+
[rel.relatedId, rel.relatingId, rel.relatedConnection, rel.relatingConnection],
|
|
98
|
+
]) {
|
|
99
|
+
const moved = axes.get(self);
|
|
100
|
+
if (!moved || axes.has(other) || selfConn === 'ATPATH' || otherConn === 'ATPATH')
|
|
101
|
+
continue;
|
|
102
|
+
const from = load(self).wall;
|
|
103
|
+
const key = selfConn === 'ATSTART' ? 'start' : 'end';
|
|
104
|
+
if (Math.hypot(moved[key][0] - from[key][0], moved[key][1] - from[key][1]) <= MOVE_EPS)
|
|
105
|
+
continue;
|
|
106
|
+
const partner = load(other).wall;
|
|
107
|
+
const newAxis = { start: partner.start, end: partner.end };
|
|
108
|
+
newAxis[otherConn === 'ATSTART' ? 'start' : 'end'] = moved[key];
|
|
109
|
+
axes.set(other, newAxis);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
for (const id of axes.keys())
|
|
114
|
+
load(id);
|
|
115
|
+
// Everything that can refuse has run: write. Each moved wall gets a fresh
|
|
116
|
+
// placement point and direction (the old ones may be shared with other
|
|
117
|
+
// walls), retaining supported cuts at unchanged ends on the same direction.
|
|
118
|
+
const rels = readWallJoinRels(store, view(), new Set([...axes.keys(), ...(options.refresh ?? [])]));
|
|
119
|
+
const touched = new Set(axes.keys());
|
|
120
|
+
for (const [id, { start, end, thickness }] of axes)
|
|
121
|
+
targets.set(id, writeAxis(editor, anchor, load(id), start, end, thickness));
|
|
122
|
+
// Recompute every join that touches a moved wall: the joined end snaps to the
|
|
123
|
+
// crossing and is cut to the other wall's face. The relating wall runs through.
|
|
124
|
+
const relIds = [];
|
|
125
|
+
const droppedRelIds = [];
|
|
126
|
+
for (const rel of rels) {
|
|
127
|
+
const a = readOrNull(store, editor, targets, rel.relatingId, scale);
|
|
128
|
+
const b = readOrNull(store, editor, targets, rel.relatedId, scale);
|
|
129
|
+
if (!a || !b)
|
|
130
|
+
continue;
|
|
131
|
+
const joinOptions = joinOptionsOf(rel, options.tolerance);
|
|
132
|
+
try {
|
|
133
|
+
computeWallJoin(a.wall, b.wall, joinOptions);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
// The walls no longer meet: the join goes, and a wall that did not move stops square at that end.
|
|
137
|
+
editor.removeEntity(rel.relId);
|
|
138
|
+
droppedRelIds.push(rel.relId);
|
|
139
|
+
for (const [wall, connection] of [[a, rel.relatingConnection], [b, rel.relatedConnection]]) {
|
|
140
|
+
if (axes.has(wall.wallId) || connection === 'ATPATH')
|
|
141
|
+
continue;
|
|
142
|
+
targets.set(wall.wallId, squareEnd(editor, anchor, wall, connection));
|
|
143
|
+
touched.add(wall.wallId);
|
|
144
|
+
}
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
editor.removeEntity(rel.relId);
|
|
148
|
+
const written = applyWallJoinToStore(editor, anchor, a, b, joinOptions);
|
|
149
|
+
relIds.push(written.relId);
|
|
150
|
+
for (const [id, next] of [[a.wallId, written.a], [b.wallId, written.b]]) {
|
|
151
|
+
targets.set(id, { ...load(id), ...next });
|
|
152
|
+
touched.add(id);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return { walls: [...touched], relIds, droppedRelIds };
|
|
156
|
+
}
|
|
157
|
+
function readOrNull(store, editor, targets, id, scale) {
|
|
158
|
+
const known = targets.get(id);
|
|
159
|
+
if (known)
|
|
160
|
+
return known;
|
|
161
|
+
const read = readWallJoinTarget(store, editor.getMutationView(), id, scale);
|
|
162
|
+
if (read)
|
|
163
|
+
targets.set(id, read);
|
|
164
|
+
return read;
|
|
165
|
+
}
|
|
166
|
+
/** The recompute options of an existing join: the relating wall (`a`) keeps running through, its name and priorities stay. */
|
|
167
|
+
function joinOptionsOf(rel, tolerance) {
|
|
168
|
+
return {
|
|
169
|
+
priority: 'a',
|
|
170
|
+
...(tolerance === undefined ? {} : { tolerance }),
|
|
171
|
+
priorities: { a: rel.relatingPriorities, b: rel.relatedPriorities },
|
|
172
|
+
Name: rel.name ?? undefined,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Move `read` onto the axis `start`..`end`, retaining unchanged end cuts. The placement
|
|
177
|
+
* stays where it is when the start does not move and the direction holds (a
|
|
178
|
+
* far-end drag: the openings hosted in the wall keep their place); otherwise it
|
|
179
|
+
* gets a fresh point and direction at the new start (the old ones may be
|
|
180
|
+
* shared with other walls).
|
|
181
|
+
*/
|
|
182
|
+
function writeAxis(editor, anchor, read, start, end, thickness = read.wall.thickness) {
|
|
183
|
+
const length = Math.hypot(end[0] - start[0], end[1] - start[1]);
|
|
184
|
+
const native = (v) => toNativeLength(anchor, v);
|
|
185
|
+
const reshaped = reshapeWallAxis({ ...read.wall, thickness }, start, end);
|
|
186
|
+
const old = read.wall;
|
|
187
|
+
const oldLength = Math.hypot(old.end[0] - old.start[0], old.end[1] - old.start[1]);
|
|
188
|
+
const ux = (end[0] - start[0]) / length;
|
|
189
|
+
const uy = (end[1] - start[1]) / length;
|
|
190
|
+
const ox = (old.end[0] - old.start[0]) / oldLength;
|
|
191
|
+
const oy = (old.end[1] - old.start[1]) / oldLength;
|
|
192
|
+
const startHeld = Math.hypot(start[0] - old.start[0], start[1] - old.start[1]) <= MOVE_EPS;
|
|
193
|
+
const directionHeld = ux * ox + uy * oy > 1 - 1e-12;
|
|
194
|
+
if (startHeld && directionHeld) {
|
|
195
|
+
return { ...read, ...rewriteWall(editor, anchor, { ...read, wall: reshaped }, reshaped), wall: reshaped, plain: false };
|
|
196
|
+
}
|
|
197
|
+
const point = editor.addEntity('IfcCartesianPoint', [[native(start[0]), native(start[1]), read.location[2]]]).expressId;
|
|
198
|
+
const direction = editor.addEntity('IfcDirection', [[ux, uy, 0]]).expressId;
|
|
199
|
+
editor.setPositionalAttribute(read.axisPlacementId, 0, `#${point}`);
|
|
200
|
+
editor.setPositionalAttribute(read.axisPlacementId, 2, `#${direction}`);
|
|
201
|
+
const moved = rewriteWall(editor, anchor, { ...read, origin: start, wall: reshaped }, reshaped);
|
|
202
|
+
return {
|
|
203
|
+
...read, ...moved, locationPointId: point, refDirectionId: direction,
|
|
204
|
+
location: [native(start[0]), native(start[1]), read.location[2]], origin: start, wall: reshaped, plain: false,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/** `read`'s wall with its joined end cut square again. */
|
|
208
|
+
function squareEnd(editor, anchor, read, connection) {
|
|
209
|
+
const { startCut, endCut, ...rest } = read.wall;
|
|
210
|
+
const wall = {
|
|
211
|
+
...rest,
|
|
212
|
+
...(connection === 'ATEND' && startCut ? { startCut } : {}),
|
|
213
|
+
...(connection === 'ATSTART' && endCut ? { endCut } : {}),
|
|
214
|
+
};
|
|
215
|
+
return { ...read, ...rewriteWall(editor, anchor, read, wall), wall };
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=wall-join-edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wall-join-edit.js","sourceRoot":"","sources":["../../src/in-store/wall-join-edit.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAsB/D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAwE,MAAM,sBAAsB,CAAC;AAC/I,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAuC,MAAM,qBAAqB,CAAC;AAChH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAqC,MAAM,gBAAgB,CAAC;AACrG,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,uHAAuH;AACvH,MAAM,UAAU,qBAAqB,CAAC,KAAmB,EAAE,IAAmD;IAC5G,MAAM,IAAI,GAAG,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,IAAI,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACnD,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;IACvE,IAAI,aAAa,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,iGAAiG,CAAC,CAAC;IAC/I,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,E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AI,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read side of the wall joins (#6232 B2): a wall already in the store, source
|
|
3
|
+
* or authored, as the `WallJoinTarget` a join rewrites, and the
|
|
4
|
+
* `IfcRelConnectsPathElements` that tie walls together. Reads go through the
|
|
5
|
+
* mutation overlay, so a wall or join written earlier in the session counts.
|
|
6
|
+
*
|
|
7
|
+
* A wall is readable when it is a straight wall with a placement that names its
|
|
8
|
+
* direction, an extruded body over a rectangle or a four-point polygon (what
|
|
9
|
+
* `addWallToStore` and `applyWallJoinToStore` write), and an optional `Axis`
|
|
10
|
+
* polyline on the wall's own centreline. Anything else reads as null: it can
|
|
11
|
+
* neither be re-shaped nor joined.
|
|
12
|
+
*/
|
|
13
|
+
import type { IfcDataStore } from '@ifc-lite/parser';
|
|
14
|
+
import type { MutablePropertyView } from '@ifc-lite/mutations';
|
|
15
|
+
import type { WallJoinTarget } from './wall-join-apply.js';
|
|
16
|
+
import type { WallConnectionType } from './wall-join.js';
|
|
17
|
+
/** A wall as the join tools see it, with the ids and native-unit values a re-shape writes. */
|
|
18
|
+
export interface WallJoinRead extends WallJoinTarget {
|
|
19
|
+
/** IfcAxis2Placement3D of the wall's placement. */
|
|
20
|
+
axisPlacementId: number;
|
|
21
|
+
/** IfcCartesianPoint of the placement's Location. */
|
|
22
|
+
locationPointId: number;
|
|
23
|
+
/** IfcDirection of the placement's RefDirection. */
|
|
24
|
+
refDirectionId: number;
|
|
25
|
+
/** The Location, in the file's native unit. */
|
|
26
|
+
location: [number, number, number];
|
|
27
|
+
/** `PlacementRelTo` of the wall's placement: two walls join only in the same frame. */
|
|
28
|
+
parentPlacementId: number | null;
|
|
29
|
+
/** Extrusion depth in metres, `NaN` when the slot is not a number. */
|
|
30
|
+
height: number;
|
|
31
|
+
/**
|
|
32
|
+
* The body is the plain rectangle `addWallToStore` writes without cuts,
|
|
33
|
+
* offset or axis alignment: the four coupled entities (placement, direction,
|
|
34
|
+
* XDim, profile origin) describe the wall completely.
|
|
35
|
+
*/
|
|
36
|
+
plain: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface WallJoinRel {
|
|
39
|
+
relId: number;
|
|
40
|
+
relatingId: number;
|
|
41
|
+
relatedId: number;
|
|
42
|
+
relatingConnection: WallConnectionType;
|
|
43
|
+
relatedConnection: WallConnectionType;
|
|
44
|
+
relatingPriorities: number[];
|
|
45
|
+
relatedPriorities: number[];
|
|
46
|
+
name: string | null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Read wall `wallId` as a join target. `lengthUnitScale` is the model's native
|
|
50
|
+
* unit in metres; the target's plan values are metres.
|
|
51
|
+
*/
|
|
52
|
+
export declare function readWallJoinTarget(store: IfcDataStore, view: MutablePropertyView | null | undefined, wallId: number, lengthUnitScale: number): WallJoinRead | null;
|
|
53
|
+
/**
|
|
54
|
+
* Every live `IfcRelConnectsPathElements` that touches one of `wallIds` (all
|
|
55
|
+
* of them when omitted). The attribute slots (Relating 5, Related 6,
|
|
56
|
+
* priorities 7 and 8, connection types 9 and 10) are the same in IFC2X3,
|
|
57
|
+
* IFC4 and IFC4X3.
|
|
58
|
+
*/
|
|
59
|
+
export declare function readWallJoinRels(store: IfcDataStore, view: MutablePropertyView | null | undefined, wallIds?: ReadonlySet<number>): WallJoinRel[];
|
|
60
|
+
//# sourceMappingURL=wall-join-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wall-join-read.d.ts","sourceRoot":"","sources":["../../src/in-store/wall-join-read.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC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