@ifc-lite/export 1.21.0 → 2.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 +12 -9
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/lod1-generator.d.ts.map +1 -1
- package/dist/lod1-generator.js +10 -11
- package/dist/lod1-generator.js.map +1 -1
- package/package.json +2 -2
- package/dist/csv-exporter.d.ts +0 -54
- package/dist/csv-exporter.d.ts.map +0 -1
- package/dist/csv-exporter.js +0 -254
- package/dist/csv-exporter.js.map +0 -1
- package/dist/gltf-exporter.d.ts +0 -57
- package/dist/gltf-exporter.d.ts.map +0 -1
- package/dist/gltf-exporter.js +0 -352
- package/dist/gltf-exporter.js.map +0 -1
- package/dist/jsonld-exporter.d.ts +0 -36
- package/dist/jsonld-exporter.d.ts.map +0 -1
- package/dist/jsonld-exporter.js +0 -167
- package/dist/jsonld-exporter.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @ifc-lite/export
|
|
2
2
|
|
|
3
|
-
Export formats for IFClite. Writes
|
|
3
|
+
Export formats for IFClite. Writes Apache Parquet, Apache Arrow, IFC STEP (with mutations applied), IFC5 IFCX (JSON + USD geometry), and lightweight LOD0/LOD1 envelopes — all from a single parsed `IfcDataStore`.
|
|
4
|
+
|
|
5
|
+
> **glTF/GLB, CSV and JSON-LD moved to Rust.** They are now assembled by the `ifc-lite-export` crate and reached through `GeometryProcessor` in [`@ifc-lite/geometry`](../geometry); the standalone `GLTFExporter`/`CSVExporter`/`JSONLDExporter` classes were retired.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -11,17 +13,18 @@ npm install @ifc-lite/export
|
|
|
11
13
|
## glTF / GLB — for the web
|
|
12
14
|
|
|
13
15
|
```typescript
|
|
14
|
-
import {
|
|
16
|
+
import { GeometryProcessor } from '@ifc-lite/geometry';
|
|
15
17
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const gp = new GeometryProcessor();
|
|
19
|
+
await gp.init();
|
|
20
|
+
|
|
21
|
+
// From already-produced meshes (no re-mesh) …
|
|
22
|
+
const glb = gp.exportGlbFromMeshes(result.meshes, /* includeMetadata */ true);
|
|
23
|
+
// … or straight from IFC bytes (meshes internally):
|
|
24
|
+
// gp.exportGlb(bytes, true, new Uint32Array(), new Uint32Array(), '')
|
|
22
25
|
|
|
23
26
|
// Download
|
|
24
|
-
const url = URL.createObjectURL(new Blob([glb], { type: 'model/gltf-binary' }));
|
|
27
|
+
const url = URL.createObjectURL(new Blob([new Uint8Array(glb)], { type: 'model/gltf-binary' }));
|
|
25
28
|
```
|
|
26
29
|
|
|
27
30
|
## IFC STEP — with mutations
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @ifc-lite/export - Export formats
|
|
3
3
|
*/
|
|
4
|
-
export { GLTFExporter, type GLTFExportOptions } from './gltf-exporter.js';
|
|
5
4
|
export { ParquetExporter, type ParquetExportOptions } from './parquet-exporter.js';
|
|
6
|
-
export { CSVExporter, type CSVExportOptions } from './csv-exporter.js';
|
|
7
|
-
export { JSONLDExporter, type JSONLDExportOptions } from './jsonld-exporter.js';
|
|
8
5
|
export { StepExporter, exportToStep, type StepExportOptions, type StepExportResult, type StepExportProgress } from './step-exporter.js';
|
|
9
6
|
export { MergedExporter, type MergeModelInput, type MergeExportOptions, type MergeExportResult, type ExportProgress } from './merged-exporter.js';
|
|
10
7
|
export { collectReferencedEntityIds, getVisibleEntityIds, collectStyleEntities } from './reference-collector.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAKnF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxI,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAClJ,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACjH,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACvI,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGxH,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACvH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @ifc-lite/export - Export formats
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
// GLTFExporter removed — glTF/GLB is now assembled in Rust (ifc-lite-export).
|
|
8
|
+
// Use GeometryProcessor.exportGlb (from bytes) / exportGlbFromMeshes (from meshes).
|
|
8
9
|
export { ParquetExporter } from './parquet-exporter.js';
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
// CSVExporter removed — CSV is now produced in Rust (ifc-lite-export).
|
|
11
|
+
// Use GeometryProcessor.exportCsv(bytes, mode, …) — mode ∈ entities|properties|quantities|spatial.
|
|
12
|
+
// JSONLDExporter removed — JSON-LD is now produced in Rust (ifc-lite-export).
|
|
13
|
+
// Use GeometryProcessor.exportJsonld(bytes, …).
|
|
11
14
|
export { StepExporter, exportToStep } from './step-exporter.js';
|
|
12
15
|
export { MergedExporter } from './merged-exporter.js';
|
|
13
16
|
export { collectReferencedEntityIds, getVisibleEntityIds, collectStyleEntities } from './reference-collector.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;GAEG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;GAEG;AAEH,8EAA8E;AAC9E,oFAAoF;AACpF,OAAO,EAAE,eAAe,EAA6B,MAAM,uBAAuB,CAAC;AACnF,uEAAuE;AACvE,mGAAmG;AACnG,8EAA8E;AAC9E,gDAAgD;AAChD,OAAO,EAAE,YAAY,EAAE,YAAY,EAA0E,MAAM,oBAAoB,CAAC;AACxI,OAAO,EAAE,cAAc,EAA8F,MAAM,sBAAsB,CAAC;AAClJ,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACjH,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,EAAyB,MAAM,uBAAuB,CAAC;AACvI,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAiD,MAAM,oBAAoB,CAAC;AAIxH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAA4B,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lod1-generator.d.ts","sourceRoot":"","sources":["../src/lod1-generator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAA4B,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"lod1-generator.d.ts","sourceRoot":"","sources":["../src/lod1-generator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAA4B,MAAM,oBAAoB,CAAC;AAIpF,OAAO,KAAK,EAAE,kBAAkB,EAA0B,QAAQ,EAAQ,MAAM,yBAAyB,CAAC;AAG1G,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;;OAGG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC;AAsGF,wBAAsB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAqElH"}
|
package/dist/lod1-generator.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
import { GeometryProcessor } from '@ifc-lite/geometry';
|
|
5
|
-
import { GLTFExporter } from './gltf-exporter.js';
|
|
6
5
|
import { extractGlbMapping } from './glb.js';
|
|
7
6
|
import { generateLod0 } from './lod0-generator.js';
|
|
8
7
|
import { toIfcArrayBuffer } from './lod-geometry-utils.js';
|
|
@@ -112,8 +111,11 @@ export async function generateLod1(input, options = {}) {
|
|
|
112
111
|
const gp = new GeometryProcessor({ quality: options.quality });
|
|
113
112
|
await gp.init();
|
|
114
113
|
const geom = await processGeometryAdaptive(gp, buffer);
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
// Assemble the GLB in Rust over the meshes (no re-meshing); extractGlbMapping
|
|
115
|
+
// reads node `extras.expressId`, which the from-meshes path emits.
|
|
116
|
+
const glb = gp.exportGlbFromMeshes(geom.meshes, true);
|
|
117
|
+
if (!glb)
|
|
118
|
+
throw new Error('GLB assembly returned no data');
|
|
117
119
|
const mapping = extractGlbMapping(glb);
|
|
118
120
|
const mappedIds = new Set(Object.keys(mapping).map((k) => Number(k)).filter((n) => Number.isFinite(n)));
|
|
119
121
|
const failedElements = [];
|
|
@@ -140,14 +142,11 @@ export async function generateLod1(input, options = {}) {
|
|
|
140
142
|
const errMsg = e instanceof Error ? e.message : String(e);
|
|
141
143
|
notes.push(`Meshing failed; using fallback boxes from LOD0. (${errMsg})`);
|
|
142
144
|
const { meshes } = buildFallbackGeometryFromLod0(lod0);
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
};
|
|
149
|
-
const exporter = new GLTFExporter(fallbackResult);
|
|
150
|
-
const glb = exporter.exportGLB({ includeMetadata: true });
|
|
145
|
+
const gp = new GeometryProcessor();
|
|
146
|
+
await gp.init();
|
|
147
|
+
const glb = gp.exportGlbFromMeshes(meshes, true);
|
|
148
|
+
if (!glb)
|
|
149
|
+
throw e;
|
|
151
150
|
const mapping = extractGlbMapping(glb);
|
|
152
151
|
const meta = {
|
|
153
152
|
schema: 'ifc-lite-geometry',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lod1-generator.js","sourceRoot":"","sources":["../src/lod1-generator.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAG/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"lod1-generator.js","sourceRoot":"","sources":["../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QAC1D,MAAM,MAAM,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC1D,KAAK,CAAC,IAAI,CAAC,oDAAoD,MAAM,GAAG,CAAC,CAAC;QAE1E,MAAM,EAAE,MAAM,EAAE,GAAG,6BAA6B,CAAC,IAAI,CAAC,CAAC;QAEvD,MAAM,EAAE,GAAG,IAAI,iBAAiB,EAAE,CAAC;QACnC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;QAChB,MAAM,GAAG,GAAG,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,GAAG;YAAE,MAAM,CAAC,CAAC;QAClB,MAAM,OAAO,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;QAEvC,MAAM,IAAI,GAAiB;YACzB,MAAM,EAAE,mBAAmB;YAC3B,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,UAAU;YAClB,QAAQ,EAAE,iBAAiB;YAC3B,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;YACrD,KAAK;YACL,OAAO;SACR,CAAC;QAEF,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IACvB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ifc-lite/export",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Export formats for IFC-Lite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"parquet-wasm": "^0.7.1",
|
|
17
17
|
"apache-arrow": "^21.1.0",
|
|
18
18
|
"jszip": "^3.10.0",
|
|
19
|
-
"@ifc-lite/geometry": "^2.
|
|
19
|
+
"@ifc-lite/geometry": "^2.9.0",
|
|
20
20
|
"@ifc-lite/data": "^2.2.0",
|
|
21
21
|
"@ifc-lite/encoding": "^1.14.7",
|
|
22
22
|
"@ifc-lite/parser": "^3.3.1",
|
package/dist/csv-exporter.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSV exporter for IFC data
|
|
3
|
-
* Uses on-demand property extraction for optimal performance
|
|
4
|
-
*/
|
|
5
|
-
import { type IfcDataStore } from '@ifc-lite/parser';
|
|
6
|
-
export interface CSVExportOptions {
|
|
7
|
-
includeProperties?: boolean;
|
|
8
|
-
includeQuantities?: boolean;
|
|
9
|
-
delimiter?: string;
|
|
10
|
-
flattenProperties?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare class CSVExporter {
|
|
13
|
-
private store;
|
|
14
|
-
constructor(store: IfcDataStore);
|
|
15
|
-
/**
|
|
16
|
-
* Get properties for an entity, using on-demand extraction when available
|
|
17
|
-
*/
|
|
18
|
-
private getPropertiesForEntity;
|
|
19
|
-
/**
|
|
20
|
-
* Get quantities for an entity, using on-demand extraction when available
|
|
21
|
-
*/
|
|
22
|
-
private getQuantitiesForEntity;
|
|
23
|
-
/**
|
|
24
|
-
* Export entities to CSV format
|
|
25
|
-
* @param entityIds Optional array of entity IDs to export. If not provided, exports all entities.
|
|
26
|
-
*/
|
|
27
|
-
exportEntities(entityIds?: number[], options?: CSVExportOptions): string;
|
|
28
|
-
/**
|
|
29
|
-
* Export properties to CSV format (one row per property)
|
|
30
|
-
*/
|
|
31
|
-
exportProperties(entityIds?: number[], options?: CSVExportOptions): string;
|
|
32
|
-
/**
|
|
33
|
-
* Export quantities to CSV format (one row per quantity)
|
|
34
|
-
*/
|
|
35
|
-
exportQuantities(entityIds?: number[], options?: CSVExportOptions): string;
|
|
36
|
-
/**
|
|
37
|
-
* Export spatial hierarchy to CSV
|
|
38
|
-
*/
|
|
39
|
-
exportSpatialHierarchy(options?: CSVExportOptions): string;
|
|
40
|
-
/**
|
|
41
|
-
* Get all entity IDs from the store
|
|
42
|
-
*/
|
|
43
|
-
private getAllEntityIds;
|
|
44
|
-
/**
|
|
45
|
-
* Escape a value for CSV (handles quotes, commas, newlines)
|
|
46
|
-
*/
|
|
47
|
-
private escapeValue;
|
|
48
|
-
/**
|
|
49
|
-
* Join pre-escaped values into a CSV row
|
|
50
|
-
* Note: Values should already be escaped before calling this
|
|
51
|
-
*/
|
|
52
|
-
private joinRow;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=csv-exporter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"csv-exporter.d.ts","sourceRoot":"","sources":["../src/csv-exporter.ts"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,KAAK,CAAe;gBAEhB,KAAK,EAAE,YAAY;IAI/B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAS9B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAS9B;;;OAGG;IACH,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM;IAuF5E;;OAEG;IACH,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM;IAqC9E;;OAEG;IACH,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM;IAsC9E;;OAEG;IACH,sBAAsB,CAAC,OAAO,GAAE,gBAAqB,GAAG,MAAM;IAmC9D;;OAEG;IACH,OAAO,CAAC,eAAe;IASvB;;OAEG;IACH,OAAO,CAAC,WAAW;IAsBnB;;;OAGG;IACH,OAAO,CAAC,OAAO;CAGhB"}
|
package/dist/csv-exporter.js
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
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
|
-
* CSV exporter for IFC data
|
|
6
|
-
* Uses on-demand property extraction for optimal performance
|
|
7
|
-
*/
|
|
8
|
-
import { extractPropertiesOnDemand, extractQuantitiesOnDemand, } from '@ifc-lite/parser';
|
|
9
|
-
export class CSVExporter {
|
|
10
|
-
store;
|
|
11
|
-
constructor(store) {
|
|
12
|
-
this.store = store;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Get properties for an entity, using on-demand extraction when available
|
|
16
|
-
*/
|
|
17
|
-
getPropertiesForEntity(entityId) {
|
|
18
|
-
// Use on-demand extraction (works with client-side WASM parsing)
|
|
19
|
-
if (this.store.onDemandPropertyMap && this.store.source?.length > 0) {
|
|
20
|
-
return extractPropertiesOnDemand(this.store, entityId);
|
|
21
|
-
}
|
|
22
|
-
// Fallback to pre-built property table (server-parsed data or cached)
|
|
23
|
-
return this.store.properties?.getForEntity(entityId) ?? [];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Get quantities for an entity, using on-demand extraction when available
|
|
27
|
-
*/
|
|
28
|
-
getQuantitiesForEntity(entityId) {
|
|
29
|
-
// Use on-demand extraction (works with client-side WASM parsing)
|
|
30
|
-
if (this.store.onDemandQuantityMap && this.store.source?.length > 0) {
|
|
31
|
-
return extractQuantitiesOnDemand(this.store, entityId);
|
|
32
|
-
}
|
|
33
|
-
// Fallback to pre-built quantity table
|
|
34
|
-
return this.store.quantities?.getForEntity(entityId) ?? [];
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Export entities to CSV format
|
|
38
|
-
* @param entityIds Optional array of entity IDs to export. If not provided, exports all entities.
|
|
39
|
-
*/
|
|
40
|
-
exportEntities(entityIds, options = {}) {
|
|
41
|
-
const delimiter = options.delimiter ?? ',';
|
|
42
|
-
const includeProperties = options.includeProperties ?? false;
|
|
43
|
-
const flattenProperties = options.flattenProperties ?? false;
|
|
44
|
-
// Build header row with more columns
|
|
45
|
-
const headers = [
|
|
46
|
-
'expressId',
|
|
47
|
-
'globalId',
|
|
48
|
-
'name',
|
|
49
|
-
'type',
|
|
50
|
-
'description',
|
|
51
|
-
'objectType',
|
|
52
|
-
'hasGeometry',
|
|
53
|
-
];
|
|
54
|
-
// Collect all unique property set names and property names (if flattening properties)
|
|
55
|
-
const psetProps = new Map();
|
|
56
|
-
if (includeProperties && flattenProperties) {
|
|
57
|
-
const allEntityIds = entityIds ?? this.getAllEntityIds();
|
|
58
|
-
for (const id of allEntityIds) {
|
|
59
|
-
const properties = this.getPropertiesForEntity(id);
|
|
60
|
-
for (const pset of properties) {
|
|
61
|
-
if (!psetProps.has(pset.name)) {
|
|
62
|
-
psetProps.set(pset.name, new Set());
|
|
63
|
-
}
|
|
64
|
-
for (const prop of pset.properties) {
|
|
65
|
-
psetProps.get(pset.name).add(prop.name);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
// Add flattened property columns: PsetName_PropName
|
|
70
|
-
for (const [psetName, propNames] of psetProps) {
|
|
71
|
-
for (const propName of propNames) {
|
|
72
|
-
headers.push(`${psetName}_${propName}`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
const rows = [this.joinRow(headers.map((h) => this.escapeValue(h)), delimiter)];
|
|
77
|
-
// Get entity IDs to export
|
|
78
|
-
const ids = entityIds ?? this.getAllEntityIds();
|
|
79
|
-
// Build data rows
|
|
80
|
-
for (const id of ids) {
|
|
81
|
-
const row = [
|
|
82
|
-
this.escapeValue(id),
|
|
83
|
-
this.escapeValue(this.store.entities.getGlobalId(id) || ''),
|
|
84
|
-
this.escapeValue(this.store.entities.getName(id) || ''),
|
|
85
|
-
this.escapeValue(this.store.entities.getTypeName(id) || ''),
|
|
86
|
-
this.escapeValue(this.store.entities.getDescription(id) || ''),
|
|
87
|
-
this.escapeValue(this.store.entities.getObjectType(id) || ''),
|
|
88
|
-
this.escapeValue(this.store.entities.hasGeometry(id) ? 'true' : 'false'),
|
|
89
|
-
];
|
|
90
|
-
if (includeProperties && flattenProperties) {
|
|
91
|
-
const properties = this.getPropertiesForEntity(id);
|
|
92
|
-
const propMap = new Map();
|
|
93
|
-
// Build map of pset -> prop -> value
|
|
94
|
-
for (const pset of properties) {
|
|
95
|
-
const props = new Map();
|
|
96
|
-
for (const prop of pset.properties) {
|
|
97
|
-
props.set(prop.name, prop.value);
|
|
98
|
-
}
|
|
99
|
-
propMap.set(pset.name, props);
|
|
100
|
-
}
|
|
101
|
-
// Add property values in same order as headers
|
|
102
|
-
for (const [psetName, propNames] of psetProps) {
|
|
103
|
-
for (const propName of propNames) {
|
|
104
|
-
const value = propMap.get(psetName)?.get(propName) ?? '';
|
|
105
|
-
row.push(this.escapeValue(value));
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
rows.push(this.joinRow(row, delimiter));
|
|
110
|
-
}
|
|
111
|
-
return rows.join('\n');
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Export properties to CSV format (one row per property)
|
|
115
|
-
*/
|
|
116
|
-
exportProperties(entityIds, options = {}) {
|
|
117
|
-
const delimiter = options.delimiter ?? ',';
|
|
118
|
-
const headers = ['entityId', 'globalId', 'entityName', 'entityType', 'psetName', 'propName', 'value', 'type'];
|
|
119
|
-
const rows = [this.joinRow(headers.map((h) => this.escapeValue(h)), delimiter)];
|
|
120
|
-
const ids = entityIds ?? this.getAllEntityIds();
|
|
121
|
-
for (const id of ids) {
|
|
122
|
-
const properties = this.getPropertiesForEntity(id);
|
|
123
|
-
if (!properties || properties.length === 0)
|
|
124
|
-
continue;
|
|
125
|
-
const globalId = this.store.entities.getGlobalId(id) || '';
|
|
126
|
-
const entityName = this.store.entities.getName(id) || '';
|
|
127
|
-
const entityType = this.store.entities.getTypeName(id) || '';
|
|
128
|
-
for (const pset of properties) {
|
|
129
|
-
if (!pset.properties || pset.properties.length === 0)
|
|
130
|
-
continue;
|
|
131
|
-
for (const prop of pset.properties) {
|
|
132
|
-
const row = [
|
|
133
|
-
this.escapeValue(id),
|
|
134
|
-
this.escapeValue(globalId),
|
|
135
|
-
this.escapeValue(entityName),
|
|
136
|
-
this.escapeValue(entityType),
|
|
137
|
-
this.escapeValue(pset.name || ''),
|
|
138
|
-
this.escapeValue(prop.name || ''),
|
|
139
|
-
this.escapeValue(prop.value),
|
|
140
|
-
this.escapeValue(prop.type ?? ''),
|
|
141
|
-
];
|
|
142
|
-
rows.push(this.joinRow(row, delimiter));
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return rows.join('\n');
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Export quantities to CSV format (one row per quantity)
|
|
150
|
-
*/
|
|
151
|
-
exportQuantities(entityIds, options = {}) {
|
|
152
|
-
const delimiter = options.delimiter ?? ',';
|
|
153
|
-
const headers = ['entityId', 'globalId', 'entityName', 'entityType', 'qsetName', 'quantityName', 'value', 'type'];
|
|
154
|
-
const headerRow = this.joinRow(headers.map((h) => this.escapeValue(h)), delimiter);
|
|
155
|
-
const rows = [headerRow];
|
|
156
|
-
const ids = entityIds ?? this.getAllEntityIds();
|
|
157
|
-
for (const id of ids) {
|
|
158
|
-
const quantities = this.getQuantitiesForEntity(id);
|
|
159
|
-
if (!quantities || quantities.length === 0)
|
|
160
|
-
continue;
|
|
161
|
-
const globalId = this.store.entities.getGlobalId(id) || '';
|
|
162
|
-
const entityName = this.store.entities.getName(id) || '';
|
|
163
|
-
const entityType = this.store.entities.getTypeName(id) || '';
|
|
164
|
-
for (const qset of quantities) {
|
|
165
|
-
if (!qset.quantities || qset.quantities.length === 0)
|
|
166
|
-
continue;
|
|
167
|
-
for (const quant of qset.quantities) {
|
|
168
|
-
const row = [
|
|
169
|
-
this.escapeValue(id),
|
|
170
|
-
this.escapeValue(globalId),
|
|
171
|
-
this.escapeValue(entityName),
|
|
172
|
-
this.escapeValue(entityType),
|
|
173
|
-
this.escapeValue(qset.name || ''),
|
|
174
|
-
this.escapeValue(quant.name || ''),
|
|
175
|
-
this.escapeValue(quant.value),
|
|
176
|
-
this.escapeValue(quant.type ?? ''),
|
|
177
|
-
];
|
|
178
|
-
rows.push(this.joinRow(row, delimiter));
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return rows.join('\n');
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Export spatial hierarchy to CSV
|
|
186
|
-
*/
|
|
187
|
-
exportSpatialHierarchy(options = {}) {
|
|
188
|
-
const delimiter = options.delimiter ?? ',';
|
|
189
|
-
const headers = ['expressId', 'globalId', 'name', 'type', 'parentId', 'level'];
|
|
190
|
-
const rows = [this.joinRow(headers.map((h) => this.escapeValue(h)), delimiter)];
|
|
191
|
-
// Get spatial hierarchy
|
|
192
|
-
const spatialHierarchy = this.store.spatialHierarchy;
|
|
193
|
-
if (!spatialHierarchy?.project) {
|
|
194
|
-
return rows[0];
|
|
195
|
-
}
|
|
196
|
-
const traverse = (node, parentId, level) => {
|
|
197
|
-
const row = [
|
|
198
|
-
this.escapeValue(node.expressId),
|
|
199
|
-
this.escapeValue(this.store.entities.getGlobalId(node.expressId) || ''),
|
|
200
|
-
this.escapeValue(node.name || ''),
|
|
201
|
-
this.escapeValue(this.store.entities.getTypeName(node.expressId) || ''),
|
|
202
|
-
this.escapeValue(parentId ?? ''),
|
|
203
|
-
this.escapeValue(level),
|
|
204
|
-
];
|
|
205
|
-
rows.push(this.joinRow(row, delimiter));
|
|
206
|
-
if (node.children) {
|
|
207
|
-
for (const child of node.children) {
|
|
208
|
-
traverse(child, node.expressId, level + 1);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
traverse(spatialHierarchy.project, null, 0);
|
|
213
|
-
return rows.join('\n');
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Get all entity IDs from the store
|
|
217
|
-
*/
|
|
218
|
-
getAllEntityIds() {
|
|
219
|
-
const ids = [];
|
|
220
|
-
const count = this.store.entities?.count ?? 0;
|
|
221
|
-
for (let i = 0; i < count; i++) {
|
|
222
|
-
ids.push(this.store.entities.expressId[i]);
|
|
223
|
-
}
|
|
224
|
-
return ids;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Escape a value for CSV (handles quotes, commas, newlines)
|
|
228
|
-
*/
|
|
229
|
-
escapeValue(value) {
|
|
230
|
-
if (value === null || value === undefined) {
|
|
231
|
-
return '';
|
|
232
|
-
}
|
|
233
|
-
let str = String(value);
|
|
234
|
-
// CSV/formula-injection guard (CWE-1236): if the value starts with a
|
|
235
|
-
// spreadsheet formula trigger, prefix a single quote so Excel/Sheets
|
|
236
|
-
// treat it as text. Covers = + - @ and the tab/CR control prefixes.
|
|
237
|
-
if (/^[=+\-@\t\r]/.test(str)) {
|
|
238
|
-
str = `'${str}`;
|
|
239
|
-
}
|
|
240
|
-
// If value contains delimiter, quote, or newline, wrap in quotes and escape quotes
|
|
241
|
-
if (str.includes(',') || str.includes('"') || str.includes('\n') || str.includes('\r')) {
|
|
242
|
-
return `"${str.replace(/"/g, '""')}"`;
|
|
243
|
-
}
|
|
244
|
-
return str;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Join pre-escaped values into a CSV row
|
|
248
|
-
* Note: Values should already be escaped before calling this
|
|
249
|
-
*/
|
|
250
|
-
joinRow(values, delimiter) {
|
|
251
|
-
return values.join(delimiter);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
//# sourceMappingURL=csv-exporter.js.map
|
package/dist/csv-exporter.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"csv-exporter.js","sourceRoot":"","sources":["../src/csv-exporter.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;GAGG;AAEH,OAAO,EAEL,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAU1B,MAAM,OAAO,WAAW;IACd,KAAK,CAAe;IAE5B,YAAY,KAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;OAEG;IACK,sBAAsB,CAAC,QAAgB;QAC7C,iEAAiE;QACjE,IAAI,IAAI,CAAC,KAAK,CAAC,mBAAmB,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC;YACpE,OAAO,yBAAyB,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAkB,CAAC;QAC1E,CAAC;QACD,sEAAsE;QACtE,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC7D,CAAC;IAED;;OAEG;IACK,sBAAsB,CAAC,QAAgB;QAC7C,iEAAiE;QACjE,IAAI,IAAI,CAAC,KAAK,CAAC,mBAAmB,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC;YACpE,OAAO,yBAAyB,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAkB,CAAC;QAC1E,CAAC;QACD,uCAAuC;QACvC,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACH,cAAc,CAAC,SAAoB,EAAE,UAA4B,EA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C;YACvF,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;QACxC,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;OAGG;IACK,OAAO,CAAC,MAAgB,EAAE,SAAiB;QACjD,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;CACF"}
|
package/dist/gltf-exporter.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* glTF/GLB exporter
|
|
3
|
-
*/
|
|
4
|
-
import type { GeometryResult } from '@ifc-lite/geometry';
|
|
5
|
-
export interface GLTFExportOptions {
|
|
6
|
-
useInstancing?: boolean;
|
|
7
|
-
includeMetadata?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Which IFC surface-style colour to bake into the glTF material:
|
|
10
|
-
* - `'rendering'` (default): the apparent rendered colour
|
|
11
|
-
* (`IfcSurfaceStyleRendering.DiffuseColour` when authored, falling
|
|
12
|
-
* back to `SurfaceColour`). Matches what most IFC viewers display
|
|
13
|
-
* and what authoring tools intend as the visible appearance.
|
|
14
|
-
* - `'shading'`: the underlying `SurfaceColour`. Only differs when
|
|
15
|
-
* the file authored a distinct DiffuseColour — otherwise this is
|
|
16
|
-
* identical to `'rendering'`.
|
|
17
|
-
*/
|
|
18
|
-
colorSource?: 'rendering' | 'shading';
|
|
19
|
-
/**
|
|
20
|
-
* When true, omit meshes whose `expressId` is hidden / not in the
|
|
21
|
-
* isolated set. Mirrors the API used by `StepExporter` so callers can
|
|
22
|
-
* pass the same store-derived sets to either exporter.
|
|
23
|
-
*/
|
|
24
|
-
visibleOnly?: boolean;
|
|
25
|
-
/** Global express IDs explicitly hidden in the viewer. Skipped when
|
|
26
|
-
* `visibleOnly` is true. Ignored otherwise. */
|
|
27
|
-
hiddenEntityIds?: Set<number>;
|
|
28
|
-
/** Global express IDs in the active isolation set (allowlist). When
|
|
29
|
-
* non-null and non-empty, only meshes in this set are emitted. */
|
|
30
|
-
isolatedEntityIds?: Set<number> | null;
|
|
31
|
-
/** IFC class names whose visibility toggle is currently OFF in the
|
|
32
|
-
* viewer (e.g. `"IfcOpeningElement"`, `"IfcSpace"`). Meshes whose
|
|
33
|
-
* `ifcType` is in this set are skipped when `visibleOnly` is true,
|
|
34
|
-
* matching the viewport's class-level filter — without it,
|
|
35
|
-
* visible-only exports would still ship openings the user never
|
|
36
|
-
* rendered. */
|
|
37
|
-
hiddenIfcTypes?: Set<string>;
|
|
38
|
-
}
|
|
39
|
-
export declare class GLTFExporter {
|
|
40
|
-
private geometryResult;
|
|
41
|
-
constructor(geometryResult: GeometryResult);
|
|
42
|
-
/**
|
|
43
|
-
* Export to GLB (binary glTF)
|
|
44
|
-
*/
|
|
45
|
-
exportGLB(options?: GLTFExportOptions): Uint8Array;
|
|
46
|
-
/**
|
|
47
|
-
* Export to glTF (JSON + separate .bin)
|
|
48
|
-
*/
|
|
49
|
-
exportGLTF(options?: GLTFExportOptions): {
|
|
50
|
-
json: string;
|
|
51
|
-
bin: Uint8Array;
|
|
52
|
-
};
|
|
53
|
-
private buildGLTF;
|
|
54
|
-
private combineBuffers;
|
|
55
|
-
private packGLB;
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=gltf-exporter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-exporter.d.ts","sourceRoot":"","sources":["../src/gltf-exporter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAY,MAAM,oBAAoB,CAAC;AAkFnE,MAAM,WAAW,iBAAiB;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACtC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;oDACgD;IAChD,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B;uEACmE;IACnE,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IACvC;;;;;oBAKgB;IAChB,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAChC;AAED,qBAAa,YAAY;IACrB,OAAO,CAAC,cAAc,CAAiB;gBAE3B,cAAc,EAAE,cAAc;IAI1C;;OAEG;IACH,SAAS,CAAC,OAAO,GAAE,iBAAsB,GAAG,UAAU;IAKtD;;OAEG;IACH,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,UAAU,CAAA;KAAE;IAQ9E,OAAO,CAAC,SAAS;IAuTjB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,OAAO;CA8ClB"}
|
package/dist/gltf-exporter.js
DELETED
|
@@ -1,352 +0,0 @@
|
|
|
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
|
-
export class GLTFExporter {
|
|
5
|
-
geometryResult;
|
|
6
|
-
constructor(geometryResult) {
|
|
7
|
-
this.geometryResult = geometryResult;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Export to GLB (binary glTF)
|
|
11
|
-
*/
|
|
12
|
-
exportGLB(options = {}) {
|
|
13
|
-
const gltf = this.buildGLTF(options);
|
|
14
|
-
return this.packGLB(gltf.json, gltf.buffers);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Export to glTF (JSON + separate .bin)
|
|
18
|
-
*/
|
|
19
|
-
exportGLTF(options = {}) {
|
|
20
|
-
const gltf = this.buildGLTF(options);
|
|
21
|
-
return {
|
|
22
|
-
json: JSON.stringify(gltf.json, null, 2),
|
|
23
|
-
bin: this.combineBuffers(gltf.buffers),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
buildGLTF(options) {
|
|
27
|
-
const meshes = this.geometryResult.meshes;
|
|
28
|
-
const colorSource = options.colorSource ?? 'rendering';
|
|
29
|
-
const visibleOnly = options.visibleOnly === true;
|
|
30
|
-
const hidden = options.hiddenEntityIds ?? null;
|
|
31
|
-
const isolated = options.isolatedEntityIds ?? null;
|
|
32
|
-
const hasIsolation = isolated !== null && isolated.size > 0;
|
|
33
|
-
const hiddenTypes = options.hiddenIfcTypes ?? null;
|
|
34
|
-
const isMeshVisible = (m) => {
|
|
35
|
-
if (!visibleOnly)
|
|
36
|
-
return true;
|
|
37
|
-
if (hiddenTypes && m.ifcType && hiddenTypes.has(m.ifcType))
|
|
38
|
-
return false;
|
|
39
|
-
if (hasIsolation && !isolated.has(m.expressId))
|
|
40
|
-
return false;
|
|
41
|
-
if (hidden && hidden.has(m.expressId))
|
|
42
|
-
return false;
|
|
43
|
-
return true;
|
|
44
|
-
};
|
|
45
|
-
const pickColor = (m) => {
|
|
46
|
-
if (colorSource === 'shading') {
|
|
47
|
-
return m.shadingColor ?? m.color;
|
|
48
|
-
}
|
|
49
|
-
return m.color;
|
|
50
|
-
};
|
|
51
|
-
const gltf = {
|
|
52
|
-
asset: {
|
|
53
|
-
version: '2.0',
|
|
54
|
-
generator: 'IFC-Lite',
|
|
55
|
-
},
|
|
56
|
-
scene: 0,
|
|
57
|
-
scenes: [{ nodes: [] }],
|
|
58
|
-
nodes: [],
|
|
59
|
-
meshes: [],
|
|
60
|
-
accessors: [],
|
|
61
|
-
bufferViews: [],
|
|
62
|
-
buffers: [{ byteLength: 0 }],
|
|
63
|
-
};
|
|
64
|
-
if (options.includeMetadata) {
|
|
65
|
-
gltf.asset.extras = {
|
|
66
|
-
meshCount: meshes.length,
|
|
67
|
-
vertexCount: this.geometryResult.totalVertices,
|
|
68
|
-
triangleCount: this.geometryResult.totalTriangles,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
// Build materials from mesh colors (deduplicate by rounded RGBA key)
|
|
72
|
-
const materialMap = new Map();
|
|
73
|
-
const materials = [];
|
|
74
|
-
function getOrCreateMaterial(color) {
|
|
75
|
-
// Round to 2 decimals for deduplicate key only — use original values for export
|
|
76
|
-
const key = `${Math.round(color[0] * 100)},${Math.round(color[1] * 100)},${Math.round(color[2] * 100)},${Math.round(color[3] * 100)}`;
|
|
77
|
-
const existing = materialMap.get(key);
|
|
78
|
-
if (existing !== undefined)
|
|
79
|
-
return existing;
|
|
80
|
-
const idx = materials.length;
|
|
81
|
-
materials.push({
|
|
82
|
-
pbrMetallicRoughness: {
|
|
83
|
-
baseColorFactor: [color[0], color[1], color[2], color[3]],
|
|
84
|
-
metallicFactor: 0,
|
|
85
|
-
roughnessFactor: 1,
|
|
86
|
-
},
|
|
87
|
-
extensions: { KHR_materials_unlit: {} },
|
|
88
|
-
...(color[3] < 1 ? { alphaMode: 'BLEND' } : {}),
|
|
89
|
-
});
|
|
90
|
-
materialMap.set(key, idx);
|
|
91
|
-
return idx;
|
|
92
|
-
}
|
|
93
|
-
const meshMetas = [];
|
|
94
|
-
let totalPosFloats = 0;
|
|
95
|
-
let totalNormFloats = 0;
|
|
96
|
-
let totalIdxInts = 0;
|
|
97
|
-
for (let i = 0; i < meshes.length; i++) {
|
|
98
|
-
const mesh = meshes[i];
|
|
99
|
-
if (!isMeshVisible(mesh))
|
|
100
|
-
continue;
|
|
101
|
-
const mp = mesh.positions;
|
|
102
|
-
const mn = mesh.normals;
|
|
103
|
-
const mi = mesh.indices;
|
|
104
|
-
if (!mp.length || !mn.length || !mi.length)
|
|
105
|
-
continue;
|
|
106
|
-
if (mp.length % 3 !== 0 || mn.length % 3 !== 0)
|
|
107
|
-
continue;
|
|
108
|
-
if (mp.length !== mn.length)
|
|
109
|
-
continue;
|
|
110
|
-
// Calculate bounds directly from the typed array
|
|
111
|
-
let minX = mp[0], minY = mp[1], minZ = mp[2];
|
|
112
|
-
let maxX = mp[0], maxY = mp[1], maxZ = mp[2];
|
|
113
|
-
for (let j = 3; j < mp.length; j += 3) {
|
|
114
|
-
const x = mp[j], y = mp[j + 1], z = mp[j + 2];
|
|
115
|
-
if (x < minX)
|
|
116
|
-
minX = x;
|
|
117
|
-
if (x > maxX)
|
|
118
|
-
maxX = x;
|
|
119
|
-
if (y < minY)
|
|
120
|
-
minY = y;
|
|
121
|
-
if (y > maxY)
|
|
122
|
-
maxY = y;
|
|
123
|
-
if (z < minZ)
|
|
124
|
-
minZ = z;
|
|
125
|
-
if (z > maxZ)
|
|
126
|
-
maxZ = z;
|
|
127
|
-
}
|
|
128
|
-
const effectiveColor = pickColor(mesh);
|
|
129
|
-
meshMetas.push({
|
|
130
|
-
meshIndex: i,
|
|
131
|
-
posCount: mp.length,
|
|
132
|
-
normCount: mn.length,
|
|
133
|
-
idxCount: mi.length,
|
|
134
|
-
posByteOffset: totalPosFloats * 4,
|
|
135
|
-
normByteOffset: totalNormFloats * 4,
|
|
136
|
-
idxByteOffset: totalIdxInts * 4,
|
|
137
|
-
bounds: { min: [minX, minY, minZ], max: [maxX, maxY, maxZ] },
|
|
138
|
-
materialIdx: effectiveColor ? getOrCreateMaterial(effectiveColor) : undefined,
|
|
139
|
-
});
|
|
140
|
-
totalPosFloats += mp.length;
|
|
141
|
-
totalNormFloats += mn.length;
|
|
142
|
-
totalIdxInts += mi.length;
|
|
143
|
-
}
|
|
144
|
-
if (totalPosFloats === 0 || totalNormFloats === 0 || totalIdxInts === 0) {
|
|
145
|
-
throw new Error('Cannot export GLB: no valid geometry data found');
|
|
146
|
-
}
|
|
147
|
-
// ── Pass 2: build glTF structure and copy geometry into typed arrays ──
|
|
148
|
-
const positionsArray = new Float32Array(totalPosFloats);
|
|
149
|
-
const normalsArray = new Float32Array(totalNormFloats);
|
|
150
|
-
const indicesArray = new Uint32Array(totalIdxInts);
|
|
151
|
-
let posOffset = 0;
|
|
152
|
-
let normOffset = 0;
|
|
153
|
-
let idxOffset = 0;
|
|
154
|
-
const nodeIndices = [];
|
|
155
|
-
for (const meta of meshMetas) {
|
|
156
|
-
const mesh = meshes[meta.meshIndex];
|
|
157
|
-
// Copy geometry data directly (no intermediate array)
|
|
158
|
-
positionsArray.set(mesh.positions, posOffset);
|
|
159
|
-
normalsArray.set(mesh.normals, normOffset);
|
|
160
|
-
indicesArray.set(mesh.indices, idxOffset);
|
|
161
|
-
posOffset += meta.posCount;
|
|
162
|
-
normOffset += meta.normCount;
|
|
163
|
-
idxOffset += meta.idxCount;
|
|
164
|
-
// Accessors
|
|
165
|
-
const posAccessorIdx = gltf.accessors.length;
|
|
166
|
-
gltf.accessors.push({
|
|
167
|
-
bufferView: 0,
|
|
168
|
-
byteOffset: meta.posByteOffset,
|
|
169
|
-
componentType: 5126,
|
|
170
|
-
count: meta.posCount / 3,
|
|
171
|
-
type: 'VEC3',
|
|
172
|
-
min: meta.bounds.min,
|
|
173
|
-
max: meta.bounds.max,
|
|
174
|
-
});
|
|
175
|
-
const normAccessorIdx = gltf.accessors.length;
|
|
176
|
-
gltf.accessors.push({
|
|
177
|
-
bufferView: 1,
|
|
178
|
-
byteOffset: meta.normByteOffset,
|
|
179
|
-
componentType: 5126,
|
|
180
|
-
count: meta.normCount / 3,
|
|
181
|
-
type: 'VEC3',
|
|
182
|
-
});
|
|
183
|
-
const idxAccessorIdx = gltf.accessors.length;
|
|
184
|
-
gltf.accessors.push({
|
|
185
|
-
bufferView: 2,
|
|
186
|
-
byteOffset: meta.idxByteOffset,
|
|
187
|
-
componentType: 5125,
|
|
188
|
-
count: meta.idxCount,
|
|
189
|
-
type: 'SCALAR',
|
|
190
|
-
});
|
|
191
|
-
// Mesh with material
|
|
192
|
-
const meshIdx = gltf.meshes.length;
|
|
193
|
-
gltf.meshes.push({
|
|
194
|
-
primitives: [{
|
|
195
|
-
attributes: {
|
|
196
|
-
POSITION: posAccessorIdx,
|
|
197
|
-
NORMAL: normAccessorIdx,
|
|
198
|
-
},
|
|
199
|
-
indices: idxAccessorIdx,
|
|
200
|
-
...(meta.materialIdx !== undefined ? { material: meta.materialIdx } : {}),
|
|
201
|
-
}],
|
|
202
|
-
});
|
|
203
|
-
// Node
|
|
204
|
-
const nodeIdx = gltf.nodes.length;
|
|
205
|
-
const node = { mesh: meshIdx };
|
|
206
|
-
// Positions/accessor bounds are stored in the element's LOCAL frame
|
|
207
|
-
// (world = origin + local). Express the per-mesh origin as a glTF
|
|
208
|
-
// node translation so the buffer keeps small, precise f32 coords
|
|
209
|
-
// (no fan reintroduction) while the element lands at its world
|
|
210
|
-
// position. Omitted when origin is absent or all-zero.
|
|
211
|
-
const mo = mesh.origin;
|
|
212
|
-
if (mo && (mo[0] !== 0 || mo[1] !== 0 || mo[2] !== 0)) {
|
|
213
|
-
node.translation = [mo[0], mo[1], mo[2]];
|
|
214
|
-
}
|
|
215
|
-
if (options.includeMetadata && mesh.expressId !== undefined) {
|
|
216
|
-
node.extras = mesh.modelIndex !== undefined
|
|
217
|
-
? { expressId: mesh.expressId, modelIndex: mesh.modelIndex }
|
|
218
|
-
: { expressId: mesh.expressId };
|
|
219
|
-
}
|
|
220
|
-
gltf.nodes.push(node);
|
|
221
|
-
nodeIndices.push(nodeIdx);
|
|
222
|
-
}
|
|
223
|
-
gltf.scenes[0].nodes = nodeIndices;
|
|
224
|
-
// Attach materials if any were created
|
|
225
|
-
if (materials.length > 0) {
|
|
226
|
-
gltf.materials = materials;
|
|
227
|
-
gltf.extensionsUsed = ['KHR_materials_unlit'];
|
|
228
|
-
}
|
|
229
|
-
// Buffer views
|
|
230
|
-
const positionsBytes = positionsArray.buffer;
|
|
231
|
-
const normalsBytes = normalsArray.buffer;
|
|
232
|
-
const indicesBytes = indicesArray.buffer;
|
|
233
|
-
const totalBufferSize = positionsBytes.byteLength + normalsBytes.byteLength + indicesBytes.byteLength;
|
|
234
|
-
// Create bufferViews
|
|
235
|
-
// byteStride is set to the element size (12 bytes for VEC3 FLOAT) for non-interleaved data
|
|
236
|
-
// This satisfies validators that require byteStride when multiple accessors share a bufferView
|
|
237
|
-
gltf.bufferViews.push({
|
|
238
|
-
buffer: 0,
|
|
239
|
-
byteOffset: 0,
|
|
240
|
-
byteLength: positionsBytes.byteLength,
|
|
241
|
-
byteStride: 12, // 3 floats * 4 bytes = 12 bytes per VEC3
|
|
242
|
-
target: 34962, // ARRAY_BUFFER
|
|
243
|
-
});
|
|
244
|
-
gltf.bufferViews.push({
|
|
245
|
-
buffer: 0,
|
|
246
|
-
byteOffset: positionsBytes.byteLength,
|
|
247
|
-
byteLength: normalsBytes.byteLength,
|
|
248
|
-
byteStride: 12, // 3 floats * 4 bytes = 12 bytes per VEC3
|
|
249
|
-
target: 34962,
|
|
250
|
-
});
|
|
251
|
-
gltf.bufferViews.push({
|
|
252
|
-
buffer: 0,
|
|
253
|
-
byteOffset: positionsBytes.byteLength + normalsBytes.byteLength,
|
|
254
|
-
byteLength: indicesBytes.byteLength,
|
|
255
|
-
// No byteStride for indices (ELEMENT_ARRAY_BUFFER)
|
|
256
|
-
target: 34963, // ELEMENT_ARRAY_BUFFER
|
|
257
|
-
});
|
|
258
|
-
gltf.buffers[0].byteLength = totalBufferSize;
|
|
259
|
-
// Validate that all accessors fit within their bufferViews
|
|
260
|
-
for (const accessor of gltf.accessors) {
|
|
261
|
-
const bufferView = gltf.bufferViews[accessor.bufferView];
|
|
262
|
-
if (!bufferView) {
|
|
263
|
-
throw new Error(`Accessor references invalid bufferView ${accessor.bufferView}`);
|
|
264
|
-
}
|
|
265
|
-
// Calculate accessor byte length
|
|
266
|
-
let componentSize = 0;
|
|
267
|
-
if (accessor.componentType === 5126)
|
|
268
|
-
componentSize = 4; // FLOAT
|
|
269
|
-
else if (accessor.componentType === 5125)
|
|
270
|
-
componentSize = 4; // UNSIGNED_INT
|
|
271
|
-
else if (accessor.componentType === 5123)
|
|
272
|
-
componentSize = 2; // UNSIGNED_SHORT
|
|
273
|
-
else if (accessor.componentType === 5120)
|
|
274
|
-
componentSize = 1; // BYTE
|
|
275
|
-
else
|
|
276
|
-
throw new Error(`Unsupported component type: ${accessor.componentType}`);
|
|
277
|
-
let componentsPerElement = 1;
|
|
278
|
-
if (accessor.type === 'VEC3')
|
|
279
|
-
componentsPerElement = 3;
|
|
280
|
-
else if (accessor.type === 'VEC2')
|
|
281
|
-
componentsPerElement = 2;
|
|
282
|
-
else if (accessor.type === 'SCALAR')
|
|
283
|
-
componentsPerElement = 1;
|
|
284
|
-
else
|
|
285
|
-
throw new Error(`Unsupported accessor type: ${accessor.type}`);
|
|
286
|
-
const accessorByteLength = accessor.count * componentsPerElement * componentSize;
|
|
287
|
-
const accessorEnd = (accessor.byteOffset || 0) + accessorByteLength;
|
|
288
|
-
if (accessorEnd > bufferView.byteLength) {
|
|
289
|
-
throw new Error(`Accessor exceeds bufferView bounds: ` +
|
|
290
|
-
`accessor byteOffset=${accessor.byteOffset || 0}, length=${accessorByteLength}, ` +
|
|
291
|
-
`bufferView byteLength=${bufferView.byteLength}, end=${accessorEnd}`);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
return {
|
|
295
|
-
json: gltf,
|
|
296
|
-
buffers: [
|
|
297
|
-
new Uint8Array(positionsBytes),
|
|
298
|
-
new Uint8Array(normalsBytes),
|
|
299
|
-
new Uint8Array(indicesBytes),
|
|
300
|
-
],
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
combineBuffers(buffers) {
|
|
304
|
-
const totalLength = buffers.reduce((sum, buf) => sum + buf.byteLength, 0);
|
|
305
|
-
const combined = new Uint8Array(totalLength);
|
|
306
|
-
let offset = 0;
|
|
307
|
-
for (const buffer of buffers) {
|
|
308
|
-
combined.set(buffer, offset);
|
|
309
|
-
offset += buffer.byteLength;
|
|
310
|
-
}
|
|
311
|
-
return combined;
|
|
312
|
-
}
|
|
313
|
-
packGLB(gltfJson, buffers) {
|
|
314
|
-
const jsonString = JSON.stringify(gltfJson);
|
|
315
|
-
const jsonBuffer = new TextEncoder().encode(jsonString);
|
|
316
|
-
const jsonPadding = (4 - (jsonBuffer.byteLength % 4)) % 4;
|
|
317
|
-
const paddedJsonLength = jsonBuffer.byteLength + jsonPadding;
|
|
318
|
-
const bin = this.combineBuffers(buffers);
|
|
319
|
-
const binPadding = (4 - (bin.byteLength % 4)) % 4;
|
|
320
|
-
const paddedBinLength = bin.byteLength + binPadding;
|
|
321
|
-
const totalLength = 12 + 8 + paddedJsonLength + 8 + paddedBinLength;
|
|
322
|
-
const glb = new ArrayBuffer(totalLength);
|
|
323
|
-
const view = new DataView(glb);
|
|
324
|
-
const bytes = new Uint8Array(glb);
|
|
325
|
-
let offset = 0;
|
|
326
|
-
// GLB header
|
|
327
|
-
view.setUint32(offset, 0x46546C67, true); // 'glTF'
|
|
328
|
-
offset += 4;
|
|
329
|
-
view.setUint32(offset, 2, true);
|
|
330
|
-
offset += 4;
|
|
331
|
-
view.setUint32(offset, totalLength, true);
|
|
332
|
-
offset += 4;
|
|
333
|
-
// JSON chunk
|
|
334
|
-
view.setUint32(offset, paddedJsonLength, true);
|
|
335
|
-
offset += 4;
|
|
336
|
-
view.setUint32(offset, 0x4E4F534A, true); // 'JSON'
|
|
337
|
-
offset += 4;
|
|
338
|
-
bytes.set(jsonBuffer, offset);
|
|
339
|
-
offset += jsonBuffer.byteLength;
|
|
340
|
-
for (let i = 0; i < jsonPadding; i++) {
|
|
341
|
-
bytes[offset++] = 0x20;
|
|
342
|
-
}
|
|
343
|
-
// BIN chunk
|
|
344
|
-
view.setUint32(offset, paddedBinLength, true);
|
|
345
|
-
offset += 4;
|
|
346
|
-
view.setUint32(offset, 0x004E4942, true); // 'BIN\0'
|
|
347
|
-
offset += 4;
|
|
348
|
-
bytes.set(bin, offset);
|
|
349
|
-
return new Uint8Array(glb);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
//# sourceMappingURL=gltf-exporter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-exporter.js","sourceRoot":"","sources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AI,CAAC,CAAC;QACZ,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU;QACpD,MAAM,IAAI,CAAC,CAAC;QACZ,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAEvB,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;CACJ"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON-LD exporter for semantic web compatibility
|
|
3
|
-
*/
|
|
4
|
-
import type { IfcDataStore } from '@ifc-lite/parser';
|
|
5
|
-
export interface JSONLDExportOptions {
|
|
6
|
-
context?: string;
|
|
7
|
-
includeGeometry?: boolean;
|
|
8
|
-
includeProperties?: boolean;
|
|
9
|
-
includeQuantities?: boolean;
|
|
10
|
-
entityIds?: number[];
|
|
11
|
-
}
|
|
12
|
-
export declare class JSONLDExporter {
|
|
13
|
-
private store;
|
|
14
|
-
constructor(store: IfcDataStore);
|
|
15
|
-
/**
|
|
16
|
-
* Export to JSON-LD format
|
|
17
|
-
*/
|
|
18
|
-
export(options?: JSONLDExportOptions): object;
|
|
19
|
-
/**
|
|
20
|
-
* Get all entity IDs from the store
|
|
21
|
-
*/
|
|
22
|
-
private getAllEntityIds;
|
|
23
|
-
/**
|
|
24
|
-
* Format property value for JSON-LD
|
|
25
|
-
*/
|
|
26
|
-
private formatPropertyValue;
|
|
27
|
-
/**
|
|
28
|
-
* Get property type name from enum
|
|
29
|
-
*/
|
|
30
|
-
private getPropertyTypeName;
|
|
31
|
-
/**
|
|
32
|
-
* Get quantity type name from enum
|
|
33
|
-
*/
|
|
34
|
-
private getQuantityTypeName;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=jsonld-exporter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonld-exporter.d.ts","sourceRoot":"","sources":["../src/jsonld-exporter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA2CrD,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAAe;gBAEhB,KAAK,EAAE,YAAY;IAI/B;;OAEG;IACH,MAAM,CAAC,OAAO,GAAE,mBAAwB,GAAG,MAAM;IA6HjD;;OAEG;IACH,OAAO,CAAC,eAAe;IAQvB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAgB3B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAW3B;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAW5B"}
|
package/dist/jsonld-exporter.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
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
|
-
const DEFAULT_CONTEXT = 'https://standards.buildingsmart.org/IFC/DEV/IFC4/ADD2/OWL';
|
|
5
|
-
export class JSONLDExporter {
|
|
6
|
-
store;
|
|
7
|
-
constructor(store) {
|
|
8
|
-
this.store = store;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Export to JSON-LD format
|
|
12
|
-
*/
|
|
13
|
-
export(options = {}) {
|
|
14
|
-
const context = options.context ?? DEFAULT_CONTEXT;
|
|
15
|
-
const includeProperties = options.includeProperties ?? true;
|
|
16
|
-
const includeQuantities = options.includeQuantities ?? false;
|
|
17
|
-
const entityIds = options.entityIds ?? this.getAllEntityIds();
|
|
18
|
-
const graph = [];
|
|
19
|
-
for (const id of entityIds) {
|
|
20
|
-
const node = {
|
|
21
|
-
'@id': `ifc:${id}`,
|
|
22
|
-
'@type': `ifc:${this.store.entities.getTypeName(id)}`,
|
|
23
|
-
'ifc:expressId': id,
|
|
24
|
-
};
|
|
25
|
-
const globalId = this.store.entities.getGlobalId(id);
|
|
26
|
-
if (globalId) {
|
|
27
|
-
node['ifc:globalId'] = globalId;
|
|
28
|
-
}
|
|
29
|
-
const name = this.store.entities.getName(id);
|
|
30
|
-
if (name) {
|
|
31
|
-
node['ifc:name'] = name;
|
|
32
|
-
}
|
|
33
|
-
if (includeProperties) {
|
|
34
|
-
const properties = this.store.properties.getForEntity(id);
|
|
35
|
-
if (properties.length > 0) {
|
|
36
|
-
const propertySets = [];
|
|
37
|
-
for (const pset of properties) {
|
|
38
|
-
const psetNode = {
|
|
39
|
-
'@type': 'ifc:IfcPropertySet',
|
|
40
|
-
'ifc:name': pset.name,
|
|
41
|
-
};
|
|
42
|
-
if (pset.globalId) {
|
|
43
|
-
psetNode['ifc:globalId'] = pset.globalId;
|
|
44
|
-
}
|
|
45
|
-
const props = [];
|
|
46
|
-
for (const prop of pset.properties) {
|
|
47
|
-
const propNode = {
|
|
48
|
-
'@type': `ifc:${this.getPropertyTypeName(prop.type)}`,
|
|
49
|
-
'ifc:name': prop.name,
|
|
50
|
-
};
|
|
51
|
-
const value = this.formatPropertyValue(prop.value);
|
|
52
|
-
if (value !== null) {
|
|
53
|
-
propNode['ifc:nominalValue'] = value;
|
|
54
|
-
}
|
|
55
|
-
if (prop.unit) {
|
|
56
|
-
propNode['ifc:unit'] = prop.unit;
|
|
57
|
-
}
|
|
58
|
-
props.push(propNode);
|
|
59
|
-
}
|
|
60
|
-
if (props.length > 0) {
|
|
61
|
-
psetNode['ifc:hasProperties'] = props;
|
|
62
|
-
}
|
|
63
|
-
propertySets.push(psetNode);
|
|
64
|
-
}
|
|
65
|
-
if (propertySets.length > 0) {
|
|
66
|
-
node['ifc:hasPropertySets'] = propertySets;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (includeQuantities && this.store.quantities) {
|
|
71
|
-
const quantities = this.store.quantities.getForEntity(id);
|
|
72
|
-
if (quantities.length > 0) {
|
|
73
|
-
const quantitySets = [];
|
|
74
|
-
for (const qset of quantities) {
|
|
75
|
-
const qsetNode = {
|
|
76
|
-
'@type': 'ifc:IfcElementQuantity',
|
|
77
|
-
'ifc:name': qset.name,
|
|
78
|
-
};
|
|
79
|
-
const quants = [];
|
|
80
|
-
for (const quant of qset.quantities) {
|
|
81
|
-
const quantNode = {
|
|
82
|
-
'@type': `ifc:${this.getQuantityTypeName(quant.type)}`,
|
|
83
|
-
'ifc:name': quant.name,
|
|
84
|
-
'ifc:value': quant.value,
|
|
85
|
-
};
|
|
86
|
-
if (quant.unit) {
|
|
87
|
-
quantNode['ifc:unit'] = quant.unit;
|
|
88
|
-
}
|
|
89
|
-
if (quant.formula) {
|
|
90
|
-
quantNode['ifc:formula'] = quant.formula;
|
|
91
|
-
}
|
|
92
|
-
quants.push(quantNode);
|
|
93
|
-
}
|
|
94
|
-
if (quants.length > 0) {
|
|
95
|
-
qsetNode['ifc:quantities'] = quants;
|
|
96
|
-
}
|
|
97
|
-
quantitySets.push(qsetNode);
|
|
98
|
-
}
|
|
99
|
-
if (quantitySets.length > 0) {
|
|
100
|
-
node['ifc:hasQuantitySets'] = quantitySets;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
graph.push(node);
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
'@context': {
|
|
108
|
-
'@vocab': context + '#',
|
|
109
|
-
'ifc': context + '#',
|
|
110
|
-
},
|
|
111
|
-
'@graph': graph,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Get all entity IDs from the store
|
|
116
|
-
*/
|
|
117
|
-
getAllEntityIds() {
|
|
118
|
-
const ids = [];
|
|
119
|
-
for (let i = 0; i < this.store.entities.count; i++) {
|
|
120
|
-
ids.push(this.store.entities.expressId[i]);
|
|
121
|
-
}
|
|
122
|
-
return ids;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Format property value for JSON-LD
|
|
126
|
-
*/
|
|
127
|
-
formatPropertyValue(value) {
|
|
128
|
-
if (value === null || value === undefined) {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
if (Array.isArray(value)) {
|
|
132
|
-
return value.map(v => this.formatPropertyValue(v));
|
|
133
|
-
}
|
|
134
|
-
if (typeof value === 'object') {
|
|
135
|
-
return JSON.stringify(value);
|
|
136
|
-
}
|
|
137
|
-
return value;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Get property type name from enum
|
|
141
|
-
*/
|
|
142
|
-
getPropertyTypeName(type) {
|
|
143
|
-
const typeNames = {
|
|
144
|
-
0: 'IfcPropertySingleValue',
|
|
145
|
-
1: 'IfcPropertySingleValue',
|
|
146
|
-
2: 'IfcPropertyEnumeratedValue',
|
|
147
|
-
3: 'IfcPropertyBoundedValue',
|
|
148
|
-
4: 'IfcPropertyListValue',
|
|
149
|
-
};
|
|
150
|
-
return typeNames[type] ?? 'IfcPropertySingleValue';
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Get quantity type name from enum
|
|
154
|
-
*/
|
|
155
|
-
getQuantityTypeName(type) {
|
|
156
|
-
const typeNames = {
|
|
157
|
-
0: 'IfcQuantityLength',
|
|
158
|
-
1: 'IfcQuantityArea',
|
|
159
|
-
2: 'IfcQuantityVolume',
|
|
160
|
-
3: 'IfcQuantityCount',
|
|
161
|
-
4: 'IfcQuantityWeight',
|
|
162
|
-
5: 'IfcQuantityTime',
|
|
163
|
-
};
|
|
164
|
-
return typeNames[type] ?? 'IfcQuantityLength';
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
//# sourceMappingURL=jsonld-exporter.js.map
|
|
@@ -1 +0,0 @@
|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