# Interface BimIfcLoaderElementParent

Represents a BIM IFC Loader. Responsible for managing a collection of IFC files and loading data from them.

interface BimIfcLoaderElementParent {
classes: ModelProductClass[];
disciplines: Discipline[];
floors: BimIfcBuildingStorey[];
loaderElements: IBimIfcLoaderElement[];
projects: BimIfcObject[];
spaces: BimIfcSpace[];
addOrGetIfcProductCache<T extends BimIfcObject = BimIfcObject>(
key: string,
predicate: BimIfcObjectForEachPredicate,
): DeepImmutable<Set<T>>;
clear(): void;
deleteIfcProductCache(key: string): boolean;
geometryBuilder(
options?:
| GeometryBuilderOptions
| ((ifcProduct: BimIfcObject) => unknown),
): Promise<IfcGeometryBuilder>;
}

#### Implemented by

- BimIfcLoader

##### Index

### Properties

classes
disciplines
floors
loaderElements
projects
spaces

### Methods

addOrGetIfcProductCache
clear
deleteIfcProductCache
geometryBuilder

## Properties

### `Readonly` classes

classes: ModelProductClass[]

Gets all the IFC classes used by IFC products in the currently loaded IFC files.

#### Returns

An array of BimIfcClass objects representing the available classes.

### `Readonly` disciplines

disciplines: Discipline[]

Gets the available disciplines.

#### Returns

An array of Discipline objects.

### `Readonly` floors

floors: BimIfcBuildingStorey[]

Gets the floors (IfcBuildingStorey) available in the currently loaded IFC files.

#### Returns

An array of BimIfcBuildingStorey objects representing the available floors (storey levels).

### `Readonly` loaderElements

loaderElements: IBimIfcLoaderElement[]

Gets the IBimIfcLoaderElement for the loaded IFC files.

#### Returns

An array of IBimIfcLoaderElement objects.

### `Readonly` projects

projects: BimIfcObject[]

Gets the IfcProject root nodes from each loaded IFC file.

#### Remarks

These can then be used to traverse the IFC file structure by calling BimIfcObject.foreach, or BimIfcObject.entries on each project.

#### Returns

An array of BimIfcObject representing the projects.

### `Readonly` spaces

spaces: BimIfcSpace[]

Gets the spaces (IfcSpace) available in the currently loaded IFC files.

#### Returns

An array of BimIfcSpace objects.

## Methods

### addOrGetIfcProductCache

- addOrGetIfcProductCache<T extends BimIfcObject = BimIfcObject>(
  key: string,
  predicate: BimIfcObjectForEachPredicate,
  ): DeepImmutable<Set<T>>

  Adds or retrieves the cached set of BimIfcObject instances based on the provided key and predicate. Cache is cleared when clear is called.

  #### Type Parameters

  - T extends BimIfcObject = BimIfcObject

    The type of BimIfcObject to be stored in the cache.

  #### Parameters

  - key: string

    The key used to identify the cache entry.

  - predicate: BimIfcObjectForEachPredicate

    The predicate function used to filter BimIfcObject instances. If it returns `truthy` then object is added to cache. Otherwise not

  #### Returns DeepImmutable<Set<T>>

  The cached set of BimIfcObject instances.

### clear

- clear(): void

  Clears the state of the BimIfcLoader instance. If geometryBuilder has been called, and if it has been use to create Geometry3d instances that have been added to TwinfinityViewer then those instances are NOT removed from the viewer. Call BimCoreApi.clear to remove all geometry from the viewer as well.

  #### Returns void

### deleteIfcProductCache

- deleteIfcProductCache(key: string): boolean

  Deletes a cache created by addOrGetIfcProductCache-

  #### Parameters

  - key: string

    Cache to delete

  #### Returns boolean

  `true` if a cache was deleted, otherwise `false`.

### geometryBuilder

- geometryBuilder(
  options?:
  | GeometryBuilderOptions
  | ((ifcProduct: BimIfcObject) => unknown),
  ): Promise<IfcGeometryBuilder>

  Creates an IfcGeometryBuilder containing the BimIfcObject instances matched by the provided predicate. If no predicate is provided, all objects will be included.

  #### Parameters

  - `Optional` options: GeometryBuilderOptions | ((ifcProduct: BimIfcObject) => unknown)

    Optional predicate function to filter the objects.

  #### Returns Promise<IfcGeometryBuilder>

  A promise that resolves to an instance of IfcGeometryBuilder.

  #### Remarks

  The IfcGeometryBuilder can be used to create Geometry3d instances for the matched objects. In order to visualize them use TwinfinityViewer.addOrReplaceMesh.