Skip to main content

FragmentsManager

Component to load, delete and manage fragments efficiently. 📕 Tutorial. 📘 API. Before calling FragmentsManager.init, you need a URL for the fragments worker. The recommended way to get it is FragmentsManager.getWorker, which fetches the version-matched worker from unpkg.

Extends​

Implements​

Properties​

enabled​

enabled: boolean = true

Component.enabled

Overrides​

Component . enabled


onDisposed​

readonly onDisposed: Event<undefined>

Disposable.onDisposed

Implementation of​

Disposable . onDisposed


onFragmentsLoaded​

readonly onFragmentsLoaded: Event<any>

Event triggered when fragments are loaded.


uuid​

static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806"

A unique identifier for the component. This UUID is used to register the component within the Components system.

Accessors​

list​

get list(): DataMap<string, FragmentsModel>

Map containing all loaded fragment models. The key is the group's unique identifier, and the value is the model itself.

Returns​

DataMap<string, FragmentsModel>

Methods​

applyBaseCoordinateSystem()​

applyBaseCoordinateSystem(object, originalCoordinateSystem?): Matrix4

Applies the base coordinate system to the provided object.

This function takes an object and its original coordinate system as input. It then inverts the original coordinate system and applies the base coordinate system to the object. This ensures that the object's position, rotation, and scale are transformed to match the base coordinate system (which is taken from the first model loaded).

Parameters​

ParameterTypeDescription
objectVector3 | Object3D<Object3DEventMap>The object to which the base coordinate system will be applied.
This should be an instance of THREE.Object3D.
originalCoordinateSystem?Matrix4The original coordinate system of the object.
This should be a THREE.Matrix4 representing the object's transformation matrix.

Returns​

Matrix4


dispose()​

dispose(): void

Disposable.dispose

Returns​

void

Implementation of​

Disposable . dispose


getData()​

getData(items, config?): Promise<Record<string, ItemData[]>>

Retrieves data for specified items from multiple models.

Parameters​

ParameterTypeDescription
itemsModelIdMapA map of model IDs to an array of local IDs, specifying which items to retrieve data for.
config?Partial<ItemsDataConfig>Optional configuration for data retrieval.

Returns​

Promise<Record<string, ItemData[]>>

A record mapping model IDs to an array of item data.


guidsToModelIdMap()​

guidsToModelIdMap(guids): Promise <ModelIdMap>

Converts a collection of IFC GUIDs to a fragmentIdMap.

Parameters​

ParameterTypeDescription
guidsIterable<string>An iterable collection of global IDs to be converted to a fragment ID map.

Returns​

Promise <ModelIdMap>

A fragment ID map, where the keys are fragment IDs and the values are the corresponding express IDs.


init()​

init(workerURL, options?): void

Initializes the fragments core with the given worker URL. The recommended way to obtain the URL is FragmentsManager.getWorker:

fragments.init(await OBC.FragmentsManager.getWorker());

Parameters​

ParameterType
workerURLstring
options?object
options.classicWorker?boolean

Returns​

void


isConfigurable()​

isConfigurable(): this is Configurable<any, any>

Whether is component is Configurable.

Returns​

this is Configurable<any, any>

Inherited from​

Component . isConfigurable


isDisposeable()​

isDisposeable(): this is Disposable

Whether is component is Disposable.

Returns​

this is Disposable

Inherited from​

Component . isDisposeable


isHideable()​

isHideable(): this is Hideable

Whether is component is Hideable.

Returns​

this is Hideable

Inherited from​

Component . isHideable


isResizeable()​

isResizeable(): this is Resizeable

Whether is component is Resizeable.

Returns​

this is Resizeable

Inherited from​

Component . isResizeable


isSerializable()​

isSerializable(): this is Serializable<any, Record<string, any>>

Whether is component is Serializable.

Returns​

this is Serializable<any, Record<string, any>>

Inherited from​

Component . isSerializable


isUpdateable()​

isUpdateable(): this is Updateable

Whether is component is Updateable.

Returns​

this is Updateable

Inherited from​

Component . isUpdateable


modelIdMapToGuids()​

modelIdMapToGuids(modelIdMap): Promise<string[]>

Converts a fragment ID map to a collection of GUIDs.

Parameters​

ParameterTypeDescription
modelIdMapModelIdMapA ModelIdMap to be converted to a collection of GUIDs.

Returns​

Promise<string[]>

An array of GUIDs.


getWorker()​

static getWorker(): Promise<string>

Returns a blob URL for the fragments worker matching the installed @thatopen/fragments version. Delegates to FRAGS.FragmentsModels.getWorker. This is the recommended way to obtain the URL passed to FragmentsManager.init.

Returns​

Promise<string>

Example​

const fragments = components.get(OBC.FragmentsManager);
fragments.init(await OBC.FragmentsManager.getWorker());