Skip to main content

FragmentsModel

The main class for managing a 3D model loaded from a fragments file. Handles geometry, materials, visibility, highlighting, sections, and more. This class orchestrates multiple specialized managers to handle different aspects of the model like mesh management, item data, raycasting, etc. It maintains the overall state and provides the main interface for interacting with the model. The model data is loaded and processed asynchronously across multiple threads.

Implements​

  • IFragmentsModel<true>

Constructors​

new FragmentsModel()​

new FragmentsModel(modelId, meshManager, threads, editor, threadGroup?): FragmentsModel

The constructor of the fragments model. Don't use this directly. Use the FragmentsModels.load instead.

Parameters​

ParameterType
modelIdstring
meshManagerMeshManager
threadsFragmentsConnection
editorEditor
threadGroup?string

Returns​

FragmentsModel

Properties​

attrsChanges​

readonly attrsChanges: Map<number, AttrsChange>

A map of attribute changes that have occurred in the model. The key is the local ID of the item, and the value is the change.


graphicsQuality​

graphicsQuality: number = 0

The graphics quality of the model. It ranges from 0 (lowest) to 1 (highest).


object​

object: Object3D<Object3DEventMap>

The object that represents the model in the Three.js scene.


onViewUpdated​

readonly onViewUpdated: Event <FragmentsModel>

Event triggered after a view update cycle finishes processing. Listeners receive this FragmentsModel instance, allowing queries like getItemsByVisibility to retrieve seen/unseen elements.


relsChanges​

readonly relsChanges: Map<number, RelsModifyChange>

A map of relation changes that have occurred in the model. The key is the local ID of the item, and the value is the change.


threadGroup​

readonly threadGroup: undefined | string

The thread group this model was loaded into, or undefined if it was loaded into the default pool. Set once at load time, never changes.


threads​

readonly threads: FragmentsConnection

The connection to the threads that handle the model data.


tiles​

readonly tiles: DataMap<string | number, BIMMesh>

A map of tiles that have been loaded for the model. The key is the tile ID, and the value is the tile.


visibleItems​

readonly visibleItems: Set<number>

A set of item IDs that are currently visible (i.e. have at least one tile rendered on screen). Updated automatically as tiles are created and deleted by the mesh manager.

Accessors​

box​

get box(): Box3

The bounding box of the whole model.

Returns​

Box3


clippingPlanes​

get clippingPlanes(): Plane[]

The clipping planes the model culls against, in world space. This is the array passed to useClippingPlanes (or the clippingPlanes load option) itself, not a copy.

Returns​

Plane[]


frozen​

get frozen(): boolean

Whether the model should stop updating..

set frozen(value): void

Whether the model should stop updating..

Parameters​

ParameterType
valueboolean

Returns​

boolean


getClippingPlanesEvent​

get getClippingPlanesEvent(): () => Plane[]

The event that is triggered when the clipping planes are needed in the thread. Set this method to pass your Three.js clipping planes to the model.

Deprecated​

Pass the planes with the clippingPlanes option of FragmentsModels.load, or call useClippingPlanes after loading. This callback keeps working; whichever of the two was set last is the one the model uses.

set getClippingPlanesEvent(value): void

The event that is triggered when the clipping planes are needed in the thread. Set this method to pass your Three.js clipping planes to the model.

Deprecated​

Pass the planes with the clippingPlanes option of FragmentsModels.load, or call useClippingPlanes after loading. This callback keeps working; whichever of the two was set last is the one the model uses.

Parameters​

ParameterType
value() => Plane[]

Returns​

Function

Returns​

Plane[]


isBusy​

get isBusy(): boolean

Whether the model is busy loading data.

Returns​

boolean


modelId​

get modelId(): string

The ID of the model.

Returns​

string

Methods​

_edit()​

_edit(requests): Promise<object>

Internal method to edit the model. Don't use this directly.

Parameters​

ParameterTypeDescription
requestsEditRequest[]The requests to edit the model.

Returns​

Promise<object>

deltaModelBuffer​

deltaModelBuffer: Uint8Array

ids​

ids: number[]


_finishProcessing()​

_finishProcessing(): void

Internal method to finish processing. Don't use this directly.

Returns​

void


_getItemSnapData()​

_getItemSnapData(itemId): Promise<null | ElementData>

Fast snap-only fetch keyed by itemId. See EditManager.getItemSnapData. Internal — picker / SnapResolver consume this. App code should keep using _getElements (localId).

Parameters​

ParameterType
itemIdnumber

Returns​

Promise<null | ElementData>


_getRequests()​

_getRequests(): Promise<object>

Internal method to get the requests of the model. Don't use this directly.

Returns​

Promise<object>

requests​

requests: EditRequest[]

undoneRequests​

undoneRequests: EditRequest[]


_refreshView()​

_refreshView(force): Promise<void>

Internal method to refresh the view of the model. You shouldn't call this directly. Instead, use FragmentsModels.update.

Parameters​

ParameterTypeDefault value
forcebooleanfalse

Returns​

Promise<void>


_reset()​

_reset(): Promise<void>

Internal method to reset the model. Don't use this directly.

Returns​

Promise<void>


_save()​

_save(): Promise<Uint8Array>

Internal method to save the model. Don't use this directly.

Returns​

Promise<Uint8Array>


_selectRequest()​

_selectRequest(index): Promise<void>

Internal method to select a request of the model. Don't use this directly.

Parameters​

ParameterTypeDescription
indexnumberThe index of the request to select.

Returns​

Promise<void>


_setRequests()​

_setRequests(data): Promise<void>

Internal method to set the requests of the model. Don't use this directly.

Parameters​

ParameterTypeDescription
dataobjectThe data to set the requests of the model.
data.requests?EditRequest[]-
data.undoneRequests?EditRequest[]-

Returns​

Promise<void>


_setup()​

_setup(data, raw?, config?): Promise<void>

Internal method to set up the model. Don't use this directly.

Parameters​

ParameterType
dataUint8Array | ArrayBuffer
raw?boolean
config?VirtualModelConfig

Returns​

Promise<void>


dispose()​

dispose(options?): Promise<void>

Dispose the model. Use this when you're done with the model. If you use the FragmentsModels.dispose method, this will be called automatically for all models.

Parameters​

ParameterTypeDescription
options?object-
options.keepInScene?boolean

If true, frees the model's worker slot,

registry entries and shared MaterialManager slot but leaves the THREE

object, tiles, materials in list, alignments and grids in place.

Caller must finalize the visual cleanup later via

finalizeDispose. Used by editor.save() to swap in a freshly

loaded model without a blank frame.

Returns​

Promise<void>

Implementation of​

IFragmentsModel.dispose


finalizeDispose()​

finalizeDispose(): void

Finalize a deferred dispose. Removes the THREE object from its parent, tears down tile meshes (geometry only — materials are shared via the MaterialManager and may be reused by a replacement model under the same modelId), and disposes the model's alignments and grids.

Only call this after dispose({ keepInScene: true }). The tile map is cleared with events disabled to bypass the onBeforeDelete listener registered in the constructor (which would otherwise dispose tile materials).

Returns​

void


getAlignmentStyles()​

getAlignmentStyles(): Promise<object>

Get the civil alignment styles of the model (if any).

Returns​

Promise<object>

exterior​

exterior: PointsMaterial

interior​

interior: PointsMaterial


getAlignments()​

getAlignments(): Promise<Group<Object3DEventMap>>

Get the absolute alignments of the model (if any).

Returns​

Promise<Group<Object3DEventMap>>


getAttributeNames()​

getAttributeNames(): Promise<string[]>

Retrieves the names of all attributes associated with the model.

Returns​

Promise<string[]>

A promise that resolves to an array of strings, where each string is the name of an attribute.


getAttributeTypes()​

getAttributeTypes(): Promise<string[]>

Retrieves the attribute types associated with the model.

Returns​

Promise<string[]>

A promise that resolves to an array of attribute types.


getAttributeValues()​

getAttributeValues(): Promise<any[]>

Retrieves the attribute values associated with the model.

Returns​

Promise<any[]>

A promise that resolves to an array of attribute values.


getBoxes()​

getBoxes(localIds?): Promise<Box3[]>

Get the individual bounding boxes of the specified items.

Parameters​

ParameterTypeDescription
localIds?number[]The local IDs of the items to look up.

Returns​

Promise<Box3[]>


getBuffer()​

getBuffer(raw): Promise<ArrayBuffer>

Get the buffer of the model.

Parameters​

ParameterTypeDefault valueDescription
rawbooleanfalseWhether to get the raw buffer. If false, it will be compressed.

Returns​

Promise<ArrayBuffer>

Implementation of​

IFragmentsModel.getBuffer


getCRS()​

getCRS(): Promise<null | CRSData>

Get the Coordinate Reference System (CRS) data of the model, if available. Returns null if the source IFC file did not contain IFCPROJECTEDCRS or IFCCOORDINATEREFERENCESYSTEM entities.

Returns​

Promise<null | CRSData>

Implementation of​

IFragmentsModel.getCRS


getCategories()​

getCategories(): Promise<string[]>

Get all the categories of the model.

Returns​

Promise<string[]>

Implementation of​

IFragmentsModel.getCategories


getCoordinates()​

getCoordinates(): Promise<number[]>

Gets coordinates of the model.

Returns​

Promise<number[]>

Implementation of​

IFragmentsModel.getCoordinates


getCoordinationMatrix()​

getCoordinationMatrix(): Promise<Matrix4>

Retrieves the coordination matrix for the current model.

This method utilizes the _coordinatesManager to compute and return a THREE.Matrix4 object based on the original model coordinates.

Returns​

Promise<Matrix4>


getEditedElements()​

getEditedElements(): Promise<number[]>

Gets the edited elements of the model.

Returns​

Promise<number[]>


getGlobalTranformsIdsOfItems()​

getGlobalTranformsIdsOfItems(ids): Promise<number[]>

Gets the global transforms IDs of the items of the model.

Parameters​

ParameterTypeDescription
idsnumber[]The local IDs of the items to get the global transforms IDs of.

Returns​

Promise<number[]>

Implementation of​

IFragmentsModel.getGlobalTranformsIdsOfItems


getGlobalTransforms()​

getGlobalTransforms(localIds?): Promise<Map<number, RawGlobalTransformData>>

Gets the global transforms of the model.

Parameters​

ParameterTypeDescription
localIds?Iterable<number>The local IDs of the global transforms to get. If undefined, it will return all global transforms.

Returns​

Promise<Map<number, RawGlobalTransformData>>

Implementation of​

IFragmentsModel.getGlobalTransforms


getGlobalTransformsIds()​

getGlobalTransformsIds(): Promise<number[]>

Gets all the global transforms IDs of the model.

Returns​

Promise<number[]>

Implementation of​

IFragmentsModel.getGlobalTransformsIds


getGridLabelMaterial()​

getGridLabelMaterial(): Material

The shared material used to render every grid axis label. Mutating its properties (color, opacity, dash sizes, etc.) updates all rendered grid labels immediately. Use setGridLabelMaterial to swap to a different material instance.

Returns​

Material


getGridMaterial()​

getGridMaterial(): LineBasicMaterial

The shared material used to render every grid axis line. Mutating its properties (color, opacity, dash sizes, etc.) updates all rendered grid lines immediately. Use setGridMaterial to swap to a different material instance.

Returns​

LineBasicMaterial


getGrids()​

getGrids(config?): Promise<Group<Object3DEventMap>>

Get the grids of the model (if any).

Returns a THREE.Group with one child per grid (each child is a THREE.Group that carries userData.id = localId and userData.kind = "grid").

Each grid's children are THREE.Group instances with userData.kind = "axis", acting as an axis container. A THREE.LINE instance with userData.kind = "line" is appended to it.

When opting in to showing labels, two THREE.SHAPE instances with userData.kind = "label" and userData.index (the label's index, 0 or 1) are appended to the axis container.

All grid's descendants ("axis", "line", "label") carry userData.tag (the axis label value) and userData.axis ("uAxes", "vAxes", or "wAxes").

Parameters​

ParameterType
config?GridsConfig

Returns​

Promise<Group<Object3DEventMap>>


getGuidsByLocalIds()​

getGuidsByLocalIds(localIds): Promise<(null | string)[]>

Get the GUIDs corresponding to the specified local IDs.

Parameters​

ParameterTypeDescription
localIdsnumber[]Array of local IDs to look up.

Returns​

Promise<(null | string)[]>

Implementation of​

IFragmentsModel.getGuidsByLocalIds


getHighlight()​

getHighlight(localIds?): Promise <MaterialDefinition[]>

Gets the highlight of the specified items.

Parameters​

ParameterTypeDescription
localIds?number[]The local IDs of the items to get the highlight of. If undefined, it will return the highlight of all items.

Returns​

Promise <MaterialDefinition[]>


getHighlightItemIds()​

getHighlightItemIds(): Promise<number[]>

Gets the item IDs of the items that are highlighted.

Returns​

Promise<number[]>


getHorizontalAlignments()​

getHorizontalAlignments(): Promise<Group<Object3DEventMap>>

Get the horizontal alignments of the model (if any).

Returns​

Promise<Group<Object3DEventMap>>


getIndexEntry()​

getIndexEntry<K, V>(name, key): Promise<null | V>

Forward lookup of a single entry in the named index. The return shape depends on the index mode (see IndexEntry).

Type parameters​

Type parameter
K extends string | number
V extends IndexEntry

Parameters​

ParameterType
namestring
keyK

Returns​

Promise<null | V>

Implementation of​

IFragmentsModel.getIndexEntry


getIndexInfo()​

getIndexInfo(name): Promise<null | IndexInfo>

Describe the shape of a named index without performing any lookups. Returns null if no index with that name exists.

Parameters​

ParameterType
namestring

Returns​

Promise<null | IndexInfo>

Implementation of​

IFragmentsModel.getIndexInfo


getIndexKey()​

getIndexKey<K>(name, index): Promise<null | K>

Get key at given index. Useful for keys-only indexes but valid for any mode.

Type parameters​

Type parameter
K extends string | number

Parameters​

ParameterType
namestring
indexnumber

Returns​

Promise<null | K>

Implementation of​

IFragmentsModel.getIndexKey


getIndexKeys()​

getIndexKeys<K>(name): Promise<null | IndexArrayType<K>>

Get the keys of an index. Useful for keys-only indexes (membership tests, iteration) but valid for any mode. Number keys come back as a Uint32Array, string keys as string[].

Type parameters​

Type parameter
K extends string | number

Parameters​

ParameterType
namestring

Returns​

Promise<null | IndexArrayType<K>>

Implementation of​

IFragmentsModel.getIndexKeys


getIndexNames()​

getIndexNames(): Promise<string[]>

Get the names of every user-defined index stored on this model. See the ModelIndex schema for the supported shapes.

Returns​

Promise<string[]>

Implementation of​

IFragmentsModel.getIndexNames


getIndexValues()​

getIndexValues<V>(name): Promise<null | V[]>

Get the values of an index. Useful for inverse lookups.

Type parameters​

Type parameter
V extends string | number

Parameters​

ParameterType
namestring

Returns​

Promise<null | V[]>

Implementation of​

IFragmentsModel.getIndexValues


getInverseIndexEntry()​

getInverseIndexEntry<K, V>(name, value): Promise<null | IndexArrayType<V>>

Inverse lookup. For an index with forward direction key -> value, returns every key that maps to value. The inverse map is built lazily on first call and cached for the model's lifetime.

Type parameters​

Type parameter
K extends string | number
V extends string | number

Parameters​

ParameterType
namestring
valueK

Returns​

Promise<null | IndexArrayType<V>>

Implementation of​

IFragmentsModel.getInverseIndexEntry


getItem()​

getItem(id): Item

Get an item by its ID.

Parameters​

ParameterTypeDescription
idIdentifierThe ID of the item to look up.

Returns​

Item


getItemDrawChunks()​

getItemDrawChunks(localIds): Promise<object[]>

Returns per-tile index-buffer chunks for the given items. Each entry carries a tile id and parallel position / size Uint32Arrays giving the start index and index count of every contiguous run of vertices belonging to one of localIds in that tile's index buffer.

Lets a renderer clone a tile mesh sharing its geometry.attributes and index, then call geometry.addGroup(position[i], size[i], 0) for each chunk to draw only the matching slices. No highlight material slot is allocated; the call is read-only.

Parameters​

ParameterType
localIdsIterable<number>

Returns​

Promise<object[]>

Implementation of​

IFragmentsModel.getItemDrawChunks


getItems()​

getItems(localIds?): Promise<Map<number, RawItemData>>

Gets the items of the model.

Parameters​

ParameterTypeDescription
localIds?Iterable<number>The local IDs of the items to get. If undefined, it will return all items.

Returns​

Promise<Map<number, RawItemData>>

Implementation of​

IFragmentsModel.getItems


getItemsByQuery()​

getItemsByQuery(params, config?): Promise<number[]>

Retrieves items based on the specified query parameters.

Parameters​

ParameterTypeDescription
paramsItemsQueryParamsThe query parameters used to filter and retrieve items.
config?ItemsQueryConfigOptional query configuration.

Returns​

Promise<number[]>

A promise that resolves to the items matching the query.

Implementation of​

IFragmentsModel.getItemsByQuery


getItemsByVisibility()​

getItemsByVisibility(visible): Promise<number[]>

Gets the items by visibility.

Parameters​

ParameterTypeDescription
visiblebooleanWhether the items should be visible.

Returns​

Promise<number[]>


getItemsChildren()​

getItemsChildren(ids): Promise<number[]>

Get the spatial structure children of the specified items.

Parameters​

ParameterTypeDescription
idsIdentifier[]The IDs of the items to look up.

Returns​

Promise<number[]>

Implementation of​

IFragmentsModel.getItemsChildren


getItemsData()​

getItemsData(ids, config?): Promise <ItemData[]>

Get all the data of the specified items.

By default, the API returns the item’s built-in attributes only. Relations are not traversed unless explicitly enabled via the config parameter.

Parameters​

ParameterTypeDescription
idsIdentifier[]The IDs of the items to look up.
config?Partial <ItemsDataConfig>The configuration of the items data. By default, all
built-in attributes are returned and no relations are loaded.

Returns​

Promise <ItemData[]>

Implementation of​

IFragmentsModel.getItemsData

Examples​

// Retrieve all built-in attributes and all related entities (full graph)
await getItemsData(ids, {
attributesDefault: true,
relationsDefault: { attributes: true, relations: true },
});
// Retrieve built-in attributes and Property Sets only (via IsDefinedBy)
await getItemsData(ids, {
attributesDefault: true,
relations: {
IsDefinedBy: { attributes: true, relations: true },
DefinesOccurrence: { attributes: false, relations: false },
},
});

getItemsGeometry()​

getItemsGeometry(localIds, lod): Promise <MeshData[][]>

Retrieves the geometry data for the specified local IDs.

The returned data is structured as an array of arrays of MeshData, which contains the necessary information to reconstruct a THREE.BufferGeometry.

Parameters​

ParameterTypeDefault valueDescription
localIdsnumber[]undefinedAn array of local IDs for which the geometry data is requested.
lodCurrentLodCurrentLod.GEOMETRYThe level of detail for the geometry (optional).

Returns​

Promise <MeshData[][]>

Implementation of​

IFragmentsModel.getItemsGeometry


getItemsIds()​

getItemsIds(): Promise<number[]>

Gets all the items IDs of the model.

Returns​

Promise<number[]>

Implementation of​

IFragmentsModel.getItemsIds


getItemsIdsWithGeometry()​

getItemsIdsWithGeometry(): Promise<number[]>

Get all the items ids of the model that have geometry.

Returns​

Promise<number[]>

Implementation of​

IFragmentsModel.getItemsIdsWithGeometry


getItemsOfCategories()​

getItemsOfCategories(categories): Promise<object>

Get all the items of the model that belong to the specified category.

Parameters​

ParameterType
categoriesRegExp[]

Returns​

Promise<object>

Implementation of​

IFragmentsModel.getItemsOfCategories


getItemsVolume()​

getItemsVolume(localIds): Promise<number>

Retrieves the total volume of items based on their local IDs.

Parameters​

ParameterTypeDescription
localIdsnumber[]An array of local IDs representing the items.

Returns​

Promise<number>

A promise that resolves to the total volume of the specified items.

Implementation of​

IFragmentsModel.getItemsVolume


getItemsWithGeometry()​

getItemsWithGeometry(): Promise<Item[]>

Get all the items of the model that have geometry.

Returns​

Promise<Item[]>


getLocalIds()​

getLocalIds(): Promise<number[]>

Get all the local IDs of the model.

Returns​

Promise<number[]>

Implementation of​

IFragmentsModel.getLocalIds


getLocalIdsByGuids()​

getLocalIdsByGuids(guids): Promise<(null | number)[]>

Get the local IDs corresponding to the specified GUIDs.

Parameters​

ParameterTypeDescription
guidsstring[]Array of GUIDs to look up.

Returns​

Promise<(null | number)[]>

Implementation of​

IFragmentsModel.getLocalIdsByGuids


getLocalIdsFromItemIds()​

getLocalIdsFromItemIds(itemIds): Promise<number[]>

Translate internal itemIds into user-facing localIds, preserving order. Used by GPU-readback pickers that recover item ids from the per-vertex id attribute and need to map back to the public id space.

Parameters​

ParameterType
itemIdsIterable<number>

Returns​

Promise<number[]>

Implementation of​

IFragmentsModel.getLocalIdsFromItemIds


getLocalTransforms()​

getLocalTransforms(localIds?): Promise<Map<number, RawTransformData>>

Gets the local transforms of the model.

Parameters​

ParameterTypeDescription
localIds?Iterable<number>The local IDs of the local transforms to get. If undefined, it will return all local transforms.

Returns​

Promise<Map<number, RawTransformData>>

Implementation of​

IFragmentsModel.getLocalTransforms


getLocalTransformsIds()​

getLocalTransformsIds(): Promise<number[]>

Gets all the local transforms IDs of the model.

Returns​

Promise<number[]>

Implementation of​

IFragmentsModel.getLocalTransformsIds


getMaterials()​

getMaterials(localIds?): Promise<Map<number, RawMaterial>>

Gets the materials of the model.

Parameters​

ParameterTypeDescription
localIds?Iterable<number>The local IDs of the materials to get. If undefined, it will return all materials.

Returns​

Promise<Map<number, RawMaterial>>

Implementation of​

IFragmentsModel.getMaterials


getMaterialsIds()​

getMaterialsIds(): Promise<number[]>

Gets all the materials IDs of the model.

Returns​

Promise<number[]>

Implementation of​

IFragmentsModel.getMaterialsIds


getMaxLocalId()​

getMaxLocalId(): Promise<number>

Get the maximum local ID of the model.

Returns​

Promise<number>

Implementation of​

IFragmentsModel.getMaxLocalId


getMergedBox()​

getMergedBox(localIds): Promise<Box3>

Get the merged bounding box of the specified items.

Parameters​

ParameterTypeDescription
localIdsnumber[]The local IDs of the items to look up.

Returns​

Promise<Box3>


getMetadata()​

getMetadata<T>(): Promise<T>

Get the metadata of the model.

Type parameters​

Type parameterValue
T extends Record<string, any>Record<string, any>

Returns​

Promise<T>

Implementation of​

IFragmentsModel.getMetadata


getPositions()​

getPositions(localIds?): Promise<Vector3[]>

Get the absolute positions of the specified items.

Parameters​

ParameterTypeDescription
localIds?number[]The local IDs of the items to look up.

Returns​

Promise<Vector3[]>

Implementation of​

IFragmentsModel.getPositions


getRelationNames()​

getRelationNames(): Promise<string[]>

Retrieves the names of all relations associated with this model.

Returns​

Promise<string[]>

A promise that resolves to an array of strings, where each string is the name of a relation.


getRelations()​

getRelations(localIds?): Promise<Map<number, RawRelationData>>

Gets the relations of the model.

Parameters​

ParameterTypeDescription
localIds?number[]The local IDs of the relations to get. If undefined, it will return all relations.

Returns​

Promise<Map<number, RawRelationData>>

Implementation of​

IFragmentsModel.getRelations


getRepresentations()​

getRepresentations(localIds?): Promise<Map<number, RawRepresentation>>

Gets the representations of the model.

Parameters​

ParameterTypeDescription
localIds?Iterable<number>The local IDs of the representations to get. If undefined, it will return all representations.

Returns​

Promise<Map<number, RawRepresentation>>

Implementation of​

IFragmentsModel.getRepresentations


getRepresentationsIds()​

getRepresentationsIds(): Promise<number[]>

Gets all the representations IDs of the model.

Returns​

Promise<number[]>

Implementation of​

IFragmentsModel.getRepresentationsIds


getSamples()​

getSamples(localIds?): Promise<Map<number, RawSample>>

Gets the samples of the model.

Parameters​

ParameterTypeDescription
localIds?Iterable<number>The local IDs of the samples to get. If undefined, it will return all samples.

Returns​

Promise<Map<number, RawSample>>

Implementation of​

IFragmentsModel.getSamples


getSamplesIds()​

getSamplesIds(): Promise<number[]>

Gets all the samples IDs of the model.

Returns​

Promise<number[]>

Implementation of​

IFragmentsModel.getSamplesIds


getSection()​

getSection(plane, localIds?): Promise<ModelSection>

Gets the section (edges and fills) between the model and a given clipping plane.

Parameters​

ParameterTypeDescription
planePlaneThe plane to get the section of.
localIds?number[]The local IDs of the items to get the section of. If undefined, it will return the section of all items.

Returns​

Promise<ModelSection>

Implementation of​

IFragmentsModel.getSection


getSequenced()​

Experimental

getSequenced<T, U>(result, fromItems, inputs?): Promise <InformationResultType<T>>

Processes a sequence of actions in the worker and computes the result based on the provided input.

Type parameters​

Type parameter
T extends ItemInformationType
U extends ItemSelectionType

Parameters​

ParameterTypeDescription
resultTThe type of item information to compute, used to select the appropriate result function.
fromItemsU[]An array of selection types, each corresponding to an items selector function.
inputs?object-
inputs.result?ResultInputType<T>-
inputs.selector?Partial<Record<U, SelectionInputType<U>>>-

Returns​

Promise <InformationResultType<T>>

The computed result after processing the sequence of actions, or null if the result function is not found.


getSpatialStructure()​

getSpatialStructure(): Promise <SpatialTreeItem>

Get the spatial structure of the model.

Returns​

Promise <SpatialTreeItem>

Implementation of​

IFragmentsModel.getSpatialStructure


getSubsetBuffer()​

getSubsetBuffer(localIds, raw): Promise<any>

Get a buffer containing only the specified items and their associated geometry.

Parameters​

ParameterTypeDefault valueDescription
localIdsnumber[]undefinedThe local IDs of the items to include.
rawbooleanfalseWhether to get the raw buffer. If false, it will be compressed.

Returns​

Promise<any>

Implementation of​

IFragmentsModel.getSubsetBuffer


getVerticalAlignments()​

getVerticalAlignments(): Promise<Group<Object3DEventMap>>

Get the vertical alignments of the model (if any).

Returns​

Promise<Group<Object3DEventMap>>


getVisible()​

getVisible(localIds): Promise<boolean[]>

Gets the items by visibility.

Parameters​

ParameterTypeDescription
localIdsnumber[]The local IDs of the items to get the visibility of.

Returns​

Promise<boolean[]>


hasIndexEntry()​

hasIndexEntry<K>(name, key): Promise<boolean>

Test whether a key exists in the named index without resolving its value.

Type parameters​

Type parameter
K extends string | number

Parameters​

ParameterType
namestring
keyK

Returns​

Promise<boolean>

Implementation of​

IFragmentsModel.hasIndexEntry


highlight()​

highlight(localIds, highlightMaterial): Promise<void>

Highlights the specified items.

Parameters​

ParameterTypeDescription
localIdsundefined | number[]The local IDs of the items to highlight. If undefined, all items will be highlighted.
highlightMaterialMaterialDefinitionThe material to use for the highlight.

Returns​

Promise<void>


raycast()​

raycast(data): Promise<null | RaycastResult>

Performs a raycast on the model.

Parameters​

ParameterTypeDescription
dataRaycastDataThe data of the raycast.

Returns​

Promise<null | RaycastResult>


raycastAll()​

raycastAll(data): Promise<null | RaycastResult[]>

Performs a raycast on the model and returns all the results.

Parameters​

ParameterTypeDescription
dataRaycastDataThe data of the raycast.

Returns​

Promise<null | RaycastResult[]>


raycastWithSnapping()​

raycastWithSnapping(data): Promise<null | RaycastResult[]>

Performs a raycast on the model with snapping.

Parameters​

ParameterTypeDescription
dataSnappingRaycastDataThe data of the raycast.

Returns​

Promise<null | RaycastResult[]>


rectangleRaycast()​

rectangleRaycast(data): Promise<null | RectangleRaycastResult>

Performs a rectangle raycast on the model.

Parameters​

ParameterTypeDescription
dataRectangleRaycastDataThe data of the rectangle raycast.

Returns​

Promise<null | RectangleRaycastResult>


resetColor()​

resetColor(localIds): Promise<void>

Resets the color of the specified items to their original color while preserving other highlight properties (like opacity).

Parameters​

ParameterTypeDescription
localIdsundefined | number[]The local IDs of the items to reset color for. If undefined, all items will be affected.

Returns​

Promise<void>


resetHighlight()​

resetHighlight(localIds?): Promise<void>

Resets the highlight of the specified items.

Parameters​

ParameterTypeDescription
localIds?number[]The local IDs of the items to reset the highlight of. If undefined, it will reset the highlight of all items.

Returns​

Promise<void>


resetOpacity()​

resetOpacity(localIds): Promise<void>

Resets the opacity of the specified items to their original opacity while preserving other highlight properties (like color).

Parameters​

ParameterTypeDescription
localIdsundefined | number[]The local IDs of the items to reset opacity for. If undefined, all items will be affected.

Returns​

Promise<void>


resetVisible()​

resetVisible(): Promise<void>

Resets the visibility of all items.

Returns​

Promise<void>


setColor()​

setColor(localIds, color): Promise<void>

Applies a color to the specified items while preserving original material properties.

Parameters​

ParameterTypeDescription
localIdsundefined | number[]The local IDs of the items to color. If undefined, all items will be colored.
colorColorThe color to apply.

Returns​

Promise<void>


setGridLabelMaterial()​

setGridLabelMaterial(material): void

Replace the shared grid label material. The previous material is disposed after the swap.

Parameters​

ParameterType
materialMaterial

Returns​

void


setGridMaterial()​

setGridMaterial(material): void

Replace the shared grid material. The previous material is disposed after the swap.

Parameters​

ParameterType
materialLineBasicMaterial

Returns​

void


setLodMode()​

setLodMode(lodMode): Promise<void>

Sets the LOD / culling mode of the model.

Parameters​

ParameterTypeDescription
lodModeLodModeThe LOD / culling mode to set.

Returns​

Promise<void>


setOpacity()​

setOpacity(localIds, opacity): Promise<void>

Applies an opacity to the specified items while preserving original material properties (like color).

Parameters​

ParameterTypeDescription
localIdsundefined | number[]The local IDs of the items to change opacity for. If undefined, all items will be affected.
opacitynumberThe opacity to apply (0 to 1).

Returns​

Promise<void>


setVisible()​

setVisible(localIds, visible): Promise<void>

Sets the visibility of the specified items.

Parameters​

ParameterTypeDescription
localIdsundefined | number[]The local IDs of the items to set the visibility of.
visiblebooleanWhether the items should be visible.

Returns​

Promise<void>


toggleVisible()​

toggleVisible(localIds?): Promise<void>

Toggles the visibility of the specified items.

Parameters​

ParameterTypeDescription
localIds?number[]The local IDs of the items to toggle the visibility of.

Returns​

Promise<void>


useCamera()​

useCamera(camera): void

Sets a camera for the model. The model will use it to load tiles dinamically depending on the users view (e.g. hiding items that are not in the view, setting the LOD to far away items, etc).

Parameters​

ParameterTypeDescription
cameraPerspectiveCamera | OrthographicCameraThe camera to use.

Returns​

void


useClippingPlanes()​

useClippingPlanes(planes): void

Sets the clipping planes the model culls against, in world space. Pass the same array your renderer clips with (e.g. renderer.clippingPlanes): the model keeps the reference and reads it on every view refresh, so adding, removing or moving planes in place is picked up without calling this again. Assigning a new array to renderer.clippingPlanes is not: call this again with the new array.

Parameters​

ParameterTypeDescription
planesPlane[]The clipping planes to use.

Returns​

void