IFClite TypeScript API
    Preparing search index...

    Class GeometryProcessor

    Index
    • using processor = new GeometryProcessor(...) support (TS 5.2+ / ES2022 target): frees the WASM handle deterministically at scope exit.

      Returns void

    • Run geometry extraction on buffer and return its typed CSG / opening diagnostics (the GeometryDiagnostics contract), or undefined when nothing diagnostic-worthy happened or the bridge is not initialized. The meshes are discarded - this is the diagnostics-only surface for the CLI / SDK.

      Parameters

      • buffer: Uint8Array

      Returns GeometryDiagnostics | undefined

    • Cleanup resources: frees the underlying WASM IfcAPI handle deterministically (AGENTS.md "Free every WASM handle deterministically"). IfcLiteBridge.dispose() also frees whatever the pre-pass / batch caches were still holding on the handle (see the poisoned-mutex recovery note on the Rust IfcAPI struct) — meshes and pre-pass results are already freed as they're extracted (.free() right after copying into JS arrays plus clearPrePassCache() in every load path's finally), so this only needs to release the long-lived IfcAPI handle itself.

      The native (Tauri) path has no WASM handle to release; platformBridge is left untouched.

      Idempotent: IfcLiteBridge.dispose() nulls its handle after freeing, so calling this more than once (e.g. an explicit call after a using declaration already ran [Symbol.dispose]()) is a no-op, not a double-free.

      Returns void

    • Enable per-entity geometry fingerprinting on the WASM mesh pass (issue #924). Once on, every processGeometryBatch populates MeshCollection.geometryHashValues, which convertMeshCollectionToBatch attaches to each MeshData.geometryHash. RTC-invariant + tolerance- quantized; default tolerance is DEFAULT_GEOM_HASH_TOLERANCE (1 mm).

      The same switch also populates MeshCollection.geometryAabbValues, which lands on MeshData.geometryAabb (#1891) — the absolute world box that lets a consumer tell a move from a reshape instead of reading one changed-hash bit — and MeshCollection.geometryVolumeValues, which lands on MeshData.geometryVolume (#1993), the proved enclosed volume the diff engine's split/merge detector weighs one element against several. Nothing is computed while this is off.

      Safe to call before init() — the bridge caches the value and replays it on the freshly-built IfcAPI. No-op on the native/desktop path (the Tauri pipeline does not emit hashes yet). Pass null to disable.

      Parameters

      • Optionaltolerance: number | null

      Returns void

    • Parameters

      • buffer: Uint8Array
      • Optionalmode: "entities" | "properties" | "quantities" | "spatial"
      • Optionaldelimiter: string
      • OptionalincludeProperties: boolean

      Returns Uint8Array<ArrayBufferLike> | null

    • Export the IfcSpace volumes in buffer as a Dragonfly DFJSON string (Ladybug Tools energy model — extruded Room2D plates). Returns null if not initialized.

      WASM path only, deliberately: like exportHbjson and the other analytic readers here (extractProfiles, parseGridLines, parseSymbolicRepresentations, …) this reads this.bridge and so returns null under isNative. That is not an oversight specific to DFJSON — IPlatformBridge declares no energy export at all, and the native path needs a Tauri host (isTauri() requires window.__TAURI_INTERNALS__), which no longer ships: the desktop app is decommissioned and the repo carries no src-tauri. Giving DFJSON a native route alone would single out one of eight methods for a constraint the whole family shares.

      Parameters

      • buffer: Uint8Array

        IFC file buffer

      • name: string

        Model identifier / display name

      Returns string | null

    • Export render geometry as a binary GLB. Fails closed: a model whose visible mesh set is empty throws the typed NO_RENDER_GEOMETRY error (match with isNoRenderGeometryError) instead of returning a valid but empty GLB.

      Parameters

      • buffer: Uint8Array
      • OptionalincludeMetadata: boolean
      • Optionalhidden: Uint32Array<ArrayBufferLike>
      • Optionalisolated: Uint32Array<ArrayBufferLike>
      • OptionalhiddenTypesCsv: string
      • Optionallit: boolean
      • Optionalemissive: boolean

      Returns Uint8Array<ArrayBufferLike> | null

    • Assemble a GLB from already-produced meshes (no re-meshing) — the viewer path. Flattens MeshData[] into the wasm binding's parallel arrays. The caller passes exactly the meshes it wants emitted (its own visibility filtering). lit emits standard PBR materials that shade from normals; false ⇒ flat KHR_materials_unlit (the historical look — #1321). emissive self-illuminates each material at its base colour (core glTF emissiveFactor) so renderers with no ambient/IBL — Google Earth — don't render it near-black (#1427).

      Parameters

      • meshes: MeshData[]
      • OptionalincludeMetadata: boolean
      • Optionallit: boolean
      • Optionalemissive: boolean

      Returns Uint8Array<ArrayBufferLike> | null

    • Export the IfcSpace volumes in buffer as Honeybee HBJSON. Null if not initialized.

      Parameters

      • buffer: Uint8Array
      • name: string

      Returns Uint8Array<ArrayBufferLike> | null

    • Like exportHbjson; also returns HbjsonStats. Null if not initialized.

      Parameters

      • buffer: Uint8Array
      • name: string

      Returns { content: Uint8Array; stats: HbjsonStats } | null

    • Parameters

      • buffer: Uint8Array
      • OptionalonlyKnownProperties: boolean
      • Optionalpretty: boolean

      Returns Uint8Array<ArrayBufferLike> | null

    • Parameters

      • buffer: Uint8Array
      • Optionalpretty: boolean
      • OptionalincludeProperties: boolean
      • OptionalincludeQuantities: boolean

      Returns Uint8Array<ArrayBufferLike> | null

    • Parameters

      • buffer: Uint8Array
      • Optionalcontext: string
      • OptionalincludeProperties: boolean
      • OptionalincludeQuantities: boolean
      • Optionalpretty: boolean
      • Optionalincluded: Uint32Array<ArrayBufferLike>

      Returns Uint8Array<ArrayBufferLike> | null

    • Build a Google-Earth-ready KMZ from already-produced meshes (no re-meshing) — the working KMZ path (#1427). The model is embedded as COLLADA (model.dae), the only <Model> format Google Earth loads (a GLB raises "Unsupported element: Model"), with emission-lit double-sided materials. Flattens MeshData[] into the wasm binding's parallel arrays. xAxisAbscissa/xAxisOrdinate are the IfcMapConversion grid-north components (pass undefined for heading 0). altitudeMode selects the KML vertical placement ('clampToGround' default rests on the terrain and ignores altitude; 'absolute' places the origin at altitude metres MSL). Returns null if not initialized.

      Parameters

      • meshes: MeshData[]
      • latitude: number
      • longitude: number
      • altitude: number
      • xAxisAbscissa: number | undefined
      • xAxisOrdinate: number | undefined
      • Optionalname: string
      • OptionalaltitudeMode: KmzAltitudeMode

      Returns Uint8Array<ArrayBufferLike> | null

    • Merge several IFC models (raw byte buffers) into one STEP/IFC UTF-8 byte buffer.

      Parameters

      • buffers: Uint8Array<ArrayBufferLike>[]
      • Optionalschema: string

      Returns Uint8Array<ArrayBufferLike> | null

    • Rust domain exporters return bytes to avoid V8 string-size limits; decode text with TextDecoder. They return null before init(). isolated: undefined selects all; an empty array hides every mesh. Keep distinct.

      Parameters

      • buffer: Uint8Array
      • OptionalincludeNormals: boolean
      • Optionalhidden: Uint32Array<ArrayBufferLike>
      • Optionalisolated: Uint32Array<ArrayBufferLike>

      Returns Uint8Array<ArrayBufferLike> | null

    • Parameters

      • buffer: Uint8Array
      • Optionalschema: string
      • Optionalincluded: Uint32Array<ArrayBufferLike>
      • OptionalmutationsJson: string

      Returns Uint8Array<ArrayBufferLike> | null

    • Export OpenUSD (.usda ASCII) — a real Z-up USD stage (geometry-backed).

      Parameters

      • buffer: Uint8Array

      Returns Uint8Array<ArrayBufferLike> | null

    • Exact extrusion sources in file units and world-metre uses; omitted IDs select all, empty IDs none; null until init.

      Parameters

      • buffer: Uint8Array
      • Optionalids: Uint32Array<ArrayBufferLike>

      Returns ExtrusionDefinitionsJs | null

    • Extract IfcExtrudedAreaSolid profiles and transforms for 2D projection. modelIndex is the federation index; null until initialized.

      Parameters

      • buffer: Uint8Array
      • OptionalmodelIndex: number

      Returns ProfileCollection | null

    • IFC Z-up swept-disk curves in metres; omitted IDs select all, empty IDs none; null until init.

      Parameters

      • buffer: Uint8Array
      • Optionalids: Uint32Array<ArrayBufferLike>

      Returns SweptDiskDescriptions | null

    • Get the WASM API instance for advanced operations (e.g., entity scanning)

      Returns IfcAPI | null

    • Initialize the geometry processor In Tauri: Creates platform bridge for native Rust processing In browser: Loads WASM

      Returns Promise<void>

    • Parse IfcAlignment directrix curves into a flat Float32Array of 3D line-list vertices [x0,y0,z0, x1,y1,z1, …] in renderer Y-up world space (RTC-subtracted, metres). Rendered as thin lines (not a ribbon mesh) to match IfcGrid / IfcAnnotation. Feed straight to renderer.setLineOverlay('alignment', …).

      Parameters

      • buffer: Uint8Array

        IFC file buffer

      • Optionalframe: RtcFrame

      Returns Float32Array<ArrayBufferLike> | null

      Flat line-list vertices, or null if not initialized

    • Parse IfcGrid / IfcGridAxis into structured per-axis data (tag + endpoints) in renderer Y-up world space (RTC-subtracted, metres). Use when you also need the axis tags to render grid bubbles / labels (issue #945).

      Returns plain GridAxis objects (the underlying zero-copy WASM collection is consumed internally), or null if not initialized.

      Parameters

      • buffer: Uint8Array

        IFC file buffer

      • Optionalframe: RtcFrame

      Returns GridAxis[] | null

    • Parse IfcGrid / IfcGridAxis into a flat Float32Array of 3D line-list vertices [x0,y0,z0, x1,y1,z1, …] (one segment per axis) in renderer Y-up world space (RTC-subtracted, metres) — the same frame the streamed meshes render in, so grids overlay the model by construction (issue #945). Feed to setLineOverlay('grid', …), NOT 'annotation' (it expands bounds, #967).

      Parameters

      • buffer: Uint8Array

        IFC file buffer

      • Optionalframe: RtcFrame

      Returns Float32Array<ArrayBufferLike> | null

      Flat line-list vertices, or null if not initialized

    • Parse symbolic representations (Plan, Annotation, FootPrint) from IFC content These are pre-authored 2D curves for architectural drawings (door swings, window cuts, etc.)

      Parameters

      • buffer: Uint8Array

        IFC file buffer

      • Optionalframe: RtcFrame

      Returns SymbolicRepresentationCollection | null

      Collection of symbolic polylines and circles

    • Canonical Rust plan; unsupported platforms refuse explicitly.

      Parameters

      • buffer: Uint8Array

      Returns string

    • Process IFC file and extract geometry (synchronous, use processStreaming for large files)

      Parameters

      • buffer: Uint8Array

        IFC file buffer

      • OptionalentityIndex: Map<number, any>

        Optional entity index for priority-based loading

      Returns Promise<GeometryResult>

    • Adaptive processing: Choose sync or streaming based on file size Small files (< threshold): Load all at once for instant display Large files (>= threshold): Stream for fast first frame

      Parameters

      • buffer: Uint8Array

        IFC file buffer

      • Optionaloptions: {
            batchSize?: number | DynamicBatchConfig;
            entityIndex?: Map<number, any>;
            existingSab?: SharedArrayBuffer;
            hungJobTimeoutMs?: number;
            onEntityIndex?: (
                ids: Uint32Array,
                starts: Uint32Array,
                lengths: Uint32Array,
                oversizedIdCount?: number,
                malformedRecordCount?: number,
            ) => void;
            sharedRtcOffset?: { x: number; y: number; z: number };
            signal?: AbortSignal;
            sizeThreshold?: number;
            sourceFingerprint?: SharedArrayBuffer;
            stallPhaseHandle?: StallPhaseHandle;
            trace?: LoadTrace;
            wasmUrls?: { wasm?: string };
            workerCountOverride?: number;
        }

        Configuration options

        • OptionalbatchSize?: number | DynamicBatchConfig

          Number of meshes per batch for streaming (default: 25)

        • OptionalentityIndex?: Map<number, any>

          Optional entity index for priority-based loading

        • OptionalexistingSab?: SharedArrayBuffer

          Reuse a SAB already populated by the caller (parser worker, etc.).

        • OptionalhungJobTimeoutMs?: number

          Opt in to hung-call recovery on the parallel path (#4884).

        • OptionalonEntityIndex?: (
              ids: Uint32Array,
              starts: Uint32Array,
              lengths: Uint32Array,
              oversizedIdCount?: number,
              malformedRecordCount?: number,
          ) => void

          Callback fired when the streaming pre-pass exports its entity index. Enables a peer worker (e.g. parser) to skip its own scan. Only fires on the parallel-streaming path.

        • OptionalsharedRtcOffset?: { x: number; y: number; z: number }

          Shared RTC offset from first federated model (IFC Z-up coords). Overrides per-model RTC detection for federation alignment.

        • Optionalsignal?: AbortSignal

          Terminates the parallel worker pool; see ProcessParallelOptions.signal (#4884).

        • OptionalsizeThreshold?: number

          File size threshold in bytes (default: 2MB)

        • OptionalsourceFingerprint?: SharedArrayBuffer

          Fresh per-load prepass fingerprint cell; optional optimization only.

        • OptionalstallPhaseHandle?: StallPhaseHandle

          See ProcessParallelOptions.stallPhaseHandle (#4902); parallel path only.

        • Optionaltrace?: LoadTrace
        • OptionalwasmUrls?: { wasm?: string }

          Explicit wasm asset URL forwarded to the worker pool. See processParallel(...).wasmUrls for rationale.

        • OptionalworkerCountOverride?: number

          Explicit geometry-worker count for A/B tuning (viewer ?geomWorkers=N). Forwarded to the parallel path; clamped to the memory budget there. Geometry output is unaffected by the count.

      Returns AsyncGenerator<StreamingGeometryEvent>

      StreamingGeometryEvent with 'batch' events containing MeshData[]. Multiple meshes may share the same expressId (one per material/part). Consumers should group by expressId for per-element rendering or picking.

    • Process IFC file in parallel using Web Workers. Each worker gets its own WASM instance and processes a disjoint slice of the geometry entity list. Batches are yielded as they arrive from any worker, enabling progressive rendering while utilizing multiple cores.

      Parameters

      • buffer: Uint8Array

        IFC file buffer

      • OptionalsharedRtcOffset: { x: number; y: number; z: number }
      • OptionalexistingSab: SharedArrayBuffer

        Reuse a SAB the caller has already shared with another worker.

      • OptionalonEntityIndex: (
            ids: Uint32Array,
            starts: Uint32Array,
            lengths: Uint32Array,
            oversizedIdCount?: number,
            malformedRecordCount?: number,
        ) => void

        Callback fired when the streaming pre-pass exports its entity index.

      • OptionalwasmUrls: { wasm?: string }

        Explicit wasm asset URL forwarded to the worker pool. See ProcessParallelOptions.wasmUrls in geometry-parallel.ts for the full rationale — needed only for bundlers that can't transform new URL('ifc-lite_bg.wasm', import.meta.url) inside the worker dist (or deployments that serve wasm from a separate origin). Vite + webpack 5 consumers leave this undefined.

      • OptionalworkerCountOverride: number

        Explicit geometry-worker count for A/B tuning (the viewer's ?geomWorkers=N knob). Overrides the cores-tier heuristic but stays clamped to the memory budget. Geometry output is unaffected (workers process disjoint, deterministic element slices). Undefined ⇒ heuristic.

      • OptionalsourceFingerprint: SharedArrayBuffer
      • Optionalsignal: AbortSignal

        Terminates the worker pool and ends the stream (#4884).

      • OptionalhungJobTimeoutMs: number

        Opt in to hung-call recovery; see ProcessParallelOptions.hungJobTimeoutMs (#4884).

      • OptionalstallPhaseHandle: StallPhaseHandle

        See ProcessParallelOptions.stallPhaseHandle (#4902).

      • Optionaltrace: LoadTrace

      Returns AsyncGenerator<StreamingGeometryEvent>

    • Process IFC geometry directly from a filesystem path in native desktop hosts. This avoids copying IFC content through JS when the host already has the file path.

      Parameters

      • path: string

      Returns Promise<GeometryResult>

    • Process IFC file with streaming output for progressive rendering Uses native Rust in Tauri, WASM in browser

      Parameters

      • buffer: Uint8Array

        IFC file buffer

      • Optional_entityIndex: Map<number, any>
      • OptionalbatchConfig: number | DynamicBatchConfig

        Dynamic batch configuration or fixed batch size

      • OptionalsharedRtcOffset: { x: number; y: number; z: number }

      Returns AsyncGenerator<StreamingGeometryEvent>

    • Stream geometry directly from a filesystem path in native desktop hosts. This avoids copying very large IFC files through JS and Tauri IPC.

      Parameters

      • path: string
      • OptionalestimatedBytes: number
      • OptionalcacheKey: string

      Returns AsyncGenerator<StreamingGeometryEvent>

    • Select the tessellation detail level for curved geometry (issue #976). Equivalent to the tessellationQuality constructor option; null restores the engine default ('medium' — output identical to the pre-quality pipeline). Applies to geometry processed AFTER the call (set before process* — already-emitted meshes are not regenerated).

      Safe to call before init() — the bridge caches the value and replays it on the freshly-built IfcAPI. No-op on the native/desktop path (the Tauri pipeline does not consume the level yet).

      Parameters

      Returns void

    • Demesher: simplify already-produced element meshes at per-element levels (1-4 = cavity removal + clustering at 0.5/0.25/0.10/0.03 triangle ratio, 5 = bounding box). Pass ALL of the target elements' MeshData records (per-material submeshes included); non-occurrence records (type-library shapes) are ignored. Returns replacement meshes (swap into the scene via removeMeshesForEntities + addMeshes) plus each element's geometry in its IFC object-placement frame in file units, for applySimplifiedGeometry.

      originShift is coordinateInfo.originShift (IFC Z-up metres); unitScale is metres per project length unit (defaults to 1 = metres). Returns null if the wasm bridge is not initialized.

      Parameters

      • meshes: MeshData[]
      • levels: ReadonlyMap<number, number>
      • Optionaloptions: { originShift?: { x: number; y: number; z: number }; unitScale?: number }

      Returns SimplifyMeshesResult | null