brepjs-bim 0.1.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/LICENSE +191 -0
- package/README.md +100 -0
- package/dist/bcf/bcfRead.d.ts +11 -0
- package/dist/bcf/bcfTypes.d.ts +81 -0
- package/dist/bcf/bcfWrite.d.ts +14 -0
- package/dist/bcf/bcfXml.d.ts +34 -0
- package/dist/bcf/index.d.ts +3 -0
- package/dist/brepjs-bim.cjs +15935 -0
- package/dist/brepjs-bim.js +15822 -0
- package/dist/cobie/cobieExport.d.ts +20 -0
- package/dist/cobie/cobieTypes.d.ts +130 -0
- package/dist/cobie/index.d.ts +2 -0
- package/dist/elementFns/beamFns.d.ts +4 -0
- package/dist/elementFns/columnFns.d.ts +4 -0
- package/dist/elementFns/coveringFns.d.ts +4 -0
- package/dist/elementFns/curtainWallFns.d.ts +32 -0
- package/dist/elementFns/foundationFns.d.ts +5 -0
- package/dist/elementFns/openingFns.d.ts +4 -0
- package/dist/elementFns/profileFns.d.ts +5 -0
- package/dist/elementFns/railingFns.d.ts +4 -0
- package/dist/elementFns/rampFns.d.ts +14 -0
- package/dist/elementFns/roofFns.d.ts +4 -0
- package/dist/elementFns/slabFns.d.ts +4 -0
- package/dist/elementFns/slabOpeningFns.d.ts +4 -0
- package/dist/elementFns/spaceFns.d.ts +4 -0
- package/dist/elementFns/stairFns.d.ts +15 -0
- package/dist/elementFns/wallFns.d.ts +4 -0
- package/dist/errors/bimError.d.ts +39 -0
- package/dist/identity/guidDerivation.d.ts +25 -0
- package/dist/identity/ifcGuid.d.ts +7 -0
- package/dist/identity/localId.d.ts +10 -0
- package/dist/ids/idsCheck.d.ts +22 -0
- package/dist/ids/idsFacets.d.ts +21 -0
- package/dist/ids/idsParser.d.ts +20 -0
- package/dist/ids/idsTypes.d.ts +87 -0
- package/dist/ids/idsXml.d.ts +24 -0
- package/dist/ids/index.d.ts +3 -0
- package/dist/ifc-writer/assemblyWriter.d.ts +26 -0
- package/dist/ifc-writer/classificationWriter.d.ts +18 -0
- package/dist/ifc-writer/connectivityWriter.d.ts +16 -0
- package/dist/ifc-writer/coveringWriter.d.ts +12 -0
- package/dist/ifc-writer/curtainWallWriter.d.ts +23 -0
- package/dist/ifc-writer/entityWriter.d.ts +21 -0
- package/dist/ifc-writer/foundationWriter.d.ts +11 -0
- package/dist/ifc-writer/geometryWriter.d.ts +25 -0
- package/dist/ifc-writer/groupWriter.d.ts +19 -0
- package/dist/ifc-writer/headerWriter.d.ts +31 -0
- package/dist/ifc-writer/ifcWriter.d.ts +27 -0
- package/dist/ifc-writer/materialWriter.d.ts +39 -0
- package/dist/ifc-writer/openingWriter.d.ts +24 -0
- package/dist/ifc-writer/ownerHistoryWriter.d.ts +30 -0
- package/dist/ifc-writer/profileDefWriter.d.ts +3 -0
- package/dist/ifc-writer/proxyWriter.d.ts +17 -0
- package/dist/ifc-writer/psetWriter.d.ts +67 -0
- package/dist/ifc-writer/railingWriter.d.ts +11 -0
- package/dist/ifc-writer/relWriter.d.ts +4 -0
- package/dist/ifc-writer/roofWriter.d.ts +21 -0
- package/dist/ifc-writer/schemaVersion.d.ts +36 -0
- package/dist/ifc-writer/spaceWriter.d.ts +11 -0
- package/dist/ifc-writer/stairWriter.d.ts +49 -0
- package/dist/ifc-writer/styleWriter.d.ts +30 -0
- package/dist/ifc-writer/tessellationWriter.d.ts +42 -0
- package/dist/ifc-writer/typeWriter.d.ts +13 -0
- package/dist/import/dataRead.d.ts +65 -0
- package/dist/import/fromIfc.d.ts +24 -0
- package/dist/import/geometryRead.d.ts +41 -0
- package/dist/import/importedModel.d.ts +95 -0
- package/dist/import/placement.d.ts +89 -0
- package/dist/import/spatialTree.d.ts +35 -0
- package/dist/import/spfReader.d.ts +55 -0
- package/dist/index.d.ts +95 -0
- package/dist/model/bimModel.d.ts +151 -0
- package/dist/psets/psetTemplates.d.ts +41 -0
- package/dist/psets/qtoWeights.d.ts +32 -0
- package/dist/serialize/toIfc.d.ts +19 -0
- package/dist/specs/assemblySpec.d.ts +15 -0
- package/dist/specs/beamSpec.d.ts +34 -0
- package/dist/specs/columnSpec.d.ts +34 -0
- package/dist/specs/coveringSpec.d.ts +33 -0
- package/dist/specs/curtainWallSpec.d.ts +37 -0
- package/dist/specs/foundationSpec.d.ts +50 -0
- package/dist/specs/groupSpec.d.ts +27 -0
- package/dist/specs/materialSpec.d.ts +19 -0
- package/dist/specs/openingSpec.d.ts +42 -0
- package/dist/specs/profile.d.ts +108 -0
- package/dist/specs/profilesExtended.d.ts +86 -0
- package/dist/specs/proxySpec.d.ts +20 -0
- package/dist/specs/railingSpec.d.ts +32 -0
- package/dist/specs/rampSpec.d.ts +26 -0
- package/dist/specs/roofSpec.d.ts +32 -0
- package/dist/specs/slabSpec.d.ts +36 -0
- package/dist/specs/spaceSpec.d.ts +24 -0
- package/dist/specs/spatialSpec.d.ts +24 -0
- package/dist/specs/stairSpec.d.ts +24 -0
- package/dist/specs/styleSpec.d.ts +5 -0
- package/dist/specs/wallSpec.d.ts +33 -0
- package/dist/types/bimTypes.d.ts +49 -0
- package/dist/types/classificationTypes.d.ts +16 -0
- package/dist/types/materialTypes.d.ts +14 -0
- package/dist/types/relationships.d.ts +116 -0
- package/dist/units/units.d.ts +7 -0
- package/dist/validation/geometryValidity.d.ts +20 -0
- package/dist/validation/referentialIntegrity.d.ts +24 -0
- package/dist/validation/roundTrip.d.ts +36 -0
- package/dist/validation/schemaCheck.d.ts +14 -0
- package/dist/validation/severity.d.ts +18 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding any notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2025-2026 Andy Aragon
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# brepjs-bim
|
|
2
|
+
|
|
3
|
+
> Experimental, unpublished satellite package.
|
|
4
|
+
|
|
5
|
+
A BIM (Building Information Modeling) layer for [brepjs](https://github.com/andymai/brepjs). It
|
|
6
|
+
authors IFC4-aligned parametric building elements (walls, slabs, beams, columns, roofs, curtain
|
|
7
|
+
walls, stairs, …), assembles them into a spatial structure (project → site → building → storey),
|
|
8
|
+
and serializes the result to a valid **IFC-SPF** file — with a matching importer to read IFC back in.
|
|
9
|
+
|
|
10
|
+
Pipeline: **author spec → `BimModel` (typed element + brepjs geometry) → spatial structure +
|
|
11
|
+
property sets + classification → export IFC / COBie, validate, round-trip.**
|
|
12
|
+
|
|
13
|
+
## Scope
|
|
14
|
+
|
|
15
|
+
Parametric authoring of the common IFC4 building elements plus the data layers that make a model
|
|
16
|
+
useful downstream (psets, classification, materials, quantities), with import, export, and
|
|
17
|
+
validation. Geometry is produced by brepjs (OCCT); each element carries a `ValidSolid` (or, for
|
|
18
|
+
curtain walls, a panel/mullion grid). Element geometry is **unplaced template geometry** in local
|
|
19
|
+
coordinates — placement (`origin` / `axisX` / `axisZ`) is applied by the IFC layer via
|
|
20
|
+
`IfcLocalPlacement`, not baked into the brepjs solid.
|
|
21
|
+
|
|
22
|
+
- Units default to mm; IFC export emits SI metres.
|
|
23
|
+
- Stable identity: deterministic IFC GUIDs (`deriveIfcGuid`) and local id counters.
|
|
24
|
+
|
|
25
|
+
## Status
|
|
26
|
+
|
|
27
|
+
| Area | State |
|
|
28
|
+
| ----------------- | -------------------------------------------------------------------------------------------------------- |
|
|
29
|
+
| Elements | wall, slab, beam, column, roof, curtain wall, space, footing/pile, stair, ramp, railing, covering, proxy |
|
|
30
|
+
| Profiles | rectangular / circular / I-shape cores + extended L/T/U/Z/C, hollow, ellipse, arbitrary-with-voids |
|
|
31
|
+
| Openings | door / window / slab openings cut as boolean voids; `FillsOpening` / `Voids*` relationships |
|
|
32
|
+
| Spatial structure | project → site → building → storey aggregation; `placeIn` to assign elements to a storey |
|
|
33
|
+
| Property sets | IFC pset templates + measure types; quantity sets for takeoff |
|
|
34
|
+
| Data layers | materials (layer/profile/simple sets), classification refs, surface styles, zones/systems |
|
|
35
|
+
| IFC export | `toIfc` → IFC-SPF (`Uint8Array`); IFC2X3 / IFC4 schema selection; owner history |
|
|
36
|
+
| IFC import | `fromIfc` / `SpfReader` → `ImportedModel` (elements, geometry, psets, materials, spatial tree) |
|
|
37
|
+
| Validation | referential integrity, schema check, geometry validity, IFC round-trip report |
|
|
38
|
+
| Interop | COBie 2.4 export (CSV/JSON), IDS 1.0 checking, BCF 3.0 read/write |
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
Author a small model and export IFC:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { BimModel, toIfc } from 'brepjs-bim';
|
|
46
|
+
|
|
47
|
+
const model = new BimModel();
|
|
48
|
+
model.init({ name: 'Example' });
|
|
49
|
+
|
|
50
|
+
// Spatial structure: project → site → building → storey.
|
|
51
|
+
const project = model.getProject();
|
|
52
|
+
const siteId = model.addSite({ name: 'Site' });
|
|
53
|
+
const buildingId = model.addBuilding({ name: 'Building' });
|
|
54
|
+
const storeyId = model.addStorey({ name: 'Level 1', elevation: 0 });
|
|
55
|
+
if (project) model.aggregate(project.localId, siteId);
|
|
56
|
+
model.aggregate(siteId, buildingId);
|
|
57
|
+
model.aggregate(buildingId, storeyId);
|
|
58
|
+
|
|
59
|
+
// A parametric wall, placed on the storey. Dimensions in mm; axisX is the wall's
|
|
60
|
+
// length direction and axisZ its up direction.
|
|
61
|
+
const wall = model.addWall({
|
|
62
|
+
length: 4000,
|
|
63
|
+
height: 3000,
|
|
64
|
+
thickness: 200,
|
|
65
|
+
origin: [0, 0, 0],
|
|
66
|
+
axisX: [1, 0, 0],
|
|
67
|
+
axisZ: [0, 0, 1],
|
|
68
|
+
materialName: 'Concrete',
|
|
69
|
+
});
|
|
70
|
+
if (wall.ok) model.placeIn(wall.value, storeyId);
|
|
71
|
+
|
|
72
|
+
// Renderable geometry (a brepjs ValidSolid, unplaced/local coords):
|
|
73
|
+
const solid = model.getWalls()[0]?.geometry;
|
|
74
|
+
|
|
75
|
+
// Serialize to an IFC-SPF byte buffer.
|
|
76
|
+
const ifc = await toIfc(model, { name: 'Example', author: 'brepjs-bim' });
|
|
77
|
+
// ifc.ok && ifc.value instanceof Uint8Array
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Reading element geometry requires only the core brepjs kernel; `toIfc` / `fromIfc` additionally load
|
|
81
|
+
the `web-ifc` peer dependency.
|
|
82
|
+
|
|
83
|
+
All public operations return `Result<T, BimError>` (from `brepjs`); validation issues and non-fatal
|
|
84
|
+
warnings travel inside the payload rather than throwing.
|
|
85
|
+
|
|
86
|
+
## Design
|
|
87
|
+
|
|
88
|
+
Each `add*` call parses and validates the spec (the `parse*Spec` functions are also exported for
|
|
89
|
+
standalone use), builds the brepjs solid analytically from the spec, and stores a typed `BimElement`
|
|
90
|
+
keyed by a `LocalId`. The IFC writer walks the model, applies placement, and emits schema-correct
|
|
91
|
+
IFC entities; the importer is the inverse. No kernel/WASM changes are required.
|
|
92
|
+
|
|
93
|
+
## Development
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
npm run typecheck --workspace=brepjs-bim
|
|
97
|
+
npm run lint --workspace=brepjs-bim
|
|
98
|
+
npm run build --workspace=brepjs-bim
|
|
99
|
+
npm run test --workspace=brepjs-bim
|
|
100
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Result } from 'brepjs';
|
|
2
|
+
import { BimError } from '../errors/bimError.js';
|
|
3
|
+
import { BcfContainerData, BcfFiles } from './bcfTypes.js';
|
|
4
|
+
/**
|
|
5
|
+
* Parse an unzipped BCF 3.0 container (`Map<path, xml-string>`) back into the
|
|
6
|
+
* typed data model. The inverse of `serializeBcfFiles`.
|
|
7
|
+
*
|
|
8
|
+
* `FLAG: BCF_ZIP_PACKAGING_ABSENT` — callers holding a `.bcfzip` binary must
|
|
9
|
+
* unzip it into a `Map<path, string>` (external ZIP library) before calling.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseBcfFiles(files: BcfFiles): Result<BcfContainerData, BimError>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BCF 3.0 (BIM Collaboration Format) typed data model.
|
|
3
|
+
*
|
|
4
|
+
* Container packaging note (`FLAG: BCF_ZIP_PACKAGING_ABSENT`): a real `.bcfzip`
|
|
5
|
+
* is a ZIP archive of these XML files. No declared ZIP dependency exists in the
|
|
6
|
+
* brepjs-bim workspace, so this module's stable interchange surface is the
|
|
7
|
+
* unzipped structure: `BcfFiles = Map<path, xml-string>`. Callers that need the
|
|
8
|
+
* binary `.bcfzip` must bring their own ZIP library and pack/unpack the map.
|
|
9
|
+
*/
|
|
10
|
+
/** Unzipped BCF container: archive path → XML file contents. */
|
|
11
|
+
export type BcfFiles = Map<string, string>;
|
|
12
|
+
export interface BcfContainerData {
|
|
13
|
+
readonly version: BcfVersion;
|
|
14
|
+
readonly project: BcfProject;
|
|
15
|
+
readonly topics: readonly BcfTopic[];
|
|
16
|
+
}
|
|
17
|
+
export interface BcfVersion {
|
|
18
|
+
readonly versionId: '3.0';
|
|
19
|
+
readonly detailedVersion?: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface BcfProject {
|
|
22
|
+
readonly projectId: string;
|
|
23
|
+
readonly name: string;
|
|
24
|
+
}
|
|
25
|
+
export interface BcfTopic {
|
|
26
|
+
readonly guid: string;
|
|
27
|
+
readonly title: string;
|
|
28
|
+
readonly topicType?: string | undefined;
|
|
29
|
+
readonly topicStatus?: string | undefined;
|
|
30
|
+
readonly priority?: string | undefined;
|
|
31
|
+
readonly index?: number | undefined;
|
|
32
|
+
readonly labels?: readonly string[] | undefined;
|
|
33
|
+
/** ISO 8601 timestamp. */
|
|
34
|
+
readonly creationDate?: string | undefined;
|
|
35
|
+
readonly creationAuthor?: string | undefined;
|
|
36
|
+
readonly modifiedDate?: string | undefined;
|
|
37
|
+
readonly modifiedAuthor?: string | undefined;
|
|
38
|
+
readonly description?: string | undefined;
|
|
39
|
+
readonly assignedTo?: string | undefined;
|
|
40
|
+
readonly dueDate?: string | undefined;
|
|
41
|
+
readonly comments: readonly BcfComment[];
|
|
42
|
+
readonly viewpoints: readonly BcfViewpoint[];
|
|
43
|
+
readonly relatedTopics?: readonly string[] | undefined;
|
|
44
|
+
}
|
|
45
|
+
export interface BcfComment {
|
|
46
|
+
readonly guid: string;
|
|
47
|
+
readonly date: string;
|
|
48
|
+
readonly author: string;
|
|
49
|
+
readonly comment: string;
|
|
50
|
+
/** GUID of a viewpoint owned by the same topic. */
|
|
51
|
+
readonly viewpointRef?: string | undefined;
|
|
52
|
+
readonly modifiedDate?: string | undefined;
|
|
53
|
+
readonly modifiedAuthor?: string | undefined;
|
|
54
|
+
}
|
|
55
|
+
export interface BcfViewpoint {
|
|
56
|
+
readonly guid: string;
|
|
57
|
+
readonly viewpointFile?: string | undefined;
|
|
58
|
+
readonly snapshotFile?: string | undefined;
|
|
59
|
+
readonly index?: number | undefined;
|
|
60
|
+
readonly components?: BcfComponents | undefined;
|
|
61
|
+
}
|
|
62
|
+
export interface BcfComponents {
|
|
63
|
+
readonly selection?: readonly BcfComponent[] | undefined;
|
|
64
|
+
readonly coloring?: readonly BcfColoring[] | undefined;
|
|
65
|
+
readonly visibility?: BcfVisibility | undefined;
|
|
66
|
+
}
|
|
67
|
+
export interface BcfComponent {
|
|
68
|
+
/** IFC GlobalId of the referenced element. */
|
|
69
|
+
readonly ifcGuid?: string | undefined;
|
|
70
|
+
readonly originatingSystem?: string | undefined;
|
|
71
|
+
readonly authoringToolId?: string | undefined;
|
|
72
|
+
}
|
|
73
|
+
export interface BcfColoring {
|
|
74
|
+
/** Hex ARGB colour, e.g. `FFFF0000`. */
|
|
75
|
+
readonly color: string;
|
|
76
|
+
readonly components: readonly BcfComponent[];
|
|
77
|
+
}
|
|
78
|
+
export interface BcfVisibility {
|
|
79
|
+
readonly defaultVisibility: boolean;
|
|
80
|
+
readonly exceptions?: readonly BcfComponent[] | undefined;
|
|
81
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BcfContainerData, BcfFiles } from './bcfTypes.js';
|
|
2
|
+
/**
|
|
3
|
+
* Serialize a BCF 3.0 container into its unzipped file structure
|
|
4
|
+
* (`Map<path, xml-string>`):
|
|
5
|
+
*
|
|
6
|
+
* - `bcf.version` — container version marker
|
|
7
|
+
* - `project.bcfp` — project metadata
|
|
8
|
+
* - `{topicGuid}/markup.bcf` — one markup file per topic (topic, comments, viewpoints)
|
|
9
|
+
*
|
|
10
|
+
* `FLAG: BCF_ZIP_PACKAGING_ABSENT` — to produce an actual `.bcfzip`, ZIP these
|
|
11
|
+
* entries with an external library; no ZIP dependency is declared in the
|
|
12
|
+
* workspace.
|
|
13
|
+
*/
|
|
14
|
+
export declare function serializeBcfFiles(data: BcfContainerData): BcfFiles;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal, zero-dependency XML helpers scoped to the BCF 3.0 subset.
|
|
3
|
+
*
|
|
4
|
+
* `DOMParser`/`XMLSerializer` are not available as Node globals (verified on
|
|
5
|
+
* Node 24.13), so BCF emission and parsing are done with hand-rolled helpers.
|
|
6
|
+
* The BCF XML used here is shallow and namespace-light, which keeps this safe.
|
|
7
|
+
*/
|
|
8
|
+
/** Escape text content for `<tag>…</tag>` bodies. */
|
|
9
|
+
export declare function escapeXmlText(value: string): string;
|
|
10
|
+
/** Escape a double-quoted attribute value. */
|
|
11
|
+
export declare function escapeXmlAttr(value: string): string;
|
|
12
|
+
/** Reverse the entity escaping applied above (text and attribute share entities). */
|
|
13
|
+
export declare function unescapeXml(value: string): string;
|
|
14
|
+
export declare function xmlDocument(rootXml: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* A parsed XML element node. Only the structure needed by the BCF reader is
|
|
17
|
+
* retained: tag name, attributes, child elements, and concatenated text.
|
|
18
|
+
*/
|
|
19
|
+
export interface XmlNode {
|
|
20
|
+
readonly tag: string;
|
|
21
|
+
readonly attrs: Readonly<Record<string, string>>;
|
|
22
|
+
readonly children: readonly XmlNode[];
|
|
23
|
+
/** Direct text content with entities decoded. */
|
|
24
|
+
readonly text: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Parse an XML string into a tree. Tolerant of the XML declaration, comments,
|
|
28
|
+
* whitespace, self-closing tags, and CDATA-free text. Throws on malformed
|
|
29
|
+
* structure (unbalanced tags); callers wrap this in a `Result`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseXml(xml: string): XmlNode;
|
|
32
|
+
export declare function findChild(node: XmlNode, tag: string): XmlNode | undefined;
|
|
33
|
+
export declare function findChildren(node: XmlNode, tag: string): readonly XmlNode[];
|
|
34
|
+
export declare function childText(node: XmlNode, tag: string): string | undefined;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { BcfColoring, BcfComment, BcfComponent, BcfComponents, BcfContainerData, BcfFiles, BcfProject, BcfTopic, BcfVersion, BcfViewpoint, BcfVisibility, } from './bcfTypes.js';
|
|
2
|
+
export { serializeBcfFiles } from './bcfWrite.js';
|
|
3
|
+
export { parseBcfFiles } from './bcfRead.js';
|