import { ConwayGeometry, FileHandlerFunction as FileHandlerCallback } from "../../index.js"; import { ProgressCallback } from "../../core/progress.js"; import { ModelInfo } from "../../core/progress_log.js"; import * as glmatrix from "gl-matrix"; import { StepExternalByteStore } from "../../step/step_buffer_provider.js"; import { IfcApiModelPassthrough } from "./ifc_api_model_passthrough.js"; import { Properties } from "./properties.js"; export * from "./ifc2x4.js"; export declare const UNKNOWN = 0; export declare const STRING = 1; export declare const LABEL = 2; export declare const ENUM = 3; export declare const REAL = 4; export declare const REF = 5; export declare const EMPTY = 6; export declare const SET_BEGIN = 7; export declare const SET_END = 8; export declare const LINE_END = 9; export interface Loadersettings { COORDINATE_TO_ORIGIN: boolean; USE_FAST_BOOLS: boolean; CIRCLE_SEGMENTS_LOW?: number; CIRCLE_SEGMENTS_MEDIUM?: number; CIRCLE_SEGMENTS_HIGH?: number; BOOL_ABORT_THRESHOLD?: number; /** * Conway extension (real web-ifc has no per-phase progress surface): * throttled structured progress events during OpenModel/OpenModelAsync — * see core/progress.ts and conway issue #301. Embedders should * feature-detect ('ON_PROGRESS simply ignored by older engines'). */ ON_PROGRESS?: ProgressCallback; /** * Conway extension: fired once, right after the STEP header parses — * before the full file parse — with everything the header reveals * (file name, schema, originating system, preprocessor, byte size), so * embedders can print the model line as early as possible (issue #301). */ ON_MODEL_INFO?: (info: ModelInfo) => void; } /** * web-ifc compatible log levels (numeric values match web-ifc's enum so an * engine swap keeps SetLogLevel calls working). Mapped onto conway's * Logger threshold — see logging/logger.ts. */ export declare enum LogLevel { LOG_LEVEL_DEBUG = 1, LOG_LEVEL_INFO = 2, LOG_LEVEL_WARN = 3, LOG_LEVEL_ERROR = 4, LOG_LEVEL_OFF = 5 } export interface Vector { get(index: number): T; push(parameter: T): void; size(): number; } export interface Color { x: number; y: number; z: number; w: number; } export interface PlacedGeometry { color: Color; geometryExpressID: number; flatTransformation: Array; occurrencePath?: ReadonlyArray; } export interface FlatMesh { geometries: Vector; expressID: number; } export interface RawLineData { ID: number; type: number; arguments: any[]; } export interface LoaderError { type: string; message: string; expressID: number; ifcType: number; } export interface IfcGeometry { GetVertexData(): number; GetVertexDataSize(): number; GetIndexData(): number; GetIndexDataSize(): number; } /** * @return {number} current time in ms */ export declare function ms(): number; export type LocateFileHandlerFn = FileHandlerCallback; /** * IfcAPI - Web-IFC API Shim Implementation for full read functionality */ export declare class IfcAPI { wasmModule: undefined | any; fs: undefined | any; wasmPath: string; isWasmPathAbsolute: boolean; settings: Loadersettings | undefined; globalModelIDCounter: number; models: Map; conwaywasm: ConwayGeometry; _isCoordinated: boolean; linearScalingFactor: number; identity: number[]; NormalizeMat: glmatrix.mat4; properties: Properties; /** * Get the passthrough for a particular model id. * * @param modelID * @return {IfcApiModelPassthrough | undefined} */ getPassthrough(modelID: number): IfcApiModelPassthrough | undefined; /** * Initializes the WASM module (WebIFCWasm), required before using any other functionality. * * @param customLocateFileHandler An optional locateFile function that let's * you override the path from which the wasm module is loaded. */ Init(customLocateFileHandler?: LocateFileHandlerFn): Promise; /** * Opens a model and returns a modelID number * * @param data containing IFC data (bytes) * @param settings settings for loading the model * @return {number} model ID */ OpenModel(data: Uint8Array, settings?: Loadersettings): number; /** * Cooperative variant of OpenModel (conway extension; feature-detect with * typeof api.OpenModelAsync === 'function'). Identical parse/extraction, * but periodically yields to the event loop so browsers can repaint * progress UI (settings.ON_PROGRESS) and the tab is not flagged as * stalled — conway issue #301 §2. Currently cooperative for IFC input; * AP214/AP203/AP242 fall back to the synchronous path. * * @param data containing IFC data (bytes) * @param settings settings for loading the model * @return {Promise} model ID */ OpenModelAsync(data: Uint8Array, settings?: Loadersettings): Promise; /** * Set conway's console-echo log threshold, web-ifc compatible surface * (numeric LogLevel enum). Embedders (e.g. Share) use this to quiet a * clean load's console down to warnings/errors — conway issue #301. * * @param level the web-ifc style numeric log level */ SetLogLevel(level: LogLevel): void; /** * Creates a new model and returns a modelID number (unimplemented) * * @param settings settings for generating data the model * @return {number} model ID */ CreateModel(settings?: Loadersettings): number; /** * * @param modelID * @return {Uint8Array} unimplemented */ ExportFileAsIFC(modelID: number): Uint8Array; /** * Opens a model and returns a modelID number * * @param modelID handle retrieved by OpenModel, model must not be closed * @param geometryExpressID containing IFC data (bytes) * @return {IfcGeometry} */ GetGeometry(modelID: number, geometryExpressID: number): IfcGeometry; /** * * @param modelID * @param expressID * @param flatten * @return {any} line data */ GetLine(modelID: number, expressID: number, flatten?: boolean): string | void; /** * Conway extension (no web-ifc equivalent): drop the model's * materialised entity/descriptor caches, returning that memory to the * JS heap. Entities and attributes rematerialise transparently on the * next property access, so callers can invoke this between UI * interactions to keep the property working set bounded to what the * active UI is touching. * * @param modelID */ ReleaseEntityCache(modelID: number): void; /** * Conway extension: release the model's resident source buffer and * serve subsequent record reads through fixed-size windows paged in * from an external byte store (which must hold exactly the model's * source bytes — e.g. the original file already sitting in OPFS). * * After a spill, asynchronous property APIs page ranges in on * demand; SYNCHRONOUS record reads (getLine on the passthrough) * require the range to be resident and throw otherwise. Call this * only after load-time sweeps (geometry extraction, spatial tree, * GLB property capture) are done. * * @param modelID The model to spill. * @param store The external byte store holding the source bytes. * @param chunkBytes Optional window size in bytes (default 4MiB). * @param maxResidentChunks Optional residency cap (default 16 windows). * @return {boolean} True when the spill happened. */ SpillModelSource(modelID: number, store: StepExternalByteStore, chunkBytes?: number, maxResidentChunks?: number): boolean; /** * Conway extension: lazily iterate the express IDs of all root-derived * (GlobalId-bearing) entities — products, relationships, property sets, * quantities — straight from the type index. No entity descriptors are * materialised and the source buffer is never touched, so this is safe * and cheap even after SpillModelSource, and lets property sweeps skip * the geometric-resource records that dominate large models. * * Multi-mapped entities may be yielded once per mapping; callers that * need distinct IDs should dedupe. Returns undefined when the model * doesn't exist or its schema has no root-type notion (e.g. AP214). * * @param modelID The model to iterate. * @return {IterableIterator | undefined} Lazy express ID * iterator, or undefined when unsupported. */ RootExpressIDs(modelID: number): IterableIterator | undefined; /** * * @param modelID * @return {Vector} */ GetAndClearErrors(modelID: number): Vector; /** * * @param modelID * @param lineObject */ WriteLine(modelID: number, lineObject: any): void; /** * * @param modelID * @param line * @return {string | undefined} */ FlattenLine(modelID: number, line: any): void; /** * * @param modelID * @param expressID * @return {RawLineData} */ GetRawLineData(modelID: number, expressID: number): RawLineData; /** * Get all line ids with the matching type * * @param modelID * @param type * @return {Vector} The matching express IDs */ GetLineIDsWithType(modelID: number, type: number): Vector; /** * * @param modelID * @return {Vector} */ GetAllLines(modelID: number): Vector; /** * * @param modelID * @param transformationMatrix */ setGeometryTransformation(modelID: number, transformationMatrix: Array): void; /** * * @param modelID * @return {Array} */ GetCoordinationMatrix(modelID: number): Array; /** * * @param ptr * @param size * @return {Float32Array} */ GetVertexArray(ptr: number, size: number): Float32Array; /** * * @param ptr * @param size * @return {Uint32Array} */ GetIndexArray(ptr: number, size: number): Uint32Array; /** * * @param heap * @param startPtr * @param sizeBytes * @return {Float32Array | Uint32Array} */ getSubArray(heap: Float32Array | Uint32Array, startPtr: number, sizeBytes: number): Float32Array | Uint32Array; /** * Closes a model and frees all related memory * * @param modelID Model handle retrieved by OpenModel, model must not be closed */ CloseModel(modelID: number): void; /** * * @param modelID * @param meshCallback */ StreamAllMeshes(modelID: number, meshCallback: (mesh: FlatMesh) => void): void; /** * * @param modelID * @param types * @param meshCallback */ StreamAllMeshesWithTypes(modelID: number, types: Array, meshCallback: (mesh: FlatMesh) => void): void; /** * Checks if a specific model ID is open or closed * * @param modelID handle retrieved by OpenModel * @return {boolean} */ IsModelOpen(modelID: number): boolean; /** * Load all geometry in a model * * @param modelID handle retrieved by OpenModel * @return {Vector} */ LoadAllGeometry(modelID: number): Vector; /** * Load geometry for a single element * * @param modelID handle retrieved by OpenModel * @param expressID express ID of flat mesh * @return {FlatMesh} */ GetFlatMesh(modelID: number, expressID: number): FlatMesh; /** * Creates a map between element ExpressIDs and GlobalIDs. * Each element has two entries, (ExpressID -> GlobalID) and (GlobalID -> ExpressID). * * @param modelID handle retrieved by OpenModel */ CreateIfcGuidToExpressIdMapping(modelID: number): void; /** * * @param path new wasm path * @param absolute is the path absolute? */ SetWasmPath(path: string, absolute?: boolean): void; /** The conway version string like "0.23.940-WebMT" */ getConwayVersion(): string; /** @see https://bldrs-ai.github.io/conway/classes/statistics_statistics.Statistics.html */ getStatistics(modelID: number): any; } //# sourceMappingURL=ifc_api.d.ts.map