@ifc-lite/wasm 4.3.0 → 4.4.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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "IFC-Lite Contributors"
6
6
  ],
7
7
  "description": "WebAssembly bindings for IFC-Lite",
8
- "version": "4.3.0",
8
+ "version": "4.4.0",
9
9
  "license": "MPL-2.0",
10
10
  "repository": {
11
11
  "type": "git",
package/pkg/ifc-lite.d.ts CHANGED
@@ -248,6 +248,19 @@ export class IfcAPI {
248
248
  * flattened `Pset_Prop` columns to the entities view.
249
249
  */
250
250
  exportCsv(content: Uint8Array, mode: string, delimiter: string, include_properties: boolean): Uint8Array;
251
+ /**
252
+ * Export the `IfcSpace` volumes in `content` as a Dragonfly **DFJSON** string.
253
+ *
254
+ * Each space becomes an extruded `Room2D` (floor polygon + floor-to-ceiling height)
255
+ * grouped into stories — the simpler Ladybug Tools target for mostly-vertical-wall
256
+ * models. Loads via `dragonfly.model.Model.from_dfjson`.
257
+ *
258
+ * ```javascript
259
+ * const api = new IfcAPI();
260
+ * const dfjson = api.exportDfjson(ifcContent, "my_model");
261
+ * ```
262
+ */
263
+ exportDfjson(content: Uint8Array, name: string): string;
251
264
  /**
252
265
  * Export the render geometry in `content` as a binary **GLB** (`Uint8Array`).
253
266
  *
@@ -276,6 +289,13 @@ export class IfcAPI {
276
289
  * taken in order from the concatenated `positions`/`normals`/`indices`; `colors` is
277
290
  * RGBA per mesh, `origins` xyz per mesh, `express_ids` labels each mesh (indices are
278
291
  * per-mesh local). The caller passes exactly the meshes it wants emitted.
292
+ *
293
+ * Fails CLOSED: if the declared vertex/index counts run past the flattened
294
+ * `positions` / `indices`, there are fewer `index_counts` than meshes, or `normals`
295
+ * is empty or too short to cover every vertex, this throws an `Error` whose message
296
+ * starts with `MALFORMED_MESH_INPUT` — instead of silently emitting a GLB with those
297
+ * meshes dropped. (The viewer always passes fully-backed, normal-covered arrays, so
298
+ * this only fires on a caller bug.)
279
299
  */
280
300
  exportGlbFromMeshes(positions: Float32Array, normals: Float32Array, indices: Uint32Array, vertex_counts: Uint32Array, index_counts: Uint32Array, colors: Float32Array, origins: Float64Array, express_ids: Uint32Array, include_metadata: boolean, lit?: boolean | null, emissive?: boolean | null): Uint8Array;
281
301
  /**
@@ -374,6 +394,12 @@ export class IfcAPI {
374
394
  * property-set synthesis); empty ⇒ none. See `export_step_json` for the shape.
375
395
  */
376
396
  exportStep(content: Uint8Array, schema: string, included: Uint32Array, mutations_json: string): Uint8Array;
397
+ /**
398
+ * Export **OpenUSD** (`.usda` ASCII): a real Z-up USD stage — spatial hierarchy of
399
+ * `Xform` prims, `UsdGeomMesh` geometry, `UsdPreviewSurface` materials, IFC
400
+ * metadata as custom attributes. Whole-model (geometry-backed).
401
+ */
402
+ exportUsd(content: Uint8Array): Uint8Array;
377
403
  /**
378
404
  * Extract raw profile polygons from all building elements with `IfcExtrudedAreaSolid`
379
405
  * representations.
@@ -547,15 +573,22 @@ export class IfcAPI {
547
573
  * range_end)` shard; the main thread stitches the returned columns into the
548
574
  * full entity index (byte-identical to the single-threaded
549
575
  * `build_entity_index`) by binary-searching each shard for the previous
550
- * shard's `handoff`. Delegates to `ifc_lite_processing::scan_shard`, the
551
- * exact per-chunk primitive the native `build_entity_index_parallel` fans
552
- * across cores so the sharded merge cannot drift from the serial builder.
576
+ * shard's `handoff`. Delegates to `ifc_lite_processing::scan_shard_classified`
577
+ * a separately-maintained loop over the same `EntityScanner` primitive as
578
+ * `scan_shard` (the one the native `build_entity_index_parallel` fans across
579
+ * cores), plus a per-record class column this sharded path also needs. The
580
+ * two loops' records/handoff are kept in parity by a dedicated test
581
+ * (`rust/processing/tests/issue_2053_shard_scan_parity.rs`), not by
582
+ * delegation — edit one without the other and that test catches the drift.
553
583
  *
554
584
  * Byte offsets returned are GLOBAL (relative to file start), so shards
555
585
  * concatenate without rewriting. Returns a plain object:
556
586
  * `{ ids: Uint32Array, starts: Uint32Array, lengths: Uint32Array,
557
- * handoff: number }`
558
- * where `handoff` is the global start of the first entity at/after
587
+ * classes: Uint8Array, handoff: number }`
588
+ * where `classes` is the parallel per-record prepass class byte
589
+ * (`PREPASS_CLASS_*`: named code in the low bits plus the geometry-job /
590
+ * type-candidate flags) the host filters on to rebuild pre-pass span
591
+ * lists, and `handoff` is the global start of the first entity at/after
559
592
  * `range_end` (the next shard's first real entity), or `-1` at EOF.
560
593
  */
561
594
  scanEntityIndexShard(data: Uint8Array, range_start: number, range_end: number): any;
@@ -1635,6 +1668,7 @@ export interface InitOutput {
1635
1668
  readonly ifcapi_clearPrePassCache: (a: number) => void;
1636
1669
  readonly ifcapi_diagnoseGeometry: (a: number, b: number, c: number) => number;
1637
1670
  readonly ifcapi_exportCsv: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
1671
+ readonly ifcapi_exportDfjson: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1638
1672
  readonly ifcapi_exportGlb: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
1639
1673
  readonly ifcapi_exportGlbFromMeshes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number) => void;
1640
1674
  readonly ifcapi_exportHbjson: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
@@ -1646,6 +1680,7 @@ export interface InitOutput {
1646
1680
  readonly ifcapi_exportMerged: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
1647
1681
  readonly ifcapi_exportObj: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
1648
1682
  readonly ifcapi_exportStep: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
1683
+ readonly ifcapi_exportUsd: (a: number, b: number, c: number, d: number) => void;
1649
1684
  readonly ifcapi_extractProfiles: (a: number, b: number, c: number, d: number) => number;
1650
1685
  readonly ifcapi_finalizePrepassStyles: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number) => void;
1651
1686
  readonly ifcapi_getMemory: (a: number) => number;
package/pkg/ifc-lite.js CHANGED
@@ -654,6 +654,41 @@ export class IfcAPI {
654
654
  wasm.__wbindgen_add_to_stack_pointer(16);
655
655
  }
656
656
  }
657
+ /**
658
+ * Export the `IfcSpace` volumes in `content` as a Dragonfly **DFJSON** string.
659
+ *
660
+ * Each space becomes an extruded `Room2D` (floor polygon + floor-to-ceiling height)
661
+ * grouped into stories — the simpler Ladybug Tools target for mostly-vertical-wall
662
+ * models. Loads via `dragonfly.model.Model.from_dfjson`.
663
+ *
664
+ * ```javascript
665
+ * const api = new IfcAPI();
666
+ * const dfjson = api.exportDfjson(ifcContent, "my_model");
667
+ * ```
668
+ * @param {Uint8Array} content
669
+ * @param {string} name
670
+ * @returns {string}
671
+ */
672
+ exportDfjson(content, name) {
673
+ let deferred3_0;
674
+ let deferred3_1;
675
+ try {
676
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
677
+ const ptr0 = passArray8ToWasm0(content, wasm.__wbindgen_export);
678
+ const len0 = WASM_VECTOR_LEN;
679
+ const ptr1 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
680
+ const len1 = WASM_VECTOR_LEN;
681
+ wasm.ifcapi_exportDfjson(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
682
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
683
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
684
+ deferred3_0 = r0;
685
+ deferred3_1 = r1;
686
+ return getStringFromWasm0(r0, r1);
687
+ } finally {
688
+ wasm.__wbindgen_add_to_stack_pointer(16);
689
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
690
+ }
691
+ }
657
692
  /**
658
693
  * Export the render geometry in `content` as a binary **GLB** (`Uint8Array`).
659
694
  *
@@ -715,6 +750,13 @@ export class IfcAPI {
715
750
  * taken in order from the concatenated `positions`/`normals`/`indices`; `colors` is
716
751
  * RGBA per mesh, `origins` xyz per mesh, `express_ids` labels each mesh (indices are
717
752
  * per-mesh local). The caller passes exactly the meshes it wants emitted.
753
+ *
754
+ * Fails CLOSED: if the declared vertex/index counts run past the flattened
755
+ * `positions` / `indices`, there are fewer `index_counts` than meshes, or `normals`
756
+ * is empty or too short to cover every vertex, this throws an `Error` whose message
757
+ * starts with `MALFORMED_MESH_INPUT` — instead of silently emitting a GLB with those
758
+ * meshes dropped. (The viewer always passes fully-backed, normal-covered arrays, so
759
+ * this only fires on a caller bug.)
718
760
  * @param {Float32Array} positions
719
761
  * @param {Float32Array} normals
720
762
  * @param {Uint32Array} indices
@@ -750,6 +792,11 @@ export class IfcAPI {
750
792
  wasm.ifcapi_exportGlbFromMeshes(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, include_metadata, isLikeNone(lit) ? 0xFFFFFF : lit ? 1 : 0, isLikeNone(emissive) ? 0xFFFFFF : emissive ? 1 : 0);
751
793
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
752
794
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
795
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
796
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
797
+ if (r3) {
798
+ throw takeObject(r2);
799
+ }
753
800
  var v9 = getArrayU8FromWasm0(r0, r1).slice();
754
801
  wasm.__wbindgen_export4(r0, r1 * 1, 1);
755
802
  return v9;
@@ -1076,6 +1123,28 @@ export class IfcAPI {
1076
1123
  wasm.__wbindgen_add_to_stack_pointer(16);
1077
1124
  }
1078
1125
  }
1126
+ /**
1127
+ * Export **OpenUSD** (`.usda` ASCII): a real Z-up USD stage — spatial hierarchy of
1128
+ * `Xform` prims, `UsdGeomMesh` geometry, `UsdPreviewSurface` materials, IFC
1129
+ * metadata as custom attributes. Whole-model (geometry-backed).
1130
+ * @param {Uint8Array} content
1131
+ * @returns {Uint8Array}
1132
+ */
1133
+ exportUsd(content) {
1134
+ try {
1135
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1136
+ const ptr0 = passArray8ToWasm0(content, wasm.__wbindgen_export);
1137
+ const len0 = WASM_VECTOR_LEN;
1138
+ wasm.ifcapi_exportUsd(retptr, this.__wbg_ptr, ptr0, len0);
1139
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1140
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1141
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
1142
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1143
+ return v2;
1144
+ } finally {
1145
+ wasm.__wbindgen_add_to_stack_pointer(16);
1146
+ }
1147
+ }
1079
1148
  /**
1080
1149
  * Extract raw profile polygons from all building elements with `IfcExtrudedAreaSolid`
1081
1150
  * representations.
@@ -1593,15 +1662,22 @@ export class IfcAPI {
1593
1662
  * range_end)` shard; the main thread stitches the returned columns into the
1594
1663
  * full entity index (byte-identical to the single-threaded
1595
1664
  * `build_entity_index`) by binary-searching each shard for the previous
1596
- * shard's `handoff`. Delegates to `ifc_lite_processing::scan_shard`, the
1597
- * exact per-chunk primitive the native `build_entity_index_parallel` fans
1598
- * across cores so the sharded merge cannot drift from the serial builder.
1665
+ * shard's `handoff`. Delegates to `ifc_lite_processing::scan_shard_classified`
1666
+ * a separately-maintained loop over the same `EntityScanner` primitive as
1667
+ * `scan_shard` (the one the native `build_entity_index_parallel` fans across
1668
+ * cores), plus a per-record class column this sharded path also needs. The
1669
+ * two loops' records/handoff are kept in parity by a dedicated test
1670
+ * (`rust/processing/tests/issue_2053_shard_scan_parity.rs`), not by
1671
+ * delegation — edit one without the other and that test catches the drift.
1599
1672
  *
1600
1673
  * Byte offsets returned are GLOBAL (relative to file start), so shards
1601
1674
  * concatenate without rewriting. Returns a plain object:
1602
1675
  * `{ ids: Uint32Array, starts: Uint32Array, lengths: Uint32Array,
1603
- * handoff: number }`
1604
- * where `handoff` is the global start of the first entity at/after
1676
+ * classes: Uint8Array, handoff: number }`
1677
+ * where `classes` is the parallel per-record prepass class byte
1678
+ * (`PREPASS_CLASS_*`: named code in the low bits plus the geometry-job /
1679
+ * type-candidate flags) the host filters on to rebuild pre-pass span
1680
+ * lists, and `handoff` is the global start of the first entity at/after
1605
1681
  * `range_end` (the next shard's first real entity), or `-1` at EOF.
1606
1682
  * @param {Uint8Array} data
1607
1683
  * @param {number} range_start
Binary file