# Class BimIfcLoaderElement

Represents an IFC file and provides access to its data.

#### Implements

- IBimIfcLoaderElement

##### Index

### Properties

classes
discipline
floors
ifcHttpResource
ifcName
index
loader
loadOptions?
materials
meshCount
products
project
spaces
styles
transform?
transformsRepository
typeObjectRepository

### Accessors

geometricFeaturesRepository
geometricFeaturesUrl
geometryFormat
geometryUrl
hasBatchSupport
ifc
ifcProductsWithGeometryCount
ifcUrl
indexUrl
numberOfIndices
numberOfTriangles
numberOfVertices
propertiesUrl
wasmMemoryUsage

### Methods

ensureVertexDataLoaded
getVertexData
loadPropertySets
tryCreateOrExtendAABBFromRegions
writeBatch
writeVertexData
create

## Properties

### `Readonly` classes

classes: ModelProductClass[] = []

All BimIfcClass instances referenced by BimProduct's in the IFC file this instance represents.

Implementation of IBimIfcLoaderElement.classes

### `Readonly` discipline

discipline: Discipline

The discipline of the IFC file this instance represents.

Implementation of IBimIfcLoaderElement.discipline

### `Readonly` floors

floors: BimIfcBuildingStorey[] = []

All IfcBuildingStorey (BimIfcBuildingStorey) instances in the IFC file this instance represents.

Implementation of IBimIfcLoaderElement.floors

### `Readonly` ifcHttpResource

ifcHttpResource: BimChangeIfc

### `Readonly` ifcName

ifcName: string

The name of the IFC file this instance represents.

Implementation of IBimIfcLoaderElement.ifcName

### `Readonly` index

index: BimIfcIndex

The IFC index (.idx file) of the IFC file this instance represents. This describes (in a very raw format) the content of the IFC file. It does not include any geometry or property sets.

Implementation of IBimIfcLoaderElement.index

### `Readonly` loader

loader: BimIfcLoaderElementParent

The loader this instance belongs to.

Implementation of IBimIfcLoaderElement.loader

### `Optional` `Readonly` loadOptions

loadOptions?: BimApiIfcObjectsLoadOptions

The BimApiIfcObjectsLoadOptions options (if any) that was used when this instance was created.

Implementation of IBimIfcLoaderElement.loadOptions

### `Readonly` materials

materials: Materials

Reference to a Materials instance.

Implementation of IBimIfcLoaderElement.materials

### `Readonly` meshCount

meshCount: number

The total number of BimProductMesh instances in the IFC file this instance represents. Same as ifcProductsWithGeometryCount.

Implementation of IBimIfcLoaderElement.meshCount

### `Readonly` products

products: BimIfcObject[] = []

All IFC products in the IFC file this instance represents. Here represented as a flat list.

Implementation of IBimIfcLoaderElement.products

### `Readonly` project

project: BimIfcObject

The IfcProject instance of the IFC file this instance represents.

Implementation of IBimIfcLoaderElement.project

### `Readonly` spaces

spaces: BimIfcSpace[] = []

All IfcSpace (BimIfcSpace) instances in the IFC file this instance represents.

Implementation of IBimIfcLoaderElement.spaces

### `Readonly` styles

styles: BimIfcStyle[] = []

All IFC styles that the BimProductMesh instances in the IFC file refers to. The styles are used to color the meshes.

Implementation of IBimIfcLoaderElement.styles

### `Optional` `Readonly` transform

transform?: Matrix

An optional transform for the IFC file. This transform will be applied to all IFC product geometries

Implementation of IBimIfcLoaderElement.transform

### `Readonly` transformsRepository

transformsRepository: BimTransformsRepository

Reference to the transform repository this instance uses when transforming IFC product geometries.

Implementation of IBimIfcLoaderElement.transformsRepository

### `Readonly` typeObjectRepository

typeObjectRepository: BimTypeObjectRepository

Reference to the type object repository this instance uses for type properties.

Implementation of IBimIfcLoaderElement.typeObjectRepository

## Accessors

### geometricFeaturesRepository

- get geometricFeaturesRepository(): BimGeometricFeaturesRepository

  #### Returns BimGeometricFeaturesRepository

  #### Inherit Doc

  Implementation of IBimIfcLoaderElement.geometricFeaturesRepository

### geometricFeaturesUrl

- get geometricFeaturesUrl(): undefined | URL

  Url where the IFC geometric features file (.geom-feature file) will be retrieved from.

  #### Returns undefined | URL

  Implementation of IBimIfcLoaderElement.geometricFeaturesUrl

### geometryFormat

- get geometryFormat(): GeometryFormat

  The format that the geometry is stored in.

  #### Returns GeometryFormat

  Implementation of IBimIfcLoaderElement.geometryFormat

### geometryUrl

- get geometryUrl(): undefined | URL

  Url where the IFC geometry (.geom file) will be retrieved from.

  #### Returns undefined | URL

  Implementation of IBimIfcLoaderElement.geometryUrl

### hasBatchSupport

- get hasBatchSupport(): boolean

  Whether batch vertex data writing is supported via WASM.

  #### Returns boolean

  Implementation of IBimIfcLoaderElement.hasBatchSupport

### ifc

- get ifc(): BimChangeIfc

  The IFC change (file) this instance represents.

  #### Returns BimChangeIfc

  Implementation of IBimIfcLoaderElement.ifc

### ifcProductsWithGeometryCount

- get ifcProductsWithGeometryCount(): number

  The total number of BimProductMesh instances in the IFC file this instance represents. Same as meshCount.

  #### Returns number

  Implementation of IBimIfcLoaderElement.ifcProductsWithGeometryCount

### ifcUrl

- get ifcUrl(): URL

  The url where the contents of the IFC file can be retrieved from.

  #### Returns URL

  Implementation of IBimIfcLoaderElement.ifcUrl

### indexUrl

- get indexUrl(): undefined | URL

  Url where the IFC index (.idx file) will be retrieved from.

  #### Returns undefined | URL

  Implementation of IBimIfcLoaderElement.indexUrl

### numberOfIndices

- get numberOfIndices(): number

  The total number of indices contained in all instances of BimProductMesh in this IFC file.

  #### Returns number

  Implementation of IBimIfcLoaderElement.numberOfIndices

### numberOfTriangles

- get numberOfTriangles(): number

  The total number of triangles contained in all instances of BimProductMesh in this IFC file.

  #### Returns number

  Implementation of IBimIfcLoaderElement.numberOfTriangles

### numberOfVertices

- get numberOfVertices(): number

  The total number of vertices contained in all instances of BimProductMesh in this IFC file.

  #### Returns number

  Implementation of IBimIfcLoaderElement.numberOfVertices

### propertiesUrl

- get propertiesUrl(): undefined | URL

  Url where the IFC property set (.prop file) will be retrieved from.

  #### Returns undefined | URL

  Implementation of IBimIfcLoaderElement.propertiesUrl

### wasmMemoryUsage

- get wasmMemoryUsage(): {
  allocated: number;
  capacity: number;
  outputBuffers: number;
  used: number;
  }

  WASM memory usage in bytes.

  #### Returns { allocated: number; capacity: number; outputBuffers: number; used: number }

  Implementation of IBimIfcLoaderElement.wasmMemoryUsage

## Methods

### ensureVertexDataLoaded

- ensureVertexDataLoaded(): Promise<boolean>

  Ensures that the vertex data is loaded.

  #### Returns Promise<boolean>

  A promise that resolves to a boolean. See it as a signal. I will be true if the call actualy loaded the data. Otherwhise it will be false (data loading is either in progress or has completed).

  Implementation of IBimIfcLoaderElement.ensureVertexDataLoaded

### getVertexData

- getVertexData(productMeshDescriptor: BimProductMeshDescriptor): BimVertexData

  Gets the vertex data for a given product mesh descriptor.

  #### Parameters

  - productMeshDescriptor: BimProductMeshDescriptor

    The product mesh descriptor.

  #### Returns BimVertexData

  The vertex data.

  Implementation of IBimIfcLoaderElement.getVertexData

### loadPropertySets

- loadPropertySets(clearCache?: boolean): Promise<boolean>

  Loads the property sets and assigns them to the IFC products contained within this instance.

  #### Parameters

  - clearCache: boolean = false

  #### Returns Promise<boolean>

  A promise that resolves to a boolean indicating whether the property set was loaded

  Implementation of IBimIfcLoaderElement.loadPropertySets

### tryCreateOrExtendAABBFromRegions

- tryCreateOrExtendAABBFromRegions(
  min: Vector3,
  max: Vector3,
  o?: { onlyMostPopulatedRegions?: boolean },
  ): boolean

  Calculates, or extends a existing, axis-aligned bounding box (AABB) of the regions in the IFC file this instance represents. The provided min, and max values will be updated to contain the min and max values of the AABB.

  #### Parameters

  - min: Vector3

    Will be set to min vector of the AABB after call. If not part of existing AABB it must be set to (Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE)

  - max: Vector3

    Will be set to max vector of the AABB after call. If not part of existing AABB it must be set to (Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE)

  - `Optional` o: { onlyMostPopulatedRegions?: boolean }

    Optional. Options object. If `onlyMostPopulatedRegions` is set to `true` then only the most populated regions will be considered.

  #### Returns boolean

  `true` if a valid AABB was calculated. Otherwise `false`. If `false` is returned then the min and max values will not be updated.

  #### Example

      // Example of how to calculate a AABB that encompasses the most populated regions of two IFC files.
      const min = setMax(Vector3.Zero());
      const max = setMin(Vector3.Zero());
      // min and max will now contain the min and max values of the AABB encompassing the mostly populated region in loaderElementA.
      loaderElementA.tryCreateOrExtendAABBFromRegions(min, max, { onlyMostPopulatedRegions: true});
      // min and max will now contain the min and max values of the AABB that encompasses both loaderElementA and loaderElementB.
      loaderElementB.tryCreateOrExtendAABBFromRegions(min, max, { onlyMostPopulatedRegions: true});

  Implementation of IBimIfcLoaderElement.tryCreateOrExtendAABBFromRegions

### writeBatch

- writeBatch(
  meshes: BimProductMesh[],
  destination: GeometryArrays,
  offset: GeometryArrayOffset,
  ): undefined | WriteBatchResult

  Writes vertex data for multiple meshes in a single batch operation using WASM. Falls back to undefined if batch support is not available.

  #### Parameters

  - meshes: BimProductMesh[]

    The meshes to write.

  - destination: GeometryArrays

    The destination geometry arrays.

  - offset: GeometryArrayOffset

    The offset in the geometry arrays.

  #### Returns undefined | WriteBatchResult

  The batch result containing AABB and counts, or undefined if batch is not available.

  Implementation of IBimIfcLoaderElement.writeBatch

### writeVertexData

- writeVertexData(
  ifcProductMesh: BimProductMesh,
  transform: FastTransform,
  destination: GeometryArrays,
  offset: GeometryArrayOffset,
  aabb: { max: Vector3; min: Vector3 },
  options: { includeNormals?: boolean },
  ): { indexCount: number; vertexCount: number }

  Writes the vertex data to the specified destination.

  #### Parameters

  - ifcProductMesh: BimProductMesh

    The IFC product mesh.

  - transform: FastTransform

    The transformation matrix.

  - destination: GeometryArrays

    The destination geometry arrays.

  - offset: GeometryArrayOffset

    The offset in the geometry arrays.

  - aabb: { max: Vector3; min: Vector3 }

    The axis-aligned bounding box.

  - options: { includeNormals?: boolean }

  #### Returns { indexCount: number; vertexCount: number }

  The actual vertex and index counts written.

  Implementation of IBimIfcLoaderElement.writeVertexData

### `Static` create

- create(
  bimApi: BimCoreApiClient,
  materials: Materials,
  vertexDataRepository: BimVertexDataRepository,
  propertySetRepository: BimPropertySetRepository,
  geometricFeaturesRepository: BimGeometricFeaturesRepository,
  parent: BimIfcLoaderElementParent,
  ifcHttpResource: BimChangeIfc,
  options?: BimApiIfcObjectsLoadOptions,
  transform?: Matrix,
  ): Promise<
  | IBimIfcLoaderElement
  | T8BimIfcLoaderElementCreateFailure
  | BimIfcLoaderElementCreateFailure,
  >

  Creates a new instance of the BimIfcLoaderElement class.

  #### Parameters

  - bimApi: BimCoreApiClient

    The BimCoreApiClient instance.

  - materials: Materials

    The Materials instance.

  - vertexDataRepository: BimVertexDataRepository

    The BimVertexDataRepository instance.

  - propertySetRepository: BimPropertySetRepository

    The BimPropertySetRepository instance.

  - geometricFeaturesRepository: BimGeometricFeaturesRepository

    The BimGeometricFeaturesRepository instance.

  - parent: BimIfcLoaderElementParent

    The BimIfcLoaderElementParent instance.

  - ifcHttpResource: BimChangeIfc

    The BimChangeIfc instance.

  - `Optional` options: BimApiIfcObjectsLoadOptions

    Optional. The BimApiIfcObjectsLoadOptions instance.

  - `Optional` transform: Matrix

    Optional. The `Matrix` instance that will be applied to all transformations in the IFC.

  #### Returns Promise<
  | IBimIfcLoaderElement
  | T8BimIfcLoaderElementCreateFailure
  | BimIfcLoaderElementCreateFailure,
  >

  A Promise that resolves to a BimIfcLoaderElement instance or a BimIfcLoaderElementCreateFailure instance.