BimIfcLoader
Implements
Index
Constructors
Properties
Accessors
Methods
Constructors
publicconstructor
Creates a instance of BimIfcLoader class. Responsible for managing a collection of IFC files and loading data from them.
Parameters
_bimApi: BimCoreApiClient
_propertySetRepository: BimPropertySetRepository
vertexDataRepository: BimVertexDataRepository
_materials: Materials
Returns BimIfcLoader
Properties
publicreadonlyvertexDataRepository
Accessors
publicclasses
Gets all the IFC classes used by IFC products in the currently loaded IFC files.
Returns BimIfcClass[]
An array of BimIfcClass objects representing the available classes.
publicdisciplines
Gets the available disciplines.
Returns Discipline[]
An array of Discipline objects.
publicfloors
Gets the floors (IfcBuildingStorey) available in the currently loaded IFC files.
Returns BimIfcBuildingStorey[]
An array of BimIfcBuildingStorey objects representing the available floors (storey levels).
publicifcHttpResources
Gets the array of BimChangeIfc objects representing the IFC files that are loaded.
Returns BimChangeIfc[]
An array of BimChangeIfc objects.
publicifcProductsWithGeometryCount
Gets the count of IFC products with geometry.
Returns number
The number of IFC products with geometry.
publicloaderElements
Gets the BimIfcLoaderElement for the loaded IFC files.
Returns BimIfcLoaderElement[]
An array of BimIfcLoaderElement objects.
publicprojects
Gets the IfcProject root nodes from each loaded IFC file.
Returns BimIfcObject[]
An array of BimIfcObject representing the projects.
publicregionBoundingInfo
Get the bounding info for loaded IFC files based on the most populated regions of each IFC file, excluding outliers and anomalous regions. The bounding info is derived from the regions with the highest IFC product count in each IFC file. Regions distant from the majority are excluded. The
regionBoundingInfo
is critical for camera positioning to ensure the entireregionBoundingInfo
is within the camera’s frustum. Overly largeregionBoundingInfo
can result in the camera being too distant, causing visibility issues. This can occur if anomalies are undetectable, e.g., when 50% of regions are proximate while the remaining 50% are outliers but also proximate to each other. This is common when IFC files are modeled in different coordinate systems, leading to disparate global positions for files intended to be co-located. There have been cases where IFC files, that should been co-located, are actually located in widely different places on the globe. Whenever add is called (before clear) this property is updated.Returns BoundingInfo
publicspaces
Gets the spaces (IfcSpace) available in the currently loaded IFC files..
Returns BimIfcSpace[]
An array of BimIfcSpace objects.
Methods
publicaabb
Calculates the
min
andmax
coordinate of the axis-aligned bounding box (AABB) encompassing a collection of BimIfcObject‘s. The AABB is defined by the minimum and maximum coordinates in each axis. The result is written to the providedmin
andmax
vectors.Parameters
min: Vector3
The minimum coordinates of the AABB will be stored in this vector.
max: Vector3
The maximum coordinates of the AABB will be stored in this vector.
ifcProducts: BimIfcObject[]
The collection of BimIfcObject to calculate the AABB for.
predicate: (o: BimIfcObject, recursionOptions: BimIfcObjectRecursionOptions) => unknown = DefaultBimIfcObjectForEachPredicate
The predicate function to filter the BimIfcObject. Defaults to DefaultBimIfcObjectForEachPredicate.
Returns void
publicadd
Adds the specified IFC files to the loader.
Parameters
ifcFiles: IfcWithOptions[]
An array of IfcWithOptions objects representing the IFC files to be added.
Returns Promise<(BimIfcLoaderElement | BimIfcLoaderElementCreateFailure)[]>
A promise that resolves to an array of BimIfcLoaderElement or BimIfcLoaderElementCreateFailure instances. Use isFailure to check if a returned instance is a failure or not. Its not required to check for failures but it can be useful to know why a file failed to load.
publicaddOrGetIfcProductCache
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: BimIfcObject<T> = 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 DeepImmutableObject<Set<T>>
The cached set of BimIfcObject instances.
- T: BimIfcObject<T> = BimIfcObject
publicapplyAndResetTrackedVisualChanges
Returns undefined | ReadonlySet<BimIfcObject>
publicapplyColor
Returns void
publicclear
Clears the state of the BimIfcLoader instance. If geometryBuilder has been called, and if it has been used to create Geometry3d instances that have been added to TwinfinityViewer then those instances are NOT removed from the viewer. Call Twinfinity.clear to remove all geometry from the viewer as well.
Returns void
publicdeleteIfcProductCache
Deletes a cache created by addOrGetIfcProductCache-
Parameters
key: string
Cache to delete
Returns boolean
true
if a cache was deleted, otherwisefalse
.
publicforeach
Iterate all IFC objects with a callback. Its also possible to call products to get an iterator.
Parameters
action: BimIfcObjectForEachAction
Visitor callback. Called for every IFC object.
Returns void
publicgeometryBuilder
Creates an IfcGeometryBuilder containing the BimIfcObject instances matched by the provided predicate. If no predicate is provided, all objects will be included.
Parameters
optionaloptions: (ifcProduct: BimIfcObject) => unknown | GeometryBuilderOptions
Optional predicate function to filter the objects.
Returns Promise<IfcGeometryBuilder>
A promise that resolves to an instance of IfcGeometryBuilder.
publicgetRegionBoundingInfo
Calculate the bounding info for the currently loaded IFC files based on the most populated regions of each IFC file, excluding outliers and anomalous regions.
Parameters
onlyMostPopulatedRegions: boolean
Indicates whether to include only the most populated regions.
useWorldSpace: boolean = true
Indicates whether to use world space coordinates. Default is
true
Returns BoundingInfo
The bounding information for the regions.
publicloadPropertySets
Loads the property sets for currently loaded IFC files add. If property sets are already loaded then this method does nothing.
Returns Promise<void>
A promise that resolves when all property sets have been loaded.
publicproducts
Gets a iterator for all Ifc products currently loaded.
Returns IterableIterator<BimIfcObject>
Represents a BIM IFC Loader. Responsible for managing a collection of IFC files and loading data from them.