That Open Engine | web-ifc
    Preparing search index...

    Class IfcAPI

    Index
    properties: Properties = ...

    Contains all the logic and methods regarding properties, psets, qsets, etc.

    • Closes a model and frees all related memory

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel, model must be closed after use

      Returns void

    • Creates a new ifc entity

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • type: number

        Type code

      • ...args: any[]

        Arguments required by the entity

      Returns IfcLineObject

      An object contining the parameters of the new entity

    • Creates a new ifc globally unqiue ID

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      Returns any

      An randomly generated globally unique ID

    • Creates a new ifc type i.e. IfcLabel, IfcReal, ...

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • type: number

        Type code

      • value: any

        Type value

      Returns any

      An object with the parameters of the type

    • Decodes test using IFC Encoding

      Parameters

      • text: string

      Returns any

      the text decoded

      the text to decode

    • Deletes an IFC line from the model

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • expressID: number

        express ID of the line to remove

      Returns void

    • Closes all models and frees all related memory. Please note that after calling this you must call Init() again to ensure web-ifc is in a working state.

      Returns void

    • Encodes test using IFC Encoding

      Parameters

      • text: string

      Returns any

      the text encoded

      the text to encode

    • Returns all alignments contained in the IFC model (IFC4x3 or superior)

      Parameters

      • modelID: number

        model ID

      Returns any

      Lists with horizontal and vertical curves as sets of points

    • Returns all crossSections in 2D contained in IFCSECTIONEDSOLID, IFCSECTIONEDSURFACE, IFCSECTIONEDSOLIDHORIZONTAL (IFC4x3 or superior)

      Parameters

      • modelID: number

        model ID

      Returns CrossSection[]

      Lists with the cross sections curves as sets of points

    • Returns all crossSections in 3D contained in IFCSECTIONEDSOLID, IFCSECTIONEDSURFACE, IFCSECTIONEDSOLIDHORIZONTAL (IFC4x3 or superior)

      Parameters

      • modelID: number

        model ID

      Returns CrossSection[]

      Lists with the cross sections curves as sets of points

    • Get all line IDs of a model

      Parameters

      • modelID: number

        model ID

      Returns Vector<number>

      vector of all line IDs

    • Gets the list of all ifcTypes contained in the model

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      Returns IfcType[]

      Array of objects containing typeID and typeName

    • Get the coordination matrix

      Parameters

      • modelID: number

        model ID

      Returns number[]

      flat 4x4 matrix as array[16]

    • Looks up an entities express ID from its GlobalID.

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • guid: string

        GobalID to be looked up

      Returns string | number | undefined

      expressID numerical value

    • Load geometry for a single element

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • expressID: number

        ExpressID of the element

      • applyLinearScalingFactor: boolean = true

        Whether to apply the model's linear scaling factor to the geometry (default: true)

      Returns FlatMesh

      FlatMesh object

    • Retrieves the geometry of an element

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • geometryExpressID: number

        express ID of the element

      Returns IfcGeometry

      Geometry of the element as a list of vertices and indices

    • Looks up an entities GlobalID from its ExpressID.

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • expressID: number

        express ID to be looked up

      Returns string | number | undefined

      globalID string value

    • Gets the header information required by the user

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • headerType: number

        Type of header data you want to retrieve ifc.FILE_NAME, ifc.FILE_DESCRIPTION or ifc.FILE_SCHEMA

      Returns any

      An object with parameters ID, type and arguments

    • Returns a list with all entity types that are present in the current schema

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      Returns number[]

      Array of type codes

    • Parameters

      • ptr: number
      • size: number

      Returns Uint32Array

    • Gets the ifc line data for a given express ID

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • expressID: number

        express ID of the line

      • flatten: boolean = false

        recursively flatten the line, default false

      • inverse: boolean = false

        get the inverse properties of the line, default false

      • inversePropKey: string | null | undefined = null

        filters out all other properties from a inverse search, for a increase in performance. Default null

      Returns any

      lineObject

    • Get all line IDs of a specific ifc type

      Parameters

      • modelID: number

        model ID

      • type: number

        ifc type,

      • includeInherited: boolean = false

        if true, also returns all inherited types

      Returns Vector<number>

      vector of line IDs

      IfcEntities

    • Gets the ifc line data for a given express ID

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • expressIDs: number[]
      • flatten: boolean = false

        recursively flatten the line, default false

      • inverse: boolean = false

        get the inverse properties of the line, default false

      • inversePropKey: string | null | undefined = null

        filters out all other properties from a inverse search, for a increase in performance. Default null

      Returns any[]

      lineObject

    • Returns the type of a given ifc entity in the fiule.

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • expressID: number

        Line Number

      Returns any

      IFC Type Code

    • Returns the maximum ExpressID value in the IFC file, ex.- #9999999

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      Returns number

      Express numerical value

    • Fetches the ifc schema version of a given model

      Parameters

      • modelID: number

        Model ID

      Returns string

      IFC Schema version

    • Gets the name from a type code

      Parameters

      • type: number

        Code

      Returns string

      Name

    • Gets the next unused expressID

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • expressID: number

        Starting expressID value

      Returns number

      The next unused expressID starting from the value provided

    • Section (or floor plan, with a horizontal plane) of a whole model: every element whose geometry the plane crosses, cut as one mesh (all its pieces, placed). Coordinates are web-ifc's model frame (Y up, metres when applyLinearScalingFactor is true, the same frame as StreamAllMeshes + flatTransformation).

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • plane: SectionPlane

        the plane, in the model frame

      • options: SectionOptions = {}

        see SectionMesh (default weld 1e-5, closeGap 1e-3 here: model units after scaling)

      Returns (SectionResult & { color: Color; expressID: number })[]

      one entry per element crossed, with its expressID and the colour of its first piece

    • Parameters

      • heap: any
      • startPtr: number
      • sizeBytes: number

      Returns any

    • The swept disks of a product (e.g. reinforcing bars) without meshing them: per IfcSweptDiskSolid item, its placement and colour as StreamMeshes would give them, the directrix it is swept along (any curve: arcs and trims evaluated as for the mesh) and its radius. No tube is built and nothing stays cached. Other items of the product are not returned.

      Parameters

      • modelID: number
      • productID: number

      Returns SweptDiskAxis[]

    • Gets the type code from a name code

      Parameters

      • typeName: string

      Returns number

      type code

    • Returns the version number of web-ifc

      Returns any

      The current version number as a string

    • Parameters

      • ptr: number
      • size: number

      Returns Float32Array

    • Parameters

      • modelID: number
      • placementExpressId: number

      Returns number[]

    • Whether this build carries the brep geometry engine.

      Returns boolean

    • Initializes the WASM module (WebIFCWasm), required before using any other functionality.

      Parameters

      • OptionalcustomLocateFileHandler: LocateFileHandlerFn

        An optional locateFile function that let's you override the path from which the wasm module is loaded.

      • forceSingleThread: boolean = false

      Returns Promise<void>

    • Evaluates if a type is subtype of IfcElement

      Parameters

      • type: number

        Type code

      Returns boolean

      True if subtype of Ifcelement, False if it is not subtype

    • Checks if a specific model ID is open or closed

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      Returns boolean

      true if model is open, false if model is closed

    • Load all geometry in a model

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • applyLinearScalingFactor: boolean = true

        Whether to apply the model's linear scaling factor to the geometry (default: true)

      Returns Vector<FlatMesh>

      Vector of FlatMesh objects

    • Opens a model and returns a modelID number

      Parameters

      • data: Uint8Array

        Buffer containing IFC data (bytes)

      • Optionalsettings: LoaderSettings

        Settings for loading the model

      Returns number

      ModelID or -1 if model fails to open

      LoaderSettings

    • Opens a model and returns a modelID number

      Parameters

      • callback: ModelLoadCallback

        a function of signature (offset:number, size: number) => Uint8Array that will retrieve the IFC data

      • Optionalsettings: LoaderSettings

        Settings for loading the model

      Returns number

      ModelID or -1 if model fails to open

      LoaderSettings

    • Opens a set of models and returns model IDs

      Parameters

      • dataSets: Uint8Array<ArrayBufferLike>[]

        Array of Buffers containing IFC data (bytes)

      • Optionalsettings: LoaderSettings

        Settings for loading the model

      Returns number[]

      Array of model IDs

      LoaderSettings

    • Resets the Cached IFC Data - useful when changing the geometry of a model

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      Returns any

    • Saves a model to a Buffer

      Parameters

      • modelID: number

        Model ID

      Returns Uint8Array

      Buffer containing the model data

    • Section of one triangle mesh by a plane: the cut lines and the cut area (cap), triangulated. The mesh is not modified (hiding the part in front of the plane is up to the viewer, e.g. a clipping plane). Tolerant of real-world meshes: flipped triangles do not matter, loops are nested by containment (holes are kept), chains that do not close are closed when their ends are nearer than closeGap, and whatever stays open is returned as lines only (counted in openChains).

      Parameters

      • positions: ArrayLike<number>

        x, y, z per vertex (any frame, any units)

      • indices: ArrayLike<number>

        3 per triangle

      • plane: SectionPlane

        the plane, through point with normal normal, in the same frame as the positions

      • options: SectionOptions = {}

        weld: distance under which two cut points are the same (default 1e-6); closeGap: largest gap closed between the ends of open chains (default 0 = never)

      Returns SectionResult

      capPositions (x, y, z) + capIndices, lines (x1, y1, z1, x2, y2, z2 per segment) and counters

    • Registers an external boolean engine used as a RESERVE: web-ifc always runs its own boolean chain first; only when the result of a chain has open (naked) edges is the whole chain redone with this function, and the result with fewer naked edges is kept (tie → web-ifc). If the function throws or returns an invalid mesh, web-ifc's result is kept. Pass null to unregister. The function is called synchronously as fn(op, A, B, { unitToMetre }) with op 'DIFFERENCE' | 'UNION' and A/B = { positions: Float64Array (x,y,z in model units), indices: Uint32Array }; it must return { positions, indices }. Counters: globalThis.__morphBoolStats (chainsChecked, chainsOpen, chainsRedone, chainsKeptGeokernel, chainsKeptWebifc, geokernelFails, calls, ok, fallback, ms). BY DEFAULT the bundled geokernel is registered by Init(); call SetBooleanFallback(null) to disable it (pure web-ifc), or pass another function to replace it.

      Parameters

      • fn:
            | (
                (
                    op: "UNION" | "DIFFERENCE",
                    a: { indices: Uint32Array; positions: Float64Array },
                    b: { indices: Uint32Array; positions: Float64Array },
                    opts: { unitToMetre: number },
                ) => {
                    indices: number[] | Uint32Array<ArrayBufferLike>;
                    positions: number[] | Float64Array<ArrayBufferLike>;
                }
            )
            | null

        the external boolean function, or null

      Returns void

    • The brep engine on booleans only: Body items that are IfcBooleanResult / IfcBooleanClippingResult (or belong to a product with openings) go to the brep kernel, everything else is meshed by web-ifc as with StreamMeshes, keeping its shared geometries.

      Parameters

      • modelID: number
      • on: boolean

      Returns void

    • Set the transformation matrix

      Parameters

      • modelID: number

        model ID

      • transformationMatrix: number[]

        transformation matrix, flat 4x4 matrix as array[16]

      Returns void

    • Sets the path to the wasm file

      Parameters

      • path: string

        path to the wasm file

      • absolute: boolean = false

        if true, path is absolute, otherwise it is relative to executing script

      Returns void

    • As StreamAllMeshes, with the brep kernel as the geometry engine (builds with BREP_ENGINE only). Each Body item the kernel builds comes as a shell instead of a mesh: its geometry in mesh has no vertices, and shells holds { id, points, rings } for it -- points in file units, in the frame the geometry's flatTransformation places; rings per face: ring count, then each ring's length and point indices, the first ring the outer one. The arrays view wasm memory and are valid during the callback only. Anything the kernel does not build comes as an ordinary mesh.

      Parameters

      • modelID: number
      • meshCallback: (mesh: FlatMesh, shells: BrepShell[], index: number, total: number) => void

      Returns void

    • Streams all meshes of a model

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • meshCallback: (mesh: FlatMesh, index: number, total: number) => void

        callback function that is called for each mesh

      • applyLinearScalingFactor: boolean = true

        Whether to apply the model's linear scaling factor to the geometry (default: true)

      Returns void

    • Streams all meshes of a model with a specific ifc type

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • types: number[]

        types of elements to stream

      • meshCallback: (mesh: FlatMesh, index: number, total: number) => void

        callback function that is called for each mesh

      • applyLinearScalingFactor: boolean = true

        Whether to apply the model's linear scaling factor to the geometry (default: true)

      Returns void

    • As StreamMeshes, with the brep kernel as the geometry engine. See StreamAllBrepMeshes.

      Parameters

      • modelID: number
      • expressIDs: number[]
      • meshCallback: (mesh: FlatMesh, shells: BrepShell[], index: number, total: number) => void

      Returns void

    • Streams meshes of a model with specific express id

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • expressIDs: number[]

        expressIDs of elements to stream

      • meshCallback: (mesh: FlatMesh, index: number, total: number) => void

        callback function that is called for each mesh

      • applyLinearScalingFactor: boolean = true

        Whether to apply the model's linear scaling factor to the geometry (default: true)

      Returns void

    • Writes a set of line to the model, can be used to write new lines or to update existing lines

      Type Parameters

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • lineObject: Type

        line object to write

      Returns void

    • Writes a line to the model, can be used to write new lines or to update existing lines

      Type Parameters

      Parameters

      • modelID: number

        Model handle retrieved by OpenModel

      • lineObjects: Type[]

      Returns void