Skip to content

API Reference

Maarten Vroegindeweij edited this page Feb 18, 2026 · 1 revision

API Reference

Consolidated reference of all public functions, classes, and types across all Ifc-Factory packages.


@ifc-factory/core

IfcModel Class

Static Methods

Method Signature Description
fromStep (source: string) => IfcModel Parse a STEP file string into an IfcModel

Instance Methods

Method Signature Description
get (id: number) => IfcGenericEntity | undefined Get entity by expressID
create (typeName: string, attrs: object) => IfcGenericEntity Create a new entity (auto-assigns expressID)
update (id: number, changes: object) => void Update entity attributes
delete (id: number) => void Delete an entity
getAllOfType (typeName: string) => IfcGenericEntity[] Get all entities of a given type
toStep () => string Serialize model to STEP format
getSpatialTree () => SpatialTreeNode Build and return the spatial hierarchy tree
getAggregateChildren (parentId: number) => IfcGenericEntity[] Get children via IfcRelAggregates
getContainedElements (spatialId: number) => IfcGenericEntity[] Get elements in spatial structure
containInSpatialStructure (spatialId: number, elementId: number) => void Place element in spatial element

Instance Properties

Property Type Description
project IfcGenericEntity | undefined The first IfcProject entity
size number Total entity count
schema string Schema identifier (e.g., 'IFC4X3')

Spatial Functions

Function Signature Description
createSpatialStructure (model, options) => { project, site, building, storeys } Create complete spatial hierarchy
flattenSpatialTree (tree: SpatialTreeNode) => SpatialTreeNode[] Flatten tree to flat array
interface SpatialStructureOptions {
  projectName: string;
  siteName: string;
  buildingName: string;
  storeyNames: string[];
}

interface SpatialTreeNode {
  entity: IfcGenericEntity;
  children: SpatialTreeNode[];
}

Property Functions

Function Signature Description
createPropertySet (model, name: string, properties: PropertyValue[]) => IfcGenericEntity Create IfcPropertySet
createQuantitySet (model, name: string, quantities: QuantityValue[]) => IfcGenericEntity Create IfcElementQuantity
assignPropertySet (model, psetId: number, elementIds: number[]) => IfcGenericEntity Assign pset via IfcRelDefinesByProperties
getPropertySets (model, elementId: number) => IfcGenericEntity[] Get all property sets for an element
interface PropertyValue {
  name: string;
  value: string | number | boolean;
  type?: string;  // 'IFCREAL', 'IFCLABEL', etc.
}

interface QuantityValue {
  name: string;
  value: number;
  quantityType: 'LENGTH' | 'AREA' | 'VOLUME' | 'WEIGHT' | 'COUNT' | 'TIME';
}

Document Functions

Function Signature Description
createDocumentInformation (model, options) => IfcGenericEntity Create IfcDocumentInformation
createDocumentReference (model, options) => IfcGenericEntity Create IfcDocumentReference
associateDocument (model, docId: number, elementIds: number[]) => IfcGenericEntity Associate via IfcRelAssociatesDocument
interface DocumentOptions {
  name: string;
  description?: string;
  location?: string;
  identification?: string;
}

Library Functions

Function Signature Description
createLibraryInformation (model, options) => IfcGenericEntity Create IfcLibraryInformation
createLibraryReference (model, options) => IfcGenericEntity Create IfcLibraryReference
associateLibrary (model, libId: number, elementIds: number[]) => IfcGenericEntity Associate via IfcRelAssociatesLibrary
interface LibraryOptions {
  name: string;
  version?: string;
  description?: string;
}

interface LibraryReferenceOptions {
  name: string;
  identification?: string;
  libraryId: number;
}

Classification Functions

Function Signature Description
createClassification (model, options) => IfcGenericEntity Create IfcClassification
createClassificationReference (model, options) => IfcGenericEntity Create IfcClassificationReference
associateClassification (model, refId: number, elementIds: number[]) => IfcGenericEntity Associate via IfcRelAssociatesClassification
interface ClassificationOptions {
  name: string;
  edition?: string;
  source?: string;
}

interface ClassificationReferenceOptions {
  identification: string;
  name?: string;
  classificationId: number;
}

Annotation Functions

Function Signature Description
createAnnotation (model, options) => IfcGenericEntity Create IfcAnnotation
createTextLiteral (model, options) => IfcGenericEntity Create IfcTextLiteral

Relationship Functions

Function Signature Description
createRelAggregates (model, parentId: number, childIds: number[]) => IfcGenericEntity Create IfcRelAggregates
createRelAssociatesMaterial (model, materialId: number, elementIds: number[]) => IfcGenericEntity Create IfcRelAssociatesMaterial
createRelAssociatesClassification (model, refId: number, elementIds: number[]) => IfcGenericEntity Create IfcRelAssociatesClassification
createRelAssociatesDocument (model, docId: number, elementIds: number[]) => IfcGenericEntity Create IfcRelAssociatesDocument
createRelAssociatesLibrary (model, libId: number, elementIds: number[]) => IfcGenericEntity Create IfcRelAssociatesLibrary

GUID Function

Function Signature Description
generateIfcGuid () => string Generate 22-char IFC base64 GUID

Compliance Functions

Function Signature Description
createBBLPropertySet (model, elementIds: number[], data: BBLData) => void Create BBL fire safety property set
createBENGPropertySet (model, elementIds: number[], data: BENGData) => void Create BENG energy property set
createAeriusPropertySet (model, elementIds: number[], data: AeriusData) => void Create Aerius nitrogen property set

See Dutch Compliance for data types and details.

Query Classes and Functions

Export Type Description
QueryBuilder class Fluent query builder
byType function Filter by entity type
byProperty function Filter by property value
byPropertyExists function Filter by property existence
and function Combine predicates (all must match)
or function Combine predicates (any must match)
not function Invert a predicate

See Query API for full documentation.


@ifc-factory/schema

Export Type Description
SCHEMA_METADATA Record<string, EntityMetadata> Runtime metadata for all 876 entity types
ENTITY_REGISTRY Record<string, string> UPPERCASE → PascalCase name mapping
IfcGenericEntity interface Base entity type with expressID, type, [key: string]: unknown
StepEntityBase interface Base STEP entity interface
IfcWall, IfcDoor, ... interfaces 876 typed entity interfaces
IfcWallTypeEnum, ... enums 243 string enumerations

@ifc-factory/step-parser

Function Signature Description
parseStepToEntities (source: string) => ParseResult Two-pass parse: STEP string → typed entities
writeEntitiesToStep (entities: Map<number, IfcGenericEntity>, schema?: string) => string Serialize entities to STEP
interface ParseResult {
  schema: string;
  entities: Map<number, IfcGenericEntity>;
  header: StepHeader;
}

@ifc-factory/step-serializer

Function Signature Description
readStepFile (source: string) => StepFile Parse raw STEP file (schema-agnostic)
writeStepFile (stepFile: StepFile) => string Serialize StepFile to STEP string
decodeStepString (encoded: string) => string Decode STEP unicode escapes
encodeStepString (str: string) => string Encode string for STEP

@ifc-factory/express-parser

Function Signature Description
parseExpress (source: string) => SchemaNode Parse EXPRESS schema to AST
tokenize (source: string) => Token[] Tokenize EXPRESS source

@ifc-factory/ifc-utils

Function Signature Description
validateModel (model: IfcModel) => ValidationIssue[] Validate model
diffModels (a: IfcModel, b: IfcModel) => ModelDiff Compare models
detectSchemaVersion (source: string) => IfcSchemaVersion Detect schema
isIfc4x3 (source: string) => boolean Check if IFC4X3
generateIfcGuid () => string Generate GUID
generateMultipleGuids (count: number) => string[] Generate multiple GUIDs
validateGuid (guid: string) => string[] Validate GUID format
isValidIfcGuid (guid: string) => boolean Quick GUID check
batchAssignProperties (model, assignments[]) => void Batch property assignment
batchUpdateProperty (model, ids[], prop, value) => number Batch update

Clone this wiki locally