IfcLoader
The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 Tutorial. 📘 API.
Extends
Implements
Properties
enabled
enabled:
boolean
=true
Overrides
onDisposed
readonly
onDisposed:Event
<string
>
Implementation of
onIfcStartedLoading
readonly
onIfcStartedLoading:Event
<void
>
An event triggered when the IFC file starts loading.
onSetup
readonly
onSetup:Event
<void
>
An event triggered when the setup process is completed.
settings
settings:
IfcFragmentSettings
The settings for the IfcLoader. It includes options for excluding categories, setting WASM paths, and more.
webIfc
webIfc:
IfcAPI
The instance of the Web-IFC library used for handling IFC data.
uuid
static
readonly
uuid:"a659add7-1418-4771-a0d6-7d4d438e4624"
A unique identifier for the component. This UUID is used to register the component within the Components system.
Methods
cleanUp()
cleanUp():
void
Cleans up the IfcLoader component by resetting the Web-IFC library, clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
Returns
void
Remarks
This method is called automatically after using the .load() method, so usually you don't need to use it manually.
Example
const ifcLoader = components.get(IfcLoader);
ifcLoader.cleanUp();
dispose()
dispose():
void
Returns
void
Implementation of
isConfigurable()
isConfigurable():
this is Configurable<any, any>
Whether is component is Configurable.
Returns
this is Configurable<any, any>
Inherited from
isDisposeable()
isDisposeable():
this is Disposable
Whether is component is Disposable.
Returns
this is Disposable
Inherited from
isHideable()
isHideable():
this is Hideable
Whether is component is Hideable.
Returns
this is Hideable
Inherited from
isResizeable()
isResizeable():
this is Resizeable
Whether is component is Resizeable.
Returns
this is Resizeable
Inherited from
isUpdateable()
isUpdateable():
this is Updateable
Whether is component is Updateable.
Returns
this is Updateable
Inherited from
load()
load(
data
,coordinate
,name
):Promise
<FragmentsGroup
>
Loads an IFC file and processes it for 3D visualization.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
data | Uint8Array | undefined | The Uint8Array containing the IFC file data. |
coordinate | boolean | true | Optional boolean indicating whether to coordinate the loaded IFC data. Default is true. |
name | string | "" | - |
Returns
Promise
<FragmentsGroup
>
A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
Example
const ifcLoader = components.get(IfcLoader);
const group = await ifcLoader.load(ifcData);
readIfcFile()
readIfcFile(
data
):Promise
<number
>
Reads an IFC file and initializes the Web-IFC library.
Parameters
Parameter | Type | Description |
---|---|---|
data | Uint8Array | The Uint8Array containing the IFC file data. |
Returns
Promise
<number
>
A Promise that resolves when the IFC file is opened and initialized.
Remarks
This method sets the WASM path and initializes the Web-IFC library based on the provided settings. It also opens the IFC model using the provided data and settings.
Example
const ifcLoader = components.get(IfcLoader);
await ifcLoader.readIfcFile(ifcData);
setup()
setup(
config
?):Promise
<void
>
Sets up the IfcLoader component with the provided configuration.
Parameters
Parameter | Type | Description |
---|---|---|
config ? | Partial <IfcFragmentSettings > | Optional configuration settings for the IfcLoader. |
If not provided, the existing settings will be used. |