@margoengine/ifc 0.0.0-stage → 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 +201 -0
- package/NOTICE +4 -0
- package/NOTICE.md +16 -0
- package/README.md +366 -3
- package/dist/bcf-wKfMzfyy.js +871 -0
- package/dist/bcf.d.ts +274 -0
- package/dist/bcf.js +1 -0
- package/dist/data-CuTaQPFm.js +534 -0
- package/dist/data.d.ts +205 -0
- package/dist/data.js +1 -0
- package/dist/ids.d.ts +199 -0
- package/dist/ids.js +759 -0
- package/dist/ifc-stream.worker.d.ts +1 -0
- package/dist/ifc.worker.d.ts +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +116 -0
- package/dist/meshes.d.ts +75 -0
- package/dist/open-D1NQyRTk.js +181 -0
- package/dist/open.d.ts +39 -0
- package/dist/predefined-enums.d.ts +2 -0
- package/dist/query.d.ts +62 -0
- package/dist/query.js +92 -0
- package/dist/raw.d.ts +7 -0
- package/dist/scene.d.ts +187 -0
- package/dist/scene.js +642 -0
- package/dist/schema-B_VBQpdF.js +51 -0
- package/dist/schema-tree.d.ts +2 -0
- package/dist/schema.d.ts +16 -0
- package/dist/section.d.ts +95 -0
- package/dist/section.js +380 -0
- package/dist/step.d.ts +1 -0
- package/dist/tolerance-CAOnp3Mo.js +7 -0
- package/dist/tolerance.d.ts +2 -0
- package/dist/units-B32iYdmV.js +134 -0
- package/dist/units.d.ts +33 -0
- package/dist/worker.d.ts +38 -0
- package/dist/worker.js +108 -0
- package/dist/workers/ifc-stream.js +1 -0
- package/dist/workers/ifc.js +1 -0
- package/dist/write.d.ts +113 -0
- package/dist/write.js +546 -0
- package/package.json +102 -6
package/dist/bcf.d.ts
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { type ZipOptions } from '@margoengine/loaders/common';
|
|
2
|
+
import { type IFCData } from './data.js';
|
|
3
|
+
type Vec3 = [number, number, number];
|
|
4
|
+
/** A component: an IFC GlobalId, or the authoring tool's own ID as a fallback. */
|
|
5
|
+
export interface BCFComponent {
|
|
6
|
+
ifcGuid?: string;
|
|
7
|
+
originatingSystem?: string;
|
|
8
|
+
authoringToolId?: string;
|
|
9
|
+
}
|
|
10
|
+
/** The one camera of a viewpoint, in IFC world meters (Z up). */
|
|
11
|
+
export interface BCFCamera {
|
|
12
|
+
type: 'perspective' | 'orthogonal';
|
|
13
|
+
position: Vec3;
|
|
14
|
+
direction: Vec3;
|
|
15
|
+
up: Vec3;
|
|
16
|
+
/** Perspective: the entire vertical field of view in degrees, (0, 180). */
|
|
17
|
+
fieldOfView?: number;
|
|
18
|
+
/** Orthogonal: the visible vertical size in meters. */
|
|
19
|
+
viewToWorldScale?: number;
|
|
20
|
+
/** Width / height. 1 when a BCF 2.x or 1.0 file has none, as BCF 3.0 asks. */
|
|
21
|
+
aspectRatio: number;
|
|
22
|
+
}
|
|
23
|
+
/** A bitmap placed in the model; `data` holds the image when it was read from an archive or JSON. */
|
|
24
|
+
export interface BCFBitmap {
|
|
25
|
+
format: 'png' | 'jpg';
|
|
26
|
+
reference: string;
|
|
27
|
+
location: Vec3;
|
|
28
|
+
normal: Vec3;
|
|
29
|
+
up: Vec3;
|
|
30
|
+
/** Height in meters. */
|
|
31
|
+
height: number;
|
|
32
|
+
data?: Uint8Array;
|
|
33
|
+
}
|
|
34
|
+
/** One BCF viewpoint (a .bcfv file or a BCF-API viewpoint). */
|
|
35
|
+
export interface BCFViewpoint {
|
|
36
|
+
/** Lower-case UUID. */
|
|
37
|
+
guid: string;
|
|
38
|
+
/** Required by BCF 3.0; a 2.x viewpoint may have none. */
|
|
39
|
+
camera?: BCFCamera;
|
|
40
|
+
/** Components to show selected. */
|
|
41
|
+
selection: BCFComponent[];
|
|
42
|
+
/** Visible unless listed in `exceptions` (true), or hidden unless listed (false, the BCF default). */
|
|
43
|
+
defaultVisibility: boolean;
|
|
44
|
+
exceptions: BCFComponent[];
|
|
45
|
+
/** View setup hints, applied after `defaultVisibility` and before `exceptions`. Default false each. */
|
|
46
|
+
spacesVisible: boolean;
|
|
47
|
+
spaceBoundariesVisible: boolean;
|
|
48
|
+
openingsVisible: boolean;
|
|
49
|
+
/** Colours as BCF writes them: `RRGGBB` or `AARRGGBB` hex. */
|
|
50
|
+
coloring: {
|
|
51
|
+
color: string;
|
|
52
|
+
components: BCFComponent[];
|
|
53
|
+
}[];
|
|
54
|
+
lines: {
|
|
55
|
+
start: Vec3;
|
|
56
|
+
end: Vec3;
|
|
57
|
+
}[];
|
|
58
|
+
/** `direction` points into the clipped (invisible) half-space. */
|
|
59
|
+
clippingPlanes: {
|
|
60
|
+
location: Vec3;
|
|
61
|
+
direction: Vec3;
|
|
62
|
+
}[];
|
|
63
|
+
bitmaps: BCFBitmap[];
|
|
64
|
+
snapshot?: {
|
|
65
|
+
format: 'png' | 'jpg';
|
|
66
|
+
data: Uint8Array;
|
|
67
|
+
};
|
|
68
|
+
/** Sort order within its topic. */
|
|
69
|
+
index?: number;
|
|
70
|
+
}
|
|
71
|
+
/** A comment of a topic; `viewpoint` is the GUID of the one viewpoint it refers to. */
|
|
72
|
+
export interface BCFComment {
|
|
73
|
+
guid: string;
|
|
74
|
+
date: string;
|
|
75
|
+
author: string;
|
|
76
|
+
comment?: string;
|
|
77
|
+
viewpoint?: string;
|
|
78
|
+
modifiedDate?: string;
|
|
79
|
+
modifiedAuthor?: string;
|
|
80
|
+
}
|
|
81
|
+
/** An IFC file a topic refers to (the markup Header). */
|
|
82
|
+
export interface BCFFile {
|
|
83
|
+
filename?: string;
|
|
84
|
+
date?: string;
|
|
85
|
+
reference?: string;
|
|
86
|
+
ifcProject?: string;
|
|
87
|
+
ifcSpatialStructureElement?: string;
|
|
88
|
+
/** Default true. */
|
|
89
|
+
isExternal: boolean;
|
|
90
|
+
}
|
|
91
|
+
/** A topic (an issue) with its comments and viewpoints. Dates are xs:dateTime strings. */
|
|
92
|
+
export interface BCFTopic {
|
|
93
|
+
guid: string;
|
|
94
|
+
serverAssignedId?: string;
|
|
95
|
+
type: string;
|
|
96
|
+
status: string;
|
|
97
|
+
title: string;
|
|
98
|
+
priority?: string;
|
|
99
|
+
index?: number;
|
|
100
|
+
labels: string[];
|
|
101
|
+
referenceLinks: string[];
|
|
102
|
+
creationDate: string;
|
|
103
|
+
creationAuthor: string;
|
|
104
|
+
modifiedDate?: string;
|
|
105
|
+
modifiedAuthor?: string;
|
|
106
|
+
dueDate?: string;
|
|
107
|
+
assignedTo?: string;
|
|
108
|
+
stage?: string;
|
|
109
|
+
description?: string;
|
|
110
|
+
files: BCFFile[];
|
|
111
|
+
/** `data` holds the snippet file of an internal snippet read from an archive. */
|
|
112
|
+
bimSnippet?: {
|
|
113
|
+
type: string;
|
|
114
|
+
reference: string;
|
|
115
|
+
referenceSchema: string;
|
|
116
|
+
isExternal: boolean;
|
|
117
|
+
data?: Uint8Array;
|
|
118
|
+
};
|
|
119
|
+
/** BCF 3.0 names a document of the archive (`documentGuid`) or a `url`; a BCF 2.1 ReferencedDocument is a `url`. */
|
|
120
|
+
documentReferences: {
|
|
121
|
+
guid?: string;
|
|
122
|
+
documentGuid?: string;
|
|
123
|
+
url?: string;
|
|
124
|
+
description?: string;
|
|
125
|
+
}[];
|
|
126
|
+
relatedTopics: string[];
|
|
127
|
+
comments: BCFComment[];
|
|
128
|
+
viewpoints: BCFViewpoint[];
|
|
129
|
+
}
|
|
130
|
+
/** The lists a project allows (BCF 3.0 extensions.xml). */
|
|
131
|
+
export interface BCFExtensions {
|
|
132
|
+
topicTypes: string[];
|
|
133
|
+
topicStatuses: string[];
|
|
134
|
+
priorities: string[];
|
|
135
|
+
topicLabels: string[];
|
|
136
|
+
users: string[];
|
|
137
|
+
snippetTypes: string[];
|
|
138
|
+
stages: string[];
|
|
139
|
+
}
|
|
140
|
+
/** The contents of a .bcf archive. */
|
|
141
|
+
export interface BCFArchive {
|
|
142
|
+
/** `3.0`, `2.1`, `2.0` or `1.0` when read; what writeBCF writes is its `version` option. */
|
|
143
|
+
version: string;
|
|
144
|
+
project?: {
|
|
145
|
+
id: string;
|
|
146
|
+
name?: string;
|
|
147
|
+
};
|
|
148
|
+
extensions?: BCFExtensions;
|
|
149
|
+
/** BCF 3.0 documents (documents.xml and the Documents folder). */
|
|
150
|
+
documents: {
|
|
151
|
+
guid: string;
|
|
152
|
+
filename: string;
|
|
153
|
+
description?: string;
|
|
154
|
+
data?: Uint8Array;
|
|
155
|
+
}[];
|
|
156
|
+
topics: BCFTopic[];
|
|
157
|
+
}
|
|
158
|
+
/** Reads a .bcfv viewpoint: BCF 3.0, 2.1 (hints on Components, Color without Components, Bitmap elements) or 1.0. */
|
|
159
|
+
export declare function parseBCFViewpoint(source: string | Uint8Array): BCFViewpoint;
|
|
160
|
+
/** Options of the BCF writers. */
|
|
161
|
+
export interface BCFWriteOptions {
|
|
162
|
+
/** The BCF version to write. Default `3.0`. */
|
|
163
|
+
version?: '3.0' | '2.1';
|
|
164
|
+
}
|
|
165
|
+
/** Writes a viewpoint as a .bcfv file of BCF 3.0 (default) or 2.1. */
|
|
166
|
+
export declare function writeBCFViewpoint(vp: BCFViewpoint, options?: BCFWriteOptions): string;
|
|
167
|
+
type Json = any;
|
|
168
|
+
/** Reads a BCF-API 3.0 viewpoint object (snake_case; snapshot and bitmaps as base64). */
|
|
169
|
+
export declare function viewpointFromBCFJSON(json: Json): BCFViewpoint;
|
|
170
|
+
/** A BCF-API 3.0 viewpoint object (snake_case), ready for JSON.stringify or a POST to a BCF server. */
|
|
171
|
+
export declare function viewpointToBCFJSON(vp: BCFViewpoint): Record<string, unknown>;
|
|
172
|
+
/** A new lower-case UUID (version 4) for a topic, comment, viewpoint or document. */
|
|
173
|
+
export declare function newBCFGuid(): string;
|
|
174
|
+
/** Options of readBCF: the zip limits of @margoengine/loaders and an AbortSignal. */
|
|
175
|
+
export type BCFReadOptions = ZipOptions;
|
|
176
|
+
/**
|
|
177
|
+
* Reads a .bcf (or .bcfzip) archive of BCF 3.0, 2.1, 2.0 or 1.0: version, project, extensions, documents, and every
|
|
178
|
+
* topic folder's markup with its comments, viewpoints (in Index order), snapshots and bitmaps. Unknown files and
|
|
179
|
+
* elements are ignored, as BCF asks.
|
|
180
|
+
*/
|
|
181
|
+
export declare function readBCF(bytes: Uint8Array | ArrayBuffer, options?: BCFReadOptions): Promise<BCFArchive>;
|
|
182
|
+
/**
|
|
183
|
+
* Writes a .bcf archive of BCF 3.0 (default) or 2.1: bcf.version, project.bcfp, extensions.xml and documents.xml
|
|
184
|
+
* (3.0), one folder per topic with markup.bcf, its viewpoints (`<guid>.bcfv`), snapshots and bitmap images.
|
|
185
|
+
*/
|
|
186
|
+
export declare function writeBCF(archive: Pick<BCFArchive, 'topics'> & Partial<BCFArchive>, options?: BCFWriteOptions): Uint8Array;
|
|
187
|
+
type Plane = [number, number, number, number];
|
|
188
|
+
type RGBA = [number, number, number, number];
|
|
189
|
+
/** A viewpoint as a Margo view: engine axes and the model's rebased origin, components as expressIDs. */
|
|
190
|
+
export interface BCFView {
|
|
191
|
+
/** `position` and `target` for a core Camera (`fov` in degrees), or `height` for an orthographic CameraProjection. */
|
|
192
|
+
camera?: {
|
|
193
|
+
type: 'perspective' | 'orthogonal';
|
|
194
|
+
position: Vec3;
|
|
195
|
+
target: Vec3;
|
|
196
|
+
/** Unit view direction (target - position, normalized). */
|
|
197
|
+
direction: Vec3;
|
|
198
|
+
up: Vec3;
|
|
199
|
+
/** Perspective: vertical field of view in degrees. */
|
|
200
|
+
fov?: number;
|
|
201
|
+
/** Orthogonal: visible vertical size in meters. */
|
|
202
|
+
height?: number;
|
|
203
|
+
aspect: number;
|
|
204
|
+
};
|
|
205
|
+
/** Every product occurrence (IfcProduct) the viewpoint shows, and every one it hides, in expressID order. */
|
|
206
|
+
visible: number[];
|
|
207
|
+
hidden: number[];
|
|
208
|
+
selected: number[];
|
|
209
|
+
/** sRGB colour and alpha, each 0..1, per element; a container's colour is applied to its parts. */
|
|
210
|
+
colors: Map<number, RGBA>;
|
|
211
|
+
/** Planes for a material's `clippingPlanes`: `a x + b y + c z + d < 0` is cut away. */
|
|
212
|
+
clippingPlanes: Plane[];
|
|
213
|
+
lines: {
|
|
214
|
+
start: Vec3;
|
|
215
|
+
end: Vec3;
|
|
216
|
+
}[];
|
|
217
|
+
/** Components no element of this model matches (another model, or a removed element). */
|
|
218
|
+
unresolved: BCFComponent[];
|
|
219
|
+
}
|
|
220
|
+
/** Options of viewFromBCF and bcfFromView. */
|
|
221
|
+
export interface BCFViewOptions {
|
|
222
|
+
/** The engine-axes origin the geometry was rebased by (`readIFCGeometry`'s `origin`). Default [0, 0, 0]. */
|
|
223
|
+
origin?: readonly number[];
|
|
224
|
+
/** How far ahead of the camera `target` is placed, in meters; BCF has no target. Default 10. */
|
|
225
|
+
targetDistance?: number;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Resolves a viewpoint against a model's data: the visibility as BCF 3.0 orders it (DefaultVisibility, then the
|
|
229
|
+
* ViewSetupHints for spaces and openings, then the exceptions), selection and colours, each applied to the parts of
|
|
230
|
+
* a decomposed component (aggregation and nesting, never spatial structure), plus the camera, section planes and
|
|
231
|
+
* lines in engine axes. Components match by IfcGuid, or by AuthoringToolId against the element's Tag.
|
|
232
|
+
*/
|
|
233
|
+
export declare function viewFromBCF(vp: BCFViewpoint, data: IFCData, options?: BCFViewOptions): BCFView;
|
|
234
|
+
/** What bcfFromView encodes: a camera in engine axes and the elements by expressID. */
|
|
235
|
+
export interface BCFViewInput {
|
|
236
|
+
guid?: string;
|
|
237
|
+
camera?: {
|
|
238
|
+
/** Default perspective. */
|
|
239
|
+
type?: 'perspective' | 'orthogonal';
|
|
240
|
+
position: readonly number[];
|
|
241
|
+
/** Either a target or a direction. */
|
|
242
|
+
target?: readonly number[];
|
|
243
|
+
direction?: readonly number[];
|
|
244
|
+
/** Default [0, 1, 0]. */
|
|
245
|
+
up?: readonly number[];
|
|
246
|
+
/** Perspective: vertical field of view in degrees (a core Camera's `fov`). */
|
|
247
|
+
fov?: number;
|
|
248
|
+
/** Orthogonal: visible vertical size in meters. */
|
|
249
|
+
height?: number;
|
|
250
|
+
/** Width / height. Default 1. */
|
|
251
|
+
aspect?: number;
|
|
252
|
+
};
|
|
253
|
+
/** Hidden product occurrences; every other product is visible. Default none. */
|
|
254
|
+
hidden?: Iterable<number>;
|
|
255
|
+
selected?: Iterable<number>;
|
|
256
|
+
/** sRGB colour per element, components 0..1, alpha optional (written as AARRGGBB when below 1). */
|
|
257
|
+
colors?: Map<number, readonly number[]> | Iterable<[number, readonly number[]]>;
|
|
258
|
+
/** Material clipping planes `[a, b, c, d]` (what has `a x + b y + c z + d < 0` is cut away). */
|
|
259
|
+
clippingPlanes?: readonly (readonly number[])[];
|
|
260
|
+
lines?: readonly {
|
|
261
|
+
start: readonly number[];
|
|
262
|
+
end: readonly number[];
|
|
263
|
+
}[];
|
|
264
|
+
snapshot?: {
|
|
265
|
+
format: 'png' | 'jpg';
|
|
266
|
+
data: Uint8Array;
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Encodes a Margo view as a BCF viewpoint, following BCF 3.0's encoding rules: the shorter of the hidden and visible
|
|
271
|
+
* lists becomes the exceptions, and spaces and openings go to the ViewSetupHints when none of them is visible.
|
|
272
|
+
*/
|
|
273
|
+
export declare function bcfFromView(view: BCFViewInput, data: IFCData, options?: BCFViewOptions): BCFViewpoint;
|
|
274
|
+
export {};
|
package/dist/bcf.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as bcfFromView, n as newBCFGuid, r as parseBCFViewpoint, i as readBCF, a as viewFromBCF, o as viewpointFromBCFJSON, s as viewpointToBCFJSON, c as writeBCF, l as writeBCFViewpoint } from "./bcf-wKfMzfyy.js";
|