@openbim/ifc
    Preparing search index...

    Class IfcModel

    An IFC model: entities keyed by their #id, in file order.

    A newtype because wasm_bindgen can only export a type defined in this crate; all state and behaviour are the core's.

    Index
    schema: string | undefined

    The first FILE_SCHEMA token, e.g. "IFC4", or undefined.

    size: number

    Number of entities.

    • Returns void

    • Append an entity; returns its id (bigint).

      Parameters

      • typeName: string
      • attributes: IfcValue[]

      Returns bigint

    • Copy entities ids of source into this model with what belongs to them, as one checked transaction: what they reference, their property sets, type, material and classification, their openings, fillings and ports, and what attaches to their geometry. Units, contexts, the owner history, materials and styles equal to this model's are reused (reuse names the kinds; all by default). Relationships to objects not copied (a spatial container) are skipped and reported. globalIds: keep (the default; one this model holds is refused), merge (an IfcRoot this model holds by GlobalId and type is reused, its relationships joined), regenerate or regenerate-colliding. Refused with unsupported when the models' length or plane angle units differ, unsupported-schema for an entity this model's release cannot hold, invalid-value for a kept GlobalId this model holds.

      Parameters

      Returns CopyReport

    • Attribute index of entity id, as a tagged value.

      Parameters

      • id: bigint
      • slot: number

      Returns IfcValue

    • Attribute name of entity id (case-insensitive, e.g. "Name"), resolved against the declared release, as a tagged value.

      An INVERSE name ("IsDefinedBy", #462) reads the entities referencing id through the release's FOR clause: a list of refs for a SET or BAG (SET [0:1] included: zero or one element), a ref or null for a single-valued inverse, which two referrers refuse with invalid-model.

      Parameters

      • id: bigint
      • name: string

      Returns IfcValue

    • Every explicit attribute of entity id in slot order, inherited first, as the release the header declares defines them.

      Parameters

      • id: bigint

      Returns AttributeInfo[]

    • Every attribute of entity id, as tagged values.

      Parameters

      • id: bigint

      Returns IfcValue[]

    • Apply authoring operations as one checked transaction against the release the header declares: every operation, in order, or none, and a refused batch leaves the model unchanged. An operation names the entity an earlier one produced by IfcModel.handle(index). result.ids holds, per operation, the id of the entity it produced.

      Parameters

      Returns AuthoringResult

    • The id of the entity whose GlobalId is globalId, or undefined.

      The first lookup indexes every GlobalId once; later ones reuse the index until the model changes. Throws invalid-value for text that is not a GlobalId and invalid-model when several entities carry it (duplicateGlobalIds lists them).

      Parameters

      • globalId: string

      Returns bigint | undefined

    • The classifications that apply to object id: its own, then its type object's.

      Parameters

      • id: bigint

      Returns Classification[]

    • Drop every undo and redo entry, keeping the limit.

      Returns void

    • Convert the model's length unit to the unit named target (an SI METRE with any prefix, or inch, foot, yard, mile, US survey foot), rescaling every length, area and volume value as one checked transaction; with dryRun, only report. Values with a unit of their own keep it; values the conversion cannot carry (a p-curve off a plane, a polynomial curve, a parameter on an undefined parameter space) refuse the whole conversion with unsupported, each named.

      Parameters

      Returns LengthUnitReport

    • Convert value from unit entity from to unit entity to of this model (IfcSIUnit, IfcConversionBasedUnit, IfcDerivedUnit).

      Parameters

      • value: number
      • from: bigint
      • to: bigint

      Returns number

    • Copy product (or type object) id with everything it solely owns, as one checked transaction: what removeProduct would remove with it is copied (its placement, representation, own property sets, material usage, ports and, unless openings or fillings is false, its openings and the doors and windows filling them), what it would keep is shared, the copy joining the relationship (its type, shared property sets, classification and, unless container or aggregate is false, its container and whole). offset moves the copy in its parent placement's frame; placement places it by that IfcObjectPlacement instead. The report maps every original to its copy; with dryRun nothing changes. Refused with wrong-entity-type for neither a product nor a type object, invalid-value for both offset and placement, unsupported for an offset onto a placement that is not a local placement with a Cartesian location, or a moved copy whose openings are not placed relative to it.

      Parameters

      Returns CopyReport

    • Every cost schedule and cost item, with values in the tagged encoding.

      Returns Cost

    • Create one entity of typeName from named attributes, checked against the declared release (author with one create); an IfcRoot without a GlobalId gets one. Returns its id (bigint).

      Parameters

      • typeName: string
      • attributes: Record<string, IfcValue>

      Returns bigint

    • Every [from, to] pair (bigints) where to does not exist.

      Returns [bigint, bigint][]

    • Non-fatal problems found while reading.

      Returns string[]

    • Every GlobalId several entities carry, with its holders in file order; empty for a conformant file.

      Returns DuplicateGlobalId[]

    • The entities selector query selects as a table (#474), as bytes: options.format "csv" (default), "tsv" or "xlsx" (only in a build with sheet-xlsx; the npm package throws feature-disabled), the key column first ("GlobalId", or "id" with options.key), then one column per value path of columns ("Name", "type.Name", "Pset_WallCommon.FireRating"), each cell the value the path reads as text, NULL as options.null (empty by default). Throws invalid-selector for a query or path that does not parse, invalid-value for an unknown format or key, and wrong-entity-type for an entity without a GlobalId in a table keyed by it.

      Parameters

      • query: string
      • columns: string[]
      • options: TableOptions | undefined

      Returns Uint8Array

    • Every element filling opening id (IfcRelFillsElement).

      Parameters

      • id: bigint

      Returns bigint[]

    • Returns void

    • Every coordinate operation (map conversion) resolved with the project length unit; empty when the model has none. IFC2X3 is read from its ePSet_MapConversion and ePSet_ProjectedCRS property sets.

      Returns MapConversion[]

    • The value path reads from entity id: "type.Name", "Pset_WallCommon.FireRating", "materials.Name", "occurrences.count".

      Parameters

      • id: bigint
      • path: string

      Returns IfcSelectedValue

    • The STEP file header: description, name, time stamp, author, organization, preprocessor, originating system, authorization and schema tokens.

      Returns IfcHeader

    • Every entity id (bigint), in file order.

      Returns bigint[]

    • Ids of every entity of exactly typeName, case-insensitive.

      Parameters

      • typeName: string

      Returns bigint[]

    • Ids of every entity of typeName or any subtype, per the file's declared schema: IfcWall also finds IFCWALLSTANDARDCASE.

      Parameters

      • typeName: string

      Returns bigint[]

    • Apply a table (Uint8Array) back to the model by its key column (#474), as one checked transaction: every other cell is written by its header's value path, typed by the attribute's declared type or the property's stated one; a cell that reads what the model holds changes nothing, so an exported table imported unchanged is a no-op. The answer lists every change and every refusal by row and column; any refusal means nothing was written, as does options.dryRun. Throws only for a call that cannot start: an unknown format or key, bytes that are no table of the format.

      Parameters

      Returns TableImport

    • Every INVERSE attribute of entity id, inherited ones first, as the declared release defines them (#462).

      Parameters

      • id: bigint

      Returns InverseAttributeInfo[]

    • Every reference to entity id: the referencing entity and the attribute index it references through, in ascending order (#462).

      Parameters

      • id: bigint

      Returns InverseReference[]

    • The material association that applies to object id (its own, or its type object's), or undefined when there is none.

      Parameters

      • id: bigint

      Returns MaterialAssignment | undefined

    • Every object type object id types, in file order.

      Parameters

      • id: bigint

      Returns bigint[]

    • Every opening voiding element id (IfcRelVoidsElement).

      Parameters

      • id: bigint

      Returns bigint[]

    • Each product's curves as polylines from the reference backend (#458), for ids or, without, every product with a shape: positions (Float32Array, metres, relative to transform), every polyline's vertices in turn, and per curve its slice, whether it is closed and its certified chord bound. representation is "Plan" by default (the best drawing curves), or "Axis", "FootPrint", "Annotation", "Body", "Surface"; another throws invalid-value. Trimmed, composite, offset and intrinsic curves compile (#506); a curve the reference compiler has no certified polyline for (an implicit curve, an offset of an offset) is an unsupported refusal naming the product. Text literals and annotation fill areas beside the curves (a dimension's value) are listed in skipped, not refused (#512). Opt-in with the meshes: import @openbim/ifc/mesh.

      Parameters

      • ids: bigint[] | BigUint64Array<ArrayBufferLike> | undefined
      • representation: RepresentationName | undefined

      Returns ProductCurves[]

    • Each product's Body as Axiolid's neutral geometry graph (#367), exact (extrusions, sweeps, B-splines, unevaluated booleans), for ids or, without, every product with a shape, in Axiolid's versioned wire format: { format: "axiolid-geometry-graph", version: "1.0", graph: { nodes, roots } } (the lowest version the content needs, "1.0" to "1.4"), in world coordinates, metres. encoding picks the payload: "json" (the default) the text, "object" the text parsed, "cbor" the CBOR bytes as a Uint8Array. A product that cannot be lowered has a typed refusal; the call itself throws only unsupported-schema, feature-disabled (feature graph) or invalid-value for an unknown encoding.

      Parameters

      Returns ProductGeometry[]

    • Each product's Body as triangles from the reference backend: positions (Float32Array, metres, relative to transform) and indices (Uint32Array), for ids or, without, every product with a shape. A product that cannot be meshed has a typed refusal. representation meshes another one instead (#458), such as "Surface"; its curves are left to productCurves, and closure says "solid" or "surface". Only a Body mesh carries a colour. Opt-in: a build without the mesh feature (the npm package's default entry) throws feature-disabled; import @openbim/ifc/mesh for it.

      Parameters

      • ids: bigint[] | BigUint64Array<ArrayBufferLike> | undefined
      • representation: RepresentationName | undefined

      Returns ProductMesh[]

    • Each product's world placement (a column-major 4x4 in metres) and the Body representation a viewer draws, for ids or, without, for every product with a shape. A product that cannot be placed is a record with a typed refusal; the call itself throws only unsupported-schema or feature-disabled (feature placements).

      Parameters

      • ids: bigint[] | BigUint64Array<ArrayBufferLike> | undefined

      Returns ProductPlacement[]

    • The property sets, quantity sets and predefined property sets that apply to object id: its own first, then those inherited from its type object, an occurrence property overriding an inherited one. Values keep their declared IFC type (typed IFCLENGTHMEASURE(...)).

      Parameters

      • id: bigint

      Returns PropertySet[]

    • The property sets of each of ids, in that order, or, with no ids, of every object definition (IfcObjectDefinition and its subtypes) in file order, in one pass (#358): the file's property relationships are validated once for the call, so resolving every object is linear in the model. Each ObjectPropertySets holds exactly what propertySets returns for its object, or, in refusal, the code and message it throws; only a refusal of the whole model throws. No index outlives the call.

      Parameters

      • ids: bigint[] | BigUint64Array<ArrayBufferLike> | undefined

      Returns ObjectPropertySets[]

    • Remove unreferenced entities as one checked transaction; with dryRun, only report. Without classes, every resource entity no IfcRoot reaches (nor annotates something reached); with them, the entities of those classes nothing references, an IfcRoot only with includeRoots. The owner history stays unless includeOwnerHistory. Refused with unsupported-schema for a class the release does not declare.

      Parameters

      Returns RemovalReport

    • Reverse the last undo. Refused with history-empty when there is nothing to redo and history-stale as undo is.

      Returns HistoryChange

    • Remove entity id, leaving references to it dangling.

      Parameters

      • id: bigint

      Returns void

      A file with dangling references parses and is wrong (#478). Use removeWithRelationships for one entity, or removeProduct for a product with what it solely owns. It keeps working.

    • Remove product (or type object) id with everything it solely owns -- its placement, representation, own property and quantity sets, material usage, openings and ports, and the relationships left without an end -- as one checked transaction, keeping what is shared (a property set another object uses, a type's representation maps). The report says what went, what stayed and why; with dryRun nothing changes. Refused with still-referenced while other placements are relative to its placement (unless rebasePlacements) or a type object types objects (unless untypeOccurrences), wrong-entity-type for neither a product nor a type object, unsupported for a placement that cannot be re-based.

      Parameters

      Returns RemovalReport

    • Remove one property from the object's own set (setProperties with one edit).

      Parameters

      • object: bigint
      • set: string
      • name: string

      Returns void

    • Remove shape representation id with what only it uses (#481), as one checked transaction: taken off its product definition shape (which goes when left empty), representation map or shape aspects, then removed with its items down to what nothing else uses. Shared items, profiles, points and styles stay, and the report says why; with dryRun nothing changes. Refused with still-referenced for a representation map an IfcMappedItem still maps, wrong-entity-type for an entity that is not an IfcShapeModel.

      Parameters

      Returns RemovalReport

    • Remove entity id with its relationships, leaving nothing dangling (author with one remove); refused with still-referenced while an entity other than a relationship needs it.

      Parameters

      • id: bigint

      Returns void

    • The effective unit of a measureType value ("IFCAREAMEASURE"): unit when given (a property's stated unit), otherwise the project default, resolved exactly to SI.

      Parameters

      • measureType: string
      • unit: bigint | undefined

      Returns ResolvedUnit

    • The ids selector query selects, ascending (#464); with base, from those entities alone.

      Class facets (subtypes included) add entities, ! removes them; attribute, property and type=, material=, classification=, location= and group= facets filter; , chains facets and + unites lists. Throws invalid-selector (with span, the byte range in the UTF-8 query) for a query that does not parse or names a class or attribute the file's release does not declare.

      Parameters

      • query: string
      • base: bigint[] | BigUint64Array<ArrayBufferLike> | undefined

      Returns bigint[]

    • Set attribute index of entity id; returns the previous value.

      Parameters

      • id: bigint
      • slot: number
      • value: IfcValue

      Returns IfcValue

    • Set attribute name of entity id; returns the previous value. A derived attribute is refused (derived-attribute), an INVERSE one (inverse-attribute).

      An IfcValue object is written exactly. A plain value (#342) is coerced against the attribute's declared type in the declared release: a string to a label (bare) or the enumeration item it names, a safe-integer number or a bigint to an INTEGER or REAL as declared, any other number to a REAL, a boolean to a BOOLEAN or LOGICAL, an array to an aggregate element by element, null to $; in a SELECT, the one member that takes it as a typed parameter. Refused with type-mismatch when it does not fit and ambiguous-value when several SELECT members take it.

      Parameters

      Returns IfcValue

    • Replace the STEP file header; every field is required.

      Parameters

      Returns void

    • Keep at most limit undo entries; 0 (the default) turns history off and drops what is held. While it is on, every method that changes the model is one entry (author is one entry for its whole batch). Refused with invalid-value for a limit that is not a whole number of at least 0 that fits the platform.

      Parameters

      • limit: number

      Returns void

    • Write and remove property and quantity values as one checked transaction: every edit, in order, or none, and a refused batch leaves the model unchanged. A write's value is the read side's value; an inherited value is overridden on the occurrence, never changed on the shared type set.

      Parameters

      Returns PropertyEditResult

    • Write one value (setProperties with one edit); returns the entity holding it (bigint).

      Parameters

      • object: bigint
      • set: string
      • name: string
      • value: IfcValue
      • OptionalsetType: string | null

      Returns bigint

    • Write value at path of entity id as one checked transaction: an attribute coerced as setAttributeByName coerces a plain value, or a property from a typed value, or a plain one when the property already states its type. A refused write changes nothing.

      Parameters

      Returns void

    • The spatial containment tree: every container with its parent, sub-containers and contained elements.

      Returns SpatialTree

    • Every system with its members and served structures, and the memberships the reader could not honour.

      Returns Systems

    • How many distinct entities reference entity id (#462).

      Parameters

      • id: bigint

      Returns number

    • The type object of occurrence id (IfcRelDefinesByType), or undefined. Throws wrong-entity-type for a non-IfcObject and invalid-model when the file states two types.

      Parameters

      • id: bigint

      Returns bigint | undefined

    • The upper-case type name of entity id.

      Parameters

      • id: bigint

      Returns string

    • Restore the model to the state before the last change: entities under their ids and at their file positions, the header included. Undoing a creation frees its id again. Refused with history-empty when there is nothing to undo (also while history is off) and history-stale when the model changed outside the history; the model is unchanged then.

      Returns HistoryChange

    • Products no viewer will draw (outside the spatial structure, or with geometry only in non-model contexts), with a stable reason.

      Returns UnreachableProduct[]

    • Validate against the schema the header declares; findings are sorted by severity, rule, entity and slot. maxFindings caps the report (default 10,000) and sets truncated when reached.

      Parameters

      • OptionalmaxFindings: number | null

      Returns ValidationReport

    • Validate with the EXPRESS rules of the declared release, read from express, the text of that release's .exp file (#538). Throws express-mismatch for text that declares another schema or disagrees with the release's tables, and invalid-express for text that does not parse. maxFindings is as for validate.

      Parameters

      • express: string
      • OptionalmaxFindings: number | null

      Returns ValidationReport

    • The element opening id voids, or undefined.

      Parameters

      • id: bigint

      Returns bigint | undefined

    • Serialize as STEP bytes.

      Returns Uint8Array

    • Serialize as ifcXML bytes, in the layout parseIfcXml reads.

      Parameters

      • Optionalprofile: string | null

      Returns Uint8Array

    • Serialize as ifcZIP bytes: one Deflate entry holding STEP (model.ifc), or with inner "ifcxml" ifcXML (model.ifcXML) in the layout profile names, as for writeIfcXml. parse reads it back.

      Parameters

      • Optionalinner: string | null
      • Optionalprofile: string | null

      Returns Uint8Array

    • Selector query in its canonical form: spacing, quoting and aliases normalised. Throws invalid-selector.

      Parameters

      • query: string

      Returns string

    • The file name of release's PSD/QTO catalog snapshot, such as "ifc4x3-add2.bin"; the package ships it as catalog/<name>. release is a header schema token: "IFC2X3", "IFC4" or "IFC4X3" ("IFC4X3_ADD2").

      Parameters

      • release: string

      Returns string

    • Whether release's catalog is loaded in this module instance, so a write to its Pset_/Qto_ sets can be checked.

      Parameters

      • release: string

      Returns boolean

    • Convert value from the unit named from to the unit named to: an SI unit with its prefix (METRE, MILLIMETRE, MILLI METRE, SQUARE_MILLIMETRE, KILOGRAM) or a named unit of IFC4 Table 673 with exact factors (inch, foot, square foot, gallon US, pound ...). Throws type-mismatch for units of different dimensions, invalid-value for an unknown unit, unsupported for a unit with an offset (degree Fahrenheit, #110).

      Parameters

      • value: number
      • from: string
      • to: string

      Returns number

    • Write value, a length in the unit named unit, as text: decimal in displayUnit, or feet and inches with fractions (5' - 6 1/2").

      Parameters

      Returns string

    • The handle of the entity operation index of an author batch produces, usable wherever a later operation takes an id (bigint).

      Parameters

      • index: number

      Returns bigint

    • Load release's catalog from the bytes of its snapshot file, checked against the pinned SHA-256 (invalid-value otherwise). The synchronous half of IfcModel.loadCatalog, for a host that reads the file itself.

      Parameters

      • release: string
      • bytes: Uint8Array

      Returns void

    • The GlobalId named by parts (RFC 9562 version 8): the same parts give the same GlobalId in every binding and release.

      Parameters

      • parts: string[]

      Returns string

    • A new random GlobalId: an RFC 9562 version-4 UUID from the host's crypto.getRandomValues, in IFC's 22-character form. Throws unsupported on a host without it (Node 18).

      Returns string

    • Parse a STEP (.ifc) file from its bytes, or an ifcZIP archive holding STEP or ifcXML, recognized by its ZIP signature and read within a decompression budget (budget-exceeded past it).

      Parameters

      • bytes: Uint8Array

      Returns IfcModel

    • Parse an ifcXML document: the library's lossless layout without a profile, or the buildingSMART XSD layout of "IFC4" or "IFC4X3_ADD2".

      Parameters

      • bytes: Uint8Array
      • Optionalprofile: string | null

      Returns IfcModel

    • Parse a STEP file under explicit read options. With onMalformed: "skip" a damaged record is dropped and reported by diagnostics() instead of failing the read; omitted options are strict.

      Parameters

      Returns IfcModel

    • The version of the selector grammar this build parses ("1.0").

      Returns string