@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,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared parametric-profile factory for the in-store builders (#6232).
|
|
3
|
+
*
|
|
4
|
+
* One discriminated union covers the cross-sections a beam, column or member
|
|
5
|
+
* can carry: the default rectangle plus the steel/hollow sections IfcCreator
|
|
6
|
+
* offers (`addIShapeProfile`, `addLShapeProfile`, ...). Every profile is
|
|
7
|
+
* centred on its own origin, the IFC convention for parameterised profiles,
|
|
8
|
+
* so an extrusion along the element axis runs through the section's centre.
|
|
9
|
+
*
|
|
10
|
+
* Attributes are laid out from the target schema's registry by name
|
|
11
|
+
* (`schemaAttributes`, decision D2): IFC2X3 and IFC4/IFC4X3 differ in the
|
|
12
|
+
* optional tail of several of these classes (IFC2X3 has `CentreOfGravityIn*`,
|
|
13
|
+
* IFC4 has `FlangeEdgeRadius`, `FlangeSlope`, ...), and IFC5 is refused.
|
|
14
|
+
*
|
|
15
|
+
* Params are metres; dimensions are converted to the file's native length
|
|
16
|
+
* unit on emit, like every other in-store builder.
|
|
17
|
+
*/
|
|
18
|
+
import type { StoreEditor } from '@ifc-lite/mutations';
|
|
19
|
+
import { type SpatialAnchor } from './anchor.js';
|
|
20
|
+
import { schemaRegistry } from './schema-attributes.js';
|
|
21
|
+
/** Centred rectangle, XDim along profile X, YDim along profile Y. */
|
|
22
|
+
export interface RectangleSection {
|
|
23
|
+
Type: 'Rectangle';
|
|
24
|
+
XDim: number;
|
|
25
|
+
YDim: number;
|
|
26
|
+
}
|
|
27
|
+
/** I / H section (`IfcIShapeProfileDef`). Depth along profile Y. */
|
|
28
|
+
export interface ISection {
|
|
29
|
+
Type: 'I';
|
|
30
|
+
OverallWidth: number;
|
|
31
|
+
OverallDepth: number;
|
|
32
|
+
WebThickness: number;
|
|
33
|
+
FlangeThickness: number;
|
|
34
|
+
FilletRadius?: number;
|
|
35
|
+
}
|
|
36
|
+
/** Angle (`IfcLShapeProfileDef`). Depth along profile Y, Width along X. */
|
|
37
|
+
export interface LSection {
|
|
38
|
+
Type: 'L';
|
|
39
|
+
Depth: number;
|
|
40
|
+
Width: number;
|
|
41
|
+
Thickness: number;
|
|
42
|
+
FilletRadius?: number;
|
|
43
|
+
}
|
|
44
|
+
/** Tee (`IfcTShapeProfileDef`). Flange at +Y. */
|
|
45
|
+
export interface TSection {
|
|
46
|
+
Type: 'T';
|
|
47
|
+
Depth: number;
|
|
48
|
+
FlangeWidth: number;
|
|
49
|
+
WebThickness: number;
|
|
50
|
+
FlangeThickness: number;
|
|
51
|
+
FilletRadius?: number;
|
|
52
|
+
}
|
|
53
|
+
/** Channel (`IfcUShapeProfileDef`). Web at -X, flanges towards +X. */
|
|
54
|
+
export interface USection {
|
|
55
|
+
Type: 'U';
|
|
56
|
+
Depth: number;
|
|
57
|
+
FlangeWidth: number;
|
|
58
|
+
WebThickness: number;
|
|
59
|
+
FlangeThickness: number;
|
|
60
|
+
FilletRadius?: number;
|
|
61
|
+
}
|
|
62
|
+
/** Cold-formed lipped channel (`IfcCShapeProfileDef`). */
|
|
63
|
+
export interface CSection {
|
|
64
|
+
Type: 'C';
|
|
65
|
+
Depth: number;
|
|
66
|
+
Width: number;
|
|
67
|
+
WallThickness: number;
|
|
68
|
+
Girth: number;
|
|
69
|
+
InternalFilletRadius?: number;
|
|
70
|
+
}
|
|
71
|
+
/** Solid circle (`IfcCircleProfileDef`). */
|
|
72
|
+
export interface CircleSection {
|
|
73
|
+
Type: 'Circle';
|
|
74
|
+
Radius: number;
|
|
75
|
+
}
|
|
76
|
+
/** Rectangular hollow section / tube (`IfcRectangleHollowProfileDef`). */
|
|
77
|
+
export interface RectangleHollowSection {
|
|
78
|
+
Type: 'RectangleHollow';
|
|
79
|
+
XDim: number;
|
|
80
|
+
YDim: number;
|
|
81
|
+
WallThickness: number;
|
|
82
|
+
InnerFilletRadius?: number;
|
|
83
|
+
OuterFilletRadius?: number;
|
|
84
|
+
}
|
|
85
|
+
/** Circular hollow section / pipe (`IfcCircleHollowProfileDef`). */
|
|
86
|
+
export interface CircleHollowSection {
|
|
87
|
+
Type: 'CircleHollow';
|
|
88
|
+
Radius: number;
|
|
89
|
+
WallThickness: number;
|
|
90
|
+
}
|
|
91
|
+
/** A parameterised cross-section for a beam, column or member. Metres. */
|
|
92
|
+
export type ProfileSection = RectangleSection | ISection | LSection | TSection | USection | CSection | CircleSection | RectangleHollowSection | CircleHollowSection;
|
|
93
|
+
export type ProfileSectionType = ProfileSection['Type'];
|
|
94
|
+
/** The IFC profile class a section is written as. */
|
|
95
|
+
export declare function profileSectionIfcClass(section: ProfileSection): string;
|
|
96
|
+
/**
|
|
97
|
+
* Refuse a section the mesher could not build or would build inside out:
|
|
98
|
+
* non-positive dimensions, and walls, webs or flanges that do not fit in the
|
|
99
|
+
* outer size. Throws with `op` in the message.
|
|
100
|
+
*/
|
|
101
|
+
export declare function validateProfileSection(section: ProfileSection, op: string): void;
|
|
102
|
+
/**
|
|
103
|
+
* The section's axis-aligned extent in its own frame (metres):
|
|
104
|
+
* `[along profile X, along profile Y]`. Profiles are centred, so the section
|
|
105
|
+
* spans half of each on either side of the element axis. For callers that
|
|
106
|
+
* need the outer size without meshing (fallback meshes, snapping, HUDs).
|
|
107
|
+
*/
|
|
108
|
+
export declare function profileSectionExtent(section: ProfileSection): [number, number];
|
|
109
|
+
/**
|
|
110
|
+
* Everything `emitProfileSection` would refuse, checked without emitting, so a
|
|
111
|
+
* builder can validate its whole input before it writes its first entity.
|
|
112
|
+
*/
|
|
113
|
+
export declare function assertProfileSectionAuthorable(anchor: Pick<SpatialAnchor, 'schema'>, section: ProfileSection, op: string): ReturnType<typeof schemaRegistry>;
|
|
114
|
+
/**
|
|
115
|
+
* Emit a centred parameterised profile (`IfcAxis2Placement2D` at the origin +
|
|
116
|
+
* the profile class for `section.Type`) and return the profile's expressId.
|
|
117
|
+
* Validates the section, converts it to native units, and lays the attributes
|
|
118
|
+
* out for `anchor.schema` (IFC5 refused).
|
|
119
|
+
*/
|
|
120
|
+
export declare function emitProfileSection(editor: StoreEditor, anchor: Pick<SpatialAnchor, 'schema' | 'lengthUnitScale'>, section: ProfileSection, op?: string): number;
|
|
121
|
+
/** A linear element's validated section: the default rectangle or a `Profile`. */
|
|
122
|
+
export type LinearSection = {
|
|
123
|
+
Profile: ProfileSection;
|
|
124
|
+
Width?: undefined;
|
|
125
|
+
Height?: undefined;
|
|
126
|
+
} | {
|
|
127
|
+
Width: number;
|
|
128
|
+
Height: number;
|
|
129
|
+
Profile?: undefined;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Validate a beam's or member's section params: exactly one of the rectangle
|
|
133
|
+
* (`Width` + `Height`, finite and positive) or a `Profile`, checked before
|
|
134
|
+
* anything is emitted.
|
|
135
|
+
*/
|
|
136
|
+
export declare function linearSection(anchor: Pick<SpatialAnchor, 'schema'>, params: {
|
|
137
|
+
Width?: number;
|
|
138
|
+
Height?: number;
|
|
139
|
+
Profile?: ProfileSection;
|
|
140
|
+
}, op: string): LinearSection;
|
|
141
|
+
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/in-store/profile.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAoB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE1E,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAAG,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AACnF,oEAAoE;AACpE,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,GAAG,CAAC;IACV,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AACD,2EAA2E;AAC3E,MAAM,WAAW,QAAQ;IAAG,IAAI,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE;AAC/G,iDAAiD;AACjD,MAAM,WAAW,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CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,EACrE,EAAE,EAAE,MAAM,GACT,aAAa,CAWf"}
|
|
@@ -0,0 +1,174 @@
|
|
|
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 { assertPositiveFinite } from './_emit-helpers.js';
|
|
5
|
+
import { toNativeLength } from './anchor.js';
|
|
6
|
+
import { schemaAttributes, schemaRegistry } from './schema-attributes.js';
|
|
7
|
+
const IFC_CLASS = {
|
|
8
|
+
Rectangle: 'IfcRectangleProfileDef',
|
|
9
|
+
I: 'IfcIShapeProfileDef',
|
|
10
|
+
L: 'IfcLShapeProfileDef',
|
|
11
|
+
T: 'IfcTShapeProfileDef',
|
|
12
|
+
U: 'IfcUShapeProfileDef',
|
|
13
|
+
C: 'IfcCShapeProfileDef',
|
|
14
|
+
Circle: 'IfcCircleProfileDef',
|
|
15
|
+
RectangleHollow: 'IfcRectangleHollowProfileDef',
|
|
16
|
+
CircleHollow: 'IfcCircleHollowProfileDef',
|
|
17
|
+
};
|
|
18
|
+
/** The IFC profile class a section is written as. */
|
|
19
|
+
export function profileSectionIfcClass(section) {
|
|
20
|
+
const cls = IFC_CLASS[section?.Type];
|
|
21
|
+
if (!cls)
|
|
22
|
+
throw new Error(`profile: unknown section Type ${String(section?.Type)}`);
|
|
23
|
+
return cls;
|
|
24
|
+
}
|
|
25
|
+
/** The section's dimension fields (everything but `Type`), keyed by IFC attribute name. */
|
|
26
|
+
function dimensions(section) {
|
|
27
|
+
const { Type: _type, ...dims } = section;
|
|
28
|
+
return dims;
|
|
29
|
+
}
|
|
30
|
+
/** Mandatory dimensions per section: finite and > 0. Optional ones (fillets): finite and >= 0 when set. */
|
|
31
|
+
const REQUIRED = {
|
|
32
|
+
Rectangle: ['XDim', 'YDim'],
|
|
33
|
+
I: ['OverallWidth', 'OverallDepth', 'WebThickness', 'FlangeThickness'],
|
|
34
|
+
L: ['Depth', 'Width', 'Thickness'],
|
|
35
|
+
T: ['Depth', 'FlangeWidth', 'WebThickness', 'FlangeThickness'],
|
|
36
|
+
U: ['Depth', 'FlangeWidth', 'WebThickness', 'FlangeThickness'],
|
|
37
|
+
C: ['Depth', 'Width', 'WallThickness', 'Girth'],
|
|
38
|
+
Circle: ['Radius'],
|
|
39
|
+
RectangleHollow: ['XDim', 'YDim', 'WallThickness'],
|
|
40
|
+
CircleHollow: ['Radius', 'WallThickness'],
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Refuse a section the mesher could not build or would build inside out:
|
|
44
|
+
* non-positive dimensions, and walls, webs or flanges that do not fit in the
|
|
45
|
+
* outer size. Throws with `op` in the message.
|
|
46
|
+
*/
|
|
47
|
+
export function validateProfileSection(section, op) {
|
|
48
|
+
const cls = profileSectionIfcClass(section);
|
|
49
|
+
const dims = dimensions(section);
|
|
50
|
+
const required = REQUIRED[section.Type];
|
|
51
|
+
for (const [name, value] of Object.entries(dims)) {
|
|
52
|
+
if (value === undefined)
|
|
53
|
+
continue;
|
|
54
|
+
if (!required.includes(name) && !isNonNegativeFinite(value)) {
|
|
55
|
+
throw new Error(`${op}: ${cls}.${name} must be a finite number >= 0`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
for (const name of required) {
|
|
59
|
+
const value = dims[name];
|
|
60
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || value <= 0) {
|
|
61
|
+
throw new Error(`${op}: ${cls}.${name} must be a finite positive number`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const fits = (ok, what) => {
|
|
65
|
+
if (!ok)
|
|
66
|
+
throw new Error(`${op}: ${cls} ${what}`);
|
|
67
|
+
};
|
|
68
|
+
switch (section.Type) {
|
|
69
|
+
case 'I':
|
|
70
|
+
fits(section.WebThickness < section.OverallWidth, 'WebThickness must be less than OverallWidth');
|
|
71
|
+
fits(2 * section.FlangeThickness < section.OverallDepth, 'two FlangeThicknesses must be less than OverallDepth');
|
|
72
|
+
break;
|
|
73
|
+
case 'L':
|
|
74
|
+
fits(section.Thickness < section.Depth && section.Thickness < section.Width, 'Thickness must be less than Depth and Width');
|
|
75
|
+
break;
|
|
76
|
+
case 'T':
|
|
77
|
+
fits(section.WebThickness < section.FlangeWidth, 'WebThickness must be less than FlangeWidth');
|
|
78
|
+
fits(section.FlangeThickness < section.Depth, 'FlangeThickness must be less than Depth');
|
|
79
|
+
break;
|
|
80
|
+
case 'U':
|
|
81
|
+
fits(section.WebThickness < section.FlangeWidth, 'WebThickness must be less than FlangeWidth');
|
|
82
|
+
fits(2 * section.FlangeThickness < section.Depth, 'two FlangeThicknesses must be less than Depth');
|
|
83
|
+
break;
|
|
84
|
+
case 'C':
|
|
85
|
+
fits(2 * section.WallThickness < section.Width, 'two WallThicknesses must be less than Width');
|
|
86
|
+
fits(2 * section.Girth < section.Depth, 'two Girths must be less than Depth');
|
|
87
|
+
fits(section.WallThickness < section.Girth, 'WallThickness must be less than Girth');
|
|
88
|
+
break;
|
|
89
|
+
case 'RectangleHollow':
|
|
90
|
+
fits(2 * section.WallThickness < Math.min(section.XDim, section.YDim), 'two WallThicknesses must be less than XDim and YDim');
|
|
91
|
+
break;
|
|
92
|
+
case 'CircleHollow':
|
|
93
|
+
fits(section.WallThickness < section.Radius, 'WallThickness must be less than Radius');
|
|
94
|
+
break;
|
|
95
|
+
default:
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function isNonNegativeFinite(value) {
|
|
100
|
+
return typeof value === 'number' && Number.isFinite(value) && value >= 0;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The section's axis-aligned extent in its own frame (metres):
|
|
104
|
+
* `[along profile X, along profile Y]`. Profiles are centred, so the section
|
|
105
|
+
* spans half of each on either side of the element axis. For callers that
|
|
106
|
+
* need the outer size without meshing (fallback meshes, snapping, HUDs).
|
|
107
|
+
*/
|
|
108
|
+
export function profileSectionExtent(section) {
|
|
109
|
+
switch (section.Type) {
|
|
110
|
+
case 'Rectangle':
|
|
111
|
+
case 'RectangleHollow':
|
|
112
|
+
return [section.XDim, section.YDim];
|
|
113
|
+
case 'I':
|
|
114
|
+
return [section.OverallWidth, section.OverallDepth];
|
|
115
|
+
case 'L':
|
|
116
|
+
case 'C':
|
|
117
|
+
return [section.Width, section.Depth];
|
|
118
|
+
case 'T':
|
|
119
|
+
case 'U':
|
|
120
|
+
return [section.FlangeWidth, section.Depth];
|
|
121
|
+
case 'Circle':
|
|
122
|
+
case 'CircleHollow':
|
|
123
|
+
return [2 * section.Radius, 2 * section.Radius];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Everything `emitProfileSection` would refuse, checked without emitting, so a
|
|
128
|
+
* builder can validate its whole input before it writes its first entity.
|
|
129
|
+
*/
|
|
130
|
+
export function assertProfileSectionAuthorable(anchor, section, op) {
|
|
131
|
+
validateProfileSection(section, op);
|
|
132
|
+
return schemaRegistry(anchor.schema, op);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Emit a centred parameterised profile (`IfcAxis2Placement2D` at the origin +
|
|
136
|
+
* the profile class for `section.Type`) and return the profile's expressId.
|
|
137
|
+
* Validates the section, converts it to native units, and lays the attributes
|
|
138
|
+
* out for `anchor.schema` (IFC5 refused).
|
|
139
|
+
*/
|
|
140
|
+
export function emitProfileSection(editor, anchor, section, op = 'emitProfileSection') {
|
|
141
|
+
const registry = assertProfileSectionAuthorable(anchor, section, op);
|
|
142
|
+
const cls = profileSectionIfcClass(section);
|
|
143
|
+
const native = {};
|
|
144
|
+
for (const [name, value] of Object.entries(dimensions(section))) {
|
|
145
|
+
if (value !== undefined)
|
|
146
|
+
native[name] = toNativeLength(anchor, value);
|
|
147
|
+
}
|
|
148
|
+
const originPt = editor.addEntity('IfcCartesianPoint', [[0, 0]]).expressId;
|
|
149
|
+
const position = editor.addEntity('IfcAxis2Placement2D', [`#${originPt}`, null]).expressId;
|
|
150
|
+
const attrs = schemaAttributes(registry, cls, {
|
|
151
|
+
ProfileType: 'AREA',
|
|
152
|
+
Position: `#${position}`,
|
|
153
|
+
...native,
|
|
154
|
+
}, op);
|
|
155
|
+
return editor.addEntity(cls, attrs).expressId;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Validate a beam's or member's section params: exactly one of the rectangle
|
|
159
|
+
* (`Width` + `Height`, finite and positive) or a `Profile`, checked before
|
|
160
|
+
* anything is emitted.
|
|
161
|
+
*/
|
|
162
|
+
export function linearSection(anchor, params, op) {
|
|
163
|
+
if (params.Profile !== undefined) {
|
|
164
|
+
if (params.Width !== undefined || params.Height !== undefined) {
|
|
165
|
+
throw new Error(`${op}: give either Width and Height or a Profile, not both`);
|
|
166
|
+
}
|
|
167
|
+
assertProfileSectionAuthorable(anchor, params.Profile, op);
|
|
168
|
+
return { Profile: params.Profile };
|
|
169
|
+
}
|
|
170
|
+
const { Width, Height } = params;
|
|
171
|
+
assertPositiveFinite([Width, Height], `${op}: Width and Height must be positive`);
|
|
172
|
+
return { Width, Height };
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/in-store/profile.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAqB/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAsE1E,MAAM,SAAS,GAAuC;IACpD,SAAS,EAAE,wBAAwB;IACnC,CAAC,EAAE,qBAAqB;IACxB,CAAC,EAAE,qBAAqB;IACxB,CAAC,EAAE,qBAAqB;IACxB,CAAC,EAA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C,GAAG,EAAE,uDAAuD,CAAC,CAAC;QAChF,CAAC;QACD,8BAA8B,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;IACrC,CAAC;IACD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAA2C,CAAC;IACtE,oBAAoB,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,qCAAqC,CAAC,CAAC;IAClF,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anchored builder for IfcRailing along a polyline path (#6232).
|
|
3
|
+
*
|
|
4
|
+
* `IfcCreator.addIfcRailing` draws one straight run (a square rail box plus a
|
|
5
|
+
* post at each end). This builder takes a whole path: the handrail is one
|
|
6
|
+
* IfcSweptDiskSolid swept along an IfcPolyline, so corners stay continuous,
|
|
7
|
+
* and circular posts (IfcExtrudedAreaSolid of an IfcCircleProfileDef) stand at
|
|
8
|
+
* every path vertex, plus intermediate ones when `PostSpacing` is set.
|
|
9
|
+
*
|
|
10
|
+
* `Height` is the height of the top of the handrail above the path, so the
|
|
11
|
+
* rail's centreline runs at `Height - RailDiameter / 2` and the posts stop
|
|
12
|
+
* there. The path is the railing's base line in storey coordinates; it may
|
|
13
|
+
* slope (a stair or ramp railing).
|
|
14
|
+
*
|
|
15
|
+
* Schema gating (D2): attributes are laid out from the target schema's
|
|
16
|
+
* registry; IFC2X3's mandatory `IfcSweptDiskSolid.StartParam`/`EndParam` are
|
|
17
|
+
* written as the polyline's full parameter range, and IFC5 is refused.
|
|
18
|
+
*/
|
|
19
|
+
import type { StoreEditor } from '@ifc-lite/mutations';
|
|
20
|
+
import { type SpatialAnchor } from './anchor.js';
|
|
21
|
+
type Vec3 = [number, number, number];
|
|
22
|
+
export interface RailingInStoreParams {
|
|
23
|
+
/** Base line of the railing, storey-local (metres). At least two distinct consecutive points. */
|
|
24
|
+
Path: ReadonlyArray<readonly [number, number, number]>;
|
|
25
|
+
/** Height of the top of the handrail above the path (metres). */
|
|
26
|
+
Height: number;
|
|
27
|
+
/** Handrail diameter (metres). Default 0.05. */
|
|
28
|
+
RailDiameter?: number;
|
|
29
|
+
/** Post diameter (metres). Default `RailDiameter`. */
|
|
30
|
+
PostDiameter?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Largest distance between posts along a segment (metres). Posts always
|
|
33
|
+
* stand at every path vertex; with a spacing, each segment gets evenly
|
|
34
|
+
* spaced intermediate posts no further apart than this.
|
|
35
|
+
*/
|
|
36
|
+
PostSpacing?: number;
|
|
37
|
+
/** IfcRailing PredefinedType. Default `HANDRAIL`. */
|
|
38
|
+
PredefinedType?: string;
|
|
39
|
+
Name?: string;
|
|
40
|
+
Description?: string;
|
|
41
|
+
ObjectType?: string;
|
|
42
|
+
Tag?: string;
|
|
43
|
+
/** Explicit GlobalId (22-char IFC GUID); generated when omitted. */
|
|
44
|
+
GlobalId?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface RailingBuildResult {
|
|
47
|
+
railingId: number;
|
|
48
|
+
placementId: number;
|
|
49
|
+
/** The handrail's IfcSweptDiskSolid. */
|
|
50
|
+
railSolidId: number;
|
|
51
|
+
/** One IfcExtrudedAreaSolid per post, in path order. */
|
|
52
|
+
postSolidIds: number[];
|
|
53
|
+
shapeRepId: number;
|
|
54
|
+
productShapeId: number;
|
|
55
|
+
relContainedId: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Post base points along `path` (vertices, plus intermediates at `spacing`).
|
|
59
|
+
* `spacing`, when given, must be finite and positive: a zero spacing would
|
|
60
|
+
* need infinitely many posts, and NaN would silently drop segment ends.
|
|
61
|
+
*/
|
|
62
|
+
export declare function railingPostPoints(path: ReadonlyArray<Vec3>, spacing?: number): Vec3[];
|
|
63
|
+
export declare function addRailingToStore(editor: StoreEditor, anchor: SpatialAnchor, params: RailingInStoreParams): RailingBuildResult;
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=railing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"railing.d.ts","sourceRoot":"","sources":["../../src/in-store/railing.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAkC,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAWjF,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAIrC,MAAM,WAAW,oBAAoB;IACnC,iGAAiG;IACjG,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,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,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB;AAKD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,CAUrF;AAoBD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,oBAAoB,GAC3B,kBAAkB,CA6EpB"}
|
|
@@ -0,0 +1,112 @@
|
|
|
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 { assertPositiveFinite, emitLocalPlacement, emitRelContainedInSpatialStructure, ownerHistoryRef, productGuid, } from './_emit-helpers.js';
|
|
7
|
+
import { schemaAttributes, schemaRegistry } from './schema-attributes.js';
|
|
8
|
+
const DEFAULT_RAIL_DIAMETER = 0.05;
|
|
9
|
+
const sub = (a, b) => [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
|
|
10
|
+
const lerp = (a, b, t) => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t];
|
|
11
|
+
/**
|
|
12
|
+
* Post base points along `path` (vertices, plus intermediates at `spacing`).
|
|
13
|
+
* `spacing`, when given, must be finite and positive: a zero spacing would
|
|
14
|
+
* need infinitely many posts, and NaN would silently drop segment ends.
|
|
15
|
+
*/
|
|
16
|
+
export function railingPostPoints(path, spacing) {
|
|
17
|
+
if (spacing !== undefined)
|
|
18
|
+
assertPositiveFinite([spacing], 'railingPostPoints: spacing must be a finite positive number');
|
|
19
|
+
const posts = [path[0]];
|
|
20
|
+
for (let i = 1; i < path.length; i++) {
|
|
21
|
+
const a = path[i - 1];
|
|
22
|
+
const b = path[i];
|
|
23
|
+
const bays = spacing === undefined ? 1 : Math.max(1, Math.ceil(Math.hypot(...sub(b, a)) / spacing - 1e-9));
|
|
24
|
+
for (let k = 1; k <= bays; k++)
|
|
25
|
+
posts.push(lerp(a, b, k / bays));
|
|
26
|
+
}
|
|
27
|
+
return posts;
|
|
28
|
+
}
|
|
29
|
+
function assertRailingParams(params, op) {
|
|
30
|
+
if (!Array.isArray(params.Path) || params.Path.length < 2) {
|
|
31
|
+
throw new Error(`${op}: Path needs at least two points`);
|
|
32
|
+
}
|
|
33
|
+
params.Path.forEach((p, i) => assertFinitePoint3({ [`Path[${i}]`]: p }, op));
|
|
34
|
+
for (let i = 1; i < params.Path.length; i++) {
|
|
35
|
+
if (Math.hypot(...sub(params.Path[i], params.Path[i - 1])) <= 1e-9) {
|
|
36
|
+
throw new Error(`${op}: Path[${i - 1}] and Path[${i}] must be distinct points`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const rail = params.RailDiameter ?? DEFAULT_RAIL_DIAMETER;
|
|
40
|
+
assertPositiveFinite([params.Height, rail, params.PostDiameter ?? rail], `${op}: Height, RailDiameter and PostDiameter must be finite positive numbers`);
|
|
41
|
+
if (params.Height <= rail)
|
|
42
|
+
throw new Error(`${op}: Height must be greater than RailDiameter`);
|
|
43
|
+
if (params.PostSpacing !== undefined) {
|
|
44
|
+
assertPositiveFinite([params.PostSpacing], `${op}: PostSpacing must be a finite positive number`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export function addRailingToStore(editor, anchor, params) {
|
|
48
|
+
const op = 'addRailingToStore';
|
|
49
|
+
assertRailingParams(params, op);
|
|
50
|
+
const registry = schemaRegistry(anchor.schema, op);
|
|
51
|
+
const isIfc2x3 = registry.name.toUpperCase() === 'IFC2X3';
|
|
52
|
+
const railDiameter = params.RailDiameter ?? DEFAULT_RAIL_DIAMETER;
|
|
53
|
+
const railRadius = toNativeLength(anchor, railDiameter / 2);
|
|
54
|
+
const postRadius = toNativeLength(anchor, (params.PostDiameter ?? railDiameter) / 2);
|
|
55
|
+
const railAxisHeight = toNativeLength(anchor, params.Height - railDiameter / 2);
|
|
56
|
+
const path = params.Path.map((p) => toNativePoint3(anchor, p));
|
|
57
|
+
const origin = path[0];
|
|
58
|
+
const local = path.map((p) => sub(p, origin));
|
|
59
|
+
const spacing = params.PostSpacing === undefined ? undefined : toNativeLength(anchor, params.PostSpacing);
|
|
60
|
+
// Lay the railing record out before the first emit so a bad PredefinedType
|
|
61
|
+
// or a missing IFC2X3 OwnerHistory refuses cleanly.
|
|
62
|
+
const globalId = productGuid(params, anchor.guidRandom);
|
|
63
|
+
const railingValues = (placement, shape) => ({
|
|
64
|
+
GlobalId: globalId,
|
|
65
|
+
OwnerHistory: ownerHistoryRef(anchor.ownerHistoryId),
|
|
66
|
+
Name: params.Name ?? 'Railing',
|
|
67
|
+
Description: params.Description,
|
|
68
|
+
ObjectType: params.ObjectType,
|
|
69
|
+
ObjectPlacement: placement,
|
|
70
|
+
Representation: shape,
|
|
71
|
+
Tag: params.Tag,
|
|
72
|
+
PredefinedType: params.PredefinedType ?? 'HANDRAIL',
|
|
73
|
+
});
|
|
74
|
+
schemaAttributes(registry, 'IfcRailing', railingValues(null, null), op);
|
|
75
|
+
// Placement at the first path point, explicit axes so it can be turned later.
|
|
76
|
+
const placementId = emitLocalPlacement(editor, anchor.storeyPlacementId, origin, [0, 0, 1], [1, 0, 0]);
|
|
77
|
+
// Handrail: a disk swept along the path lifted to the rail's centreline.
|
|
78
|
+
const directrixPoints = local.map((p) => editor.addEntity('IfcCartesianPoint', [[p[0], p[1], p[2] + railAxisHeight]]).expressId);
|
|
79
|
+
const directrix = editor.addEntity('IfcPolyline', [directrixPoints.map((id) => `#${id}`)]).expressId;
|
|
80
|
+
const railSolidId = editor.addEntity('IfcSweptDiskSolid', schemaAttributes(registry, 'IfcSweptDiskSolid', {
|
|
81
|
+
Directrix: `#${directrix}`,
|
|
82
|
+
Radius: railRadius,
|
|
83
|
+
// IfcPolyline's parameter is the point index; IFC2X3 requires the range.
|
|
84
|
+
...(isIfc2x3 ? { StartParam: 0, EndParam: local.length - 1 } : {}),
|
|
85
|
+
}, op)).expressId;
|
|
86
|
+
// Posts: circular, from the path up to the rail's centreline. One shared
|
|
87
|
+
// profile and extrusion direction.
|
|
88
|
+
const postOriginPt = editor.addEntity('IfcCartesianPoint', [[0, 0]]).expressId;
|
|
89
|
+
const postProfilePos = editor.addEntity('IfcAxis2Placement2D', [`#${postOriginPt}`, null]).expressId;
|
|
90
|
+
const postProfile = editor.addEntity('IfcCircleProfileDef', schemaAttributes(registry, 'IfcCircleProfileDef', {
|
|
91
|
+
ProfileType: 'AREA',
|
|
92
|
+
Position: `#${postProfilePos}`,
|
|
93
|
+
Radius: postRadius,
|
|
94
|
+
}, op)).expressId;
|
|
95
|
+
const up = editor.addEntity('IfcDirection', [[0, 0, 1]]).expressId;
|
|
96
|
+
const postSolidIds = railingPostPoints(local, spacing).map((p) => {
|
|
97
|
+
const pt = editor.addEntity('IfcCartesianPoint', [p]).expressId;
|
|
98
|
+
const position = editor.addEntity('IfcAxis2Placement3D', [`#${pt}`, null, null]).expressId;
|
|
99
|
+
return editor.addEntity('IfcExtrudedAreaSolid', [`#${postProfile}`, `#${position}`, `#${up}`, railAxisHeight]).expressId;
|
|
100
|
+
});
|
|
101
|
+
const shapeRepId = editor.addEntity('IfcShapeRepresentation', [
|
|
102
|
+
`#${anchor.bodyContextId}`,
|
|
103
|
+
'Body',
|
|
104
|
+
'SolidModel',
|
|
105
|
+
[railSolidId, ...postSolidIds].map((id) => `#${id}`),
|
|
106
|
+
]).expressId;
|
|
107
|
+
const productShapeId = editor.addEntity('IfcProductDefinitionShape', [null, null, [`#${shapeRepId}`]]).expressId;
|
|
108
|
+
const railingId = editor.addEntity('IfcRailing', schemaAttributes(registry, 'IfcRailing', railingValues(`#${placementId}`, `#${productShapeId}`), op)).expressId;
|
|
109
|
+
const relContainedId = emitRelContainedInSpatialStructure(editor, anchor.ownerHistoryId, railingId, anchor.storeyId, anchor.guidRandom);
|
|
110
|
+
return { railingId, placementId, railSolidId, postSolidIds, shapeRepId, productShapeId, relContainedId };
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=railing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"railing.js","sourceRoot":"","sources":["../../src/in-store/railing.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAsB/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AACjF,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,kCAAkC,EAClC,eAAe,EACf,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAK1E,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAuCnC,MAAM,GAAG,GAAG,CAAC,CAAO,EAAE,CAAO,EAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,MAAM,IAAI,GAAG,CAAC,CAAO,EAAE,CAAO,EAAE,CAAS,EAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GA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
|
+
* `IfcRelConnectsPathElements`: two path elements (walls) joined at their
|
|
3
|
+
* start, end or along the path (#6232 D1). The attribute layout comes from the
|
|
4
|
+
* target schema's registry, so IFC2X3, IFC4 and IFC4X3 are all written right;
|
|
5
|
+
* IFC5 / IFCX are refused.
|
|
6
|
+
*
|
|
7
|
+
* GlobalId, OwnerHistory?, Name?, Description?, ConnectionGeometry?,
|
|
8
|
+
* RelatingElement, RelatedElement, RelatingPriorities, RelatedPriorities,
|
|
9
|
+
* RelatedConnectionType, RelatingConnectionType
|
|
10
|
+
*
|
|
11
|
+
* The priorities are the material-layer priorities at the joint; they are
|
|
12
|
+
* mandatory lists, written empty when the caller has none.
|
|
13
|
+
*
|
|
14
|
+
* Pure: writes through the editor only.
|
|
15
|
+
*/
|
|
16
|
+
import { type RandomSource } from '@ifc-lite/encoding';
|
|
17
|
+
import type { StoreEditor } from '@ifc-lite/mutations';
|
|
18
|
+
import type { SpatialAnchorSchema } from './anchor.js';
|
|
19
|
+
import type { WallConnectionType } from './wall-join.js';
|
|
20
|
+
/** The anchor fields the relationship needs. A full `SpatialAnchor` or an `AuthoringAnchor` both fit. */
|
|
21
|
+
export interface RelConnectsAnchor {
|
|
22
|
+
ownerHistoryId: number | null;
|
|
23
|
+
/** Default IFC4. */
|
|
24
|
+
schema?: SpatialAnchorSchema;
|
|
25
|
+
guidRandom?: RandomSource;
|
|
26
|
+
}
|
|
27
|
+
export interface RelConnectsPathElementsParams {
|
|
28
|
+
/** The element that runs through (for a T, the one whose path is joined). */
|
|
29
|
+
RelatingElement: number;
|
|
30
|
+
RelatedElement: number;
|
|
31
|
+
RelatingConnectionType: WallConnectionType;
|
|
32
|
+
RelatedConnectionType: WallConnectionType;
|
|
33
|
+
/** Layer priorities of the relating element at the joint. Default empty. */
|
|
34
|
+
RelatingPriorities?: readonly number[];
|
|
35
|
+
/** Layer priorities of the related element at the joint. Default empty. */
|
|
36
|
+
RelatedPriorities?: readonly number[];
|
|
37
|
+
Name?: string;
|
|
38
|
+
Description?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare function addRelConnectsPathElementsToStore(editor: StoreEditor, anchor: RelConnectsAnchor, params: RelConnectsPathElementsParams): number;
|
|
41
|
+
/** Validate `params` and lay out the relationship's attributes, without writing anything. */
|
|
42
|
+
export declare function relConnectsPathElementsAttributes(editor: StoreEditor, anchor: RelConnectsAnchor, params: RelConnectsPathElementsParams, op: string): unknown[];
|
|
43
|
+
//# sourceMappingURL=rel-connects-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rel-connects-path.d.ts","sourceRoot":"","sources":["../../src/in-store/rel-connects-path.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,yGAAyG;AACzG,MAAM,WAAW,iBAAiB;IAChC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,oBAAoB;IACpB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B;AAED,MAAM,WAAW,6BAA6B;IAC5C,6EAA6E;IAC7E,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,kBAAkB,CAAC;IAC3C,qBAAqB,EAAE,kBAAkB,CAAC;IAC1C,4EAA4E;IAC5E,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,2EAA2E;IAC3E,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,6BAA6B,GACpC,MAAM,CAGR;AAED,6FAA6F;AAC7F,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,6BAA6B,EACrC,EAAE,EAAE,MAAM,GACT,OAAO,EAAE,CAiCX"}
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
/**
|
|
5
|
+
* `IfcRelConnectsPathElements`: two path elements (walls) joined at their
|
|
6
|
+
* start, end or along the path (#6232 D1). The attribute layout comes from the
|
|
7
|
+
* target schema's registry, so IFC2X3, IFC4 and IFC4X3 are all written right;
|
|
8
|
+
* IFC5 / IFCX are refused.
|
|
9
|
+
*
|
|
10
|
+
* GlobalId, OwnerHistory?, Name?, Description?, ConnectionGeometry?,
|
|
11
|
+
* RelatingElement, RelatedElement, RelatingPriorities, RelatedPriorities,
|
|
12
|
+
* RelatedConnectionType, RelatingConnectionType
|
|
13
|
+
*
|
|
14
|
+
* The priorities are the material-layer priorities at the joint; they are
|
|
15
|
+
* mandatory lists, written empty when the caller has none.
|
|
16
|
+
*
|
|
17
|
+
* Pure: writes through the editor only.
|
|
18
|
+
*/
|
|
19
|
+
import { generateIfcGuid } from '@ifc-lite/encoding';
|
|
20
|
+
import { ownerHistoryRef } from './_emit-helpers.js';
|
|
21
|
+
import { conformsTo, schemaAttributes, schemaRegistry } from './schema-attributes.js';
|
|
22
|
+
const CONNECTION_TYPES = ['ATSTART', 'ATEND', 'ATPATH'];
|
|
23
|
+
export function addRelConnectsPathElementsToStore(editor, anchor, params) {
|
|
24
|
+
const attributes = relConnectsPathElementsAttributes(editor, anchor, params, 'addRelConnectsPathElementsToStore');
|
|
25
|
+
return editor.addEntity('IfcRelConnectsPathElements', attributes).expressId;
|
|
26
|
+
}
|
|
27
|
+
/** Validate `params` and lay out the relationship's attributes, without writing anything. */
|
|
28
|
+
export function relConnectsPathElementsAttributes(editor, anchor, params, op) {
|
|
29
|
+
const registry = schemaRegistry(anchor.schema, op);
|
|
30
|
+
const { RelatingElement: relating, RelatedElement: related } = params;
|
|
31
|
+
for (const id of [relating, related]) {
|
|
32
|
+
if (!Number.isInteger(id) || id <= 0 || !editor.hasEntity(id))
|
|
33
|
+
throw new Error(`${op}: #${id} is not a live entity`);
|
|
34
|
+
const type = editor.getEntityType(id);
|
|
35
|
+
if (!type || !conformsTo(registry, type, 'IfcElement')) {
|
|
36
|
+
throw new Error(`${op}: #${id} is ${type ?? 'unknown'}, not an IfcElement`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (relating === related)
|
|
40
|
+
throw new Error(`${op}: an element cannot connect to itself`);
|
|
41
|
+
for (const value of [params.RelatingConnectionType, params.RelatedConnectionType]) {
|
|
42
|
+
if (!CONNECTION_TYPES.includes(value))
|
|
43
|
+
throw new Error(`${op}: connection type must be ATSTART, ATEND or ATPATH; got ${String(value)}`);
|
|
44
|
+
}
|
|
45
|
+
const priorities = (list, name) => {
|
|
46
|
+
const values = [...(list ?? [])];
|
|
47
|
+
if (values.some((v) => !Number.isInteger(v) || v < 0 || v > 100)) {
|
|
48
|
+
throw new Error(`${op}: ${name} must be integers between 0 and 100`);
|
|
49
|
+
}
|
|
50
|
+
return values;
|
|
51
|
+
};
|
|
52
|
+
return schemaAttributes(registry, 'IfcRelConnectsPathElements', {
|
|
53
|
+
GlobalId: generateIfcGuid(anchor.guidRandom),
|
|
54
|
+
OwnerHistory: ownerHistoryRef(anchor.ownerHistoryId),
|
|
55
|
+
Name: params.Name,
|
|
56
|
+
Description: params.Description,
|
|
57
|
+
RelatingElement: `#${relating}`,
|
|
58
|
+
RelatedElement: `#${related}`,
|
|
59
|
+
RelatingPriorities: priorities(params.RelatingPriorities, 'RelatingPriorities'),
|
|
60
|
+
RelatedPriorities: priorities(params.RelatedPriorities, 'RelatedPriorities'),
|
|
61
|
+
RelatedConnectionType: params.RelatedConnectionType,
|
|
62
|
+
RelatingConnectionType: params.RelatingConnectionType,
|
|
63
|
+
}, op);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=rel-connects-path.js.map
|