Model

class Model()

Object representing the model geometry and its associated data. All major functionality for querying the model hierarchy, retrieving geometry data and loading additional model data are part of this object.

More information can be found here.

Index

Methods

Methods

Model.activateCadConfiguration()
activateCadConfiguration(nodeId: number, view: IView?): Promise

Activates a CAD configuration

Parameters

nodeId: number

view: IView = …

View to set the CAD Configuration in. Visibility will be applied to all views. Uses default view if not specified.

Returns: Promise

None.
Model.activateCadView()
activateCadView(nodeId: number, duration: number?, massageCamera: boolean?, view: IView?): Promise

Activates a CAD View

Parameters

nodeId: number

duration: number = DefaultTransitionDuration

camera transition time in milliseconds.

massageCamera: boolean = true

If true, undesirable authored cameras may be modified into a camera with more reasonable values

view: IView = …

View to activate the CAD View in. Visibility will be applied to all views. Uses default view if not specified.

Returns: Promise

None.
Model.activateDefaultCadConfiguration()
activateDefaultCadConfiguration(fitNodes: boolean?, view: IView?): Promise

Activates Default CAD configuration

Parameters

fitNodes: boolean = true

Fit view to visible nodes if possible (default true)

view: IView = …

View to set the CAD Configuration in. Visibility will be applied to all views. Uses default view if not specified.

Returns: Promise

None.
Model.activateDefaultCadView()
activateDefaultCadView(duration: number?, massageCamera: boolean?, view: IView?): Promise

Activate the default CAD view

Parameters

duration: number = DefaultTransitionDuration

Duration of the camera animation

massageCamera: boolean = true

If true, undesirable authored cameras may be modified into a camera with more reasonable values

view: IView = …

View to set the CAD View in. Visibility will be applied to all views. Uses default view if not specified.

Returns: Promise

None.
Model.addPropertyToNode()
addPropertyToNode(nodeId: number, propertyName: string, propertyValue: string, propertyUnit: UnitElement[]): boolean

Purpose: Adds a property to the node

Parameters

nodeId: number

propertyName: string

propertyValue: string

propertyUnit: UnitElement[]

Returns: boolean

true if all went right, false otherwise
Model.cadConfigurationsEnabled()
cadConfigurationsEnabled(): Promise

Gets whether or not cad configurations are enabled

Returns: Promise

Boolean indicating whether or not cad configurations are enabled
Model.clear()
clear(): Promise

Remove all nodes, CAD views, configurations, and sheets from the model.

If you intend to load additional models via the loadSubtree family of methods, you should wait on the resolution of this promise before doing so.

Returns: Promise

Model.clearNodeFaceVisibility()
clearNodeFaceVisibility(partId: number): void

Clears the visibility for a node’s face elements, resetting them to default.

Parameters

partId: number

the Id of the part to be reset

Returns: void

Model.clearNodeLineVisibility()
clearNodeLineVisibility(partId: number): void

Clears the visibility for a node’s line elements, resetting them to default.

Parameters

partId: number

the Id of the part to clear visibilities from

Returns: void

Model.clearNodePointVisibility()
clearNodePointVisibility(partId: number): void

Clears the visibility for a node’s point elements, resetting it to default.

Parameters

partId: number

the Id of the part to clear visibilities from

Returns: void

Model.computeMinimumBodyBodyDistance()
computeMinimumBodyBodyDistance(partId1: number, partId2: number): Promise

Computes the distance between two bodies

Parameters

partId1: number

id for the part which the first face belongs to

partId2: number

id for the part which the second face belongs to

Returns: Promise

a promise that resolves with a Markup.Measure.FaceFaceDistanceItem when the operation completes
Model.computeMinimumFaceFaceDistance()
computeMinimumFaceFaceDistance(partId1: number, faceId1: number, partId2: number, faceId2: number): Promise

Computes the distance between two faces

Parameters

partId1: number

id for the part which the first face belongs to

faceId1: number

id for the face in the first part

partId2: number

id for the part which the second face belongs to

faceId2: number

id for the face in the second part

Returns: Promise

a promise that resolves with a Markup.Measure.FaceFaceDistanceItem when the operation completes
Model.computeMinimumFaceLineDistance()
computeMinimumFaceLineDistance(partId: number, faceId: number, ray: Ray): Promise

Computers the minimum distance between a face and an infinite line.

Parameters

partId: number

faceId: number

id of the face in the node

ray: Ray

the line (in the form of a ray) to test against

Returns: Promise

a promise that resolves with a Markup.Measure.FaceFaceDistanceItem when the operation completes
Model.computeMinimumFaceRayDistance()
computeMinimumFaceRayDistance(partId: number, faceId: number, ray: Ray): Promise

Computers the minimum distance between a face and a ray.

Parameters

partId: number

faceId: number

id of the face in the node

ray: Ray

the ray to test against

Returns: Promise

a promise that resolves with a Markup.Measure.FaceFaceDistanceItem when the operation completes
Model.createAndAddRepresentationItem()
createAndAddRepresentationItem(partNodeId: (undefined | None | number), repItemId: (None | number)): (None | number)

Creates a representation item on a part

Parameters

partNodeId: (undefined | None | number)

ID of the part node

repItemId: (None | number)

(optional) Id you want the node to have, if not specified the nodeId will be set automatically. Be aware that if the specified node Id is already used by another node, then it will be ignored and a new one will be set automatically.

Returns: (None | number)

node ID to access the created representation item, null is returned if something went wrong
Model.createCadView()
createCadView(nodeId: number, viewName: string, camera: Camera, pmiIds: (None | number[]), nodesToShow: (None | number[]), nodesToHide: (None | number[]), nodeIdsAndLocalTransforms: (None | [number, Matrix][]), cuttingPlane: (None | Plane), meshInstanceData: (None | MeshInstanceData)): (None | number)

Creates a CAD view. This method will trigger a “cadViewCreated” callback if the creation is successful.

Parameters

nodeId: number

viewName: string

Name of the view

camera: Camera

Camera that will be set when the view gets activated

pmiIds: (None | number[])

(optional, if undefined or null no change applied to pmis) Node IDs of the PMI to show for the view others will be hidden

nodesToShow: (None | number[])

(optional, pass null or empty array if none to send) Node IDs of the elements to force visibility on

nodesToHide: (None | number[])

(optional, pass null or empty array if none to send) Node IDs of the elements to force visibility off

nodeIdsAndLocalTransforms: (None | [number, Matrix][])

(optional, pass null or empty array if none to send) array of node ID and matrix pair, defining specific local transform to apply

cuttingPlane: (None | Plane)

(optional, pass null if none to send) Cutting plane to set when the view gets activated. Distance of the planes must be in the same unit as the model.

meshInstanceData: (None | MeshInstanceData)

(optional, pass null if none to send) object that specifies the data for the mesh instance of the rectangular frame (mostly found on capture views)

Returns: (None | number)

id of the view, null is returned if the function fails
Model.createImage()
createImage(primaryImage: ImageOptions, thumbnailImage: ImageOptions): Promise

Creates an image that can be applied as a texture via [[setNodesTexture]]. See [[deleteImages]].

Parameters

primaryImage: ImageOptions

The image data and associated options

thumbnailImage: ImageOptions

If specified, an uncompressed image that will be used as a placeholder for the primary image until it is fully loaded. Only useful when primaryImage is a compressed image.

Returns: Promise

Model.createMesh()
createMesh(meshData: MeshData, config: { doNotDelete: boolean }): Promise

Parameters

meshData: MeshData

[[MeshData]] object containing data to insert into the scene.

config: { doNotDelete: boolean }

Returns: Promise

Promise that resolves with a [[MeshId]] when the mesh has been created. The [[MeshId]] can be used to create instances of the mesh using [[createMeshInstance]].
Model.createMeshInstance()
createMeshInstance(data: MeshInstanceData, parentNodeId: (None | number), preventFromResetting: (None | boolean), isOutOfHierarchy: (None | boolean)): Promise

Creates an instance of a mesh that has been created using [[createMesh]] or retrieved using [[getMeshIds]].

Parameters

data: MeshInstanceData

object that specifies the data for this mesh instance

parentNodeId: (None | number)

the ID of the desired parent node

preventFromResetting: (None | boolean)

if set to true, then the visibility and positioning won’t be reset when resetxxx() functions gets called.

isOutOfHierarchy: (None | boolean)

True if the node created shouldn’t appear in the model structure.

Returns: Promise

Promise that resolves with a node ID that can be used to perform operations on this instance.
Model.createNode()
createNode(parentNodeId: (undefined | None | number), nodeName: string, nodeId: (None | number), localMatrix: (None | Matrix), visibility: (None | boolean), measurementUnit: (None | number)): number

Creates a node

Parameters

parentNodeId: (undefined | None | number)

ID of the node to link the child node to. This ID should not have a type of Body or BodyInstance. If this parameter is undefined, the child node will be linked to the root.

nodeName: string

nodeId: (None | number)

localMatrix: (None | Matrix)

(optional) Initial local matrix of the node (identity if none set)

visibility: (None | boolean)

(optional) Initial visibility of the node (visible if nothing set)

measurementUnit: (None | number)

Returns: number

child node ID
Model.createPart()
createPart(nodeId: (None | number)): number

Creates an part node

Parameters

nodeId: (None | number)

Returns: number

a node ID to access the created part node
Model.createPmiInstance()
createPmiInstance(data: MeshInstanceData, pmiType: PmiType, pmiSubType: PmiSubType, refOnTopoItems: RefOnTopoItem[], parentNodeId: (None | number)): Promise

Creates a PMI Instance from a mesh that has been created using the createMesh method.

Parameters

data: MeshInstanceData

object that specifies the data for the PMI graphic representation

pmiType: PmiType

see PmiType enum (Datum, Gdt, Dimension…)

pmiSubType: PmiSubType

see PmiSubType enum (DatumTarget, GdtFcf, DimensionDistance…)

refOnTopoItems: RefOnTopoItem[]

see RefOnTopoItem. It defines the PMI links to a body element, like a face or an edge

parentNodeId: (None | number)

the ID of the desired parent node

Returns: Promise

Promise that resolves with a node ID that can be used to perform operations on this instance. You can use deleteMeshInstances() to delete the PMI
Model.deleteImages()
deleteImages(imageIds: ImageId[]): Promise

Deletes images created with [[createImage]].

Parameters

imageIds: ImageId[]

The IDs of the images to be deleted

Returns: Promise

Model.deleteMeshes()
deleteMeshes(ids: MeshId[]): Promise

Deletes meshes that have been created at run time.

In order for this method to succeed, all mesh instances created for the given IDs must have also been destroyed with [[deleteMeshInstances]].

Parameters

ids: MeshId[]

Returns: Promise

Promise that resolves when this operation has completed.
Model.deleteMeshInstances()
deleteMeshInstances(nodeIds: number[]): Promise

Deletes mesh instances that have been created at run time

Parameters

nodeIds: number[]

array of IDs for mesh instances created at run time that should be destroyed

Returns: Promise

Promise that resolves when this operation has completed.
Model.deleteNode()
deleteNode(nodeId: number): Promise

Delete a node and all its children

Parameters

nodeId: number

Returns: Promise

Model.getAbsoluteRootNode()
getAbsoluteRootNode(): number

Returns the absolute root node of the assembly tree.

Returns: number

Id for the model tree root node or null if the model structure is not loaded.
Model.getActiveCadConfiguration()
getActiveCadConfiguration(): (None | number)

Gets Active CAD configuration

Returns: (None | number)

ID of activated CAD Configuration
Model.getAssociatedModelKey()
getAssociatedModelKey(nodeId: number): Promise

Parameters

nodeId: number

Returns: Promise

Model.getBimIdConnectedElements()
getBimIdConnectedElements(node: number, bimId: string, type: RelationshipType): { relateds: string[], relatings: string[] }

Retrieve all relationships that a bim id have, sorted in 2 arrays (relateds and relatings)

Parameters

node: number

any known node id of the working model.

bimId: string

bim id for which you want its relationships.

type: RelationshipType

Returns: { relateds: string[], relatings: string[] }

double array of bim id of relationship of the BimId sorted by its relateds and its relatings.
Model.getBimIdFromNode()
getBimIdFromNode(node: number): (None | string)

Retrieves the bim id of the corresponding node id.

Parameters

node: number

the id of the node for which you want its bim id.

Returns: (None | string)

the bim id corresponding to the node or null if none.
Model.getBimIdRelatedElements()
getBimIdRelatedElements(node: number, bimId: string, type: RelationshipType): string[]

Retrieve all related relationships that a bim id have.

Parameters

node: number

any known node id of the working model.

bimId: string

bim id for which you want its related relationships.

type: RelationshipType

Returns: string[]

array of bim id which are the related relationship of the BimId.
Model.getBimIdRelatingElements()
getBimIdRelatingElements(node: number, bimId: string, type: RelationshipType): string[]

Retrieve all relating relationships that a bim id have.

Parameters

node: number

any known node id of the working model.

bimId: string

bim id for which you want its relating relationships.

type: RelationshipType

Returns: string[]

array of bim id which are the relating relationship of the BimId.
Model.getBimIdsFromGenericId()
getBimIdsFromGenericId(ifcGuid: string): string[]

Retrieves the bim ids of the corresponding generic id.

Parameters

ifcGuid: string

the generic id for which you want its bim id.

Returns: string[]

the bim id corresponding to the ifcGuid or null if none.
Model.getBimInfoFromBimId()
getBimInfoFromBimId(node: number, bimId: string): { connected: boolean, name: string }

Retrieve the name of the bim element

Parameters

node: number

any known node id of the working model.

bimId: string

bim id for which you want the bim element name.

Returns: { connected: boolean, name: string }

the name and the info regarding the connection to a node of the bim element.
Model.getBranchVisibility()
getBranchVisibility(nodeId: number): BranchVisibility

Branch visibility indicates the visibility state for all of a node’s children.

Parameters

nodeId: number

ID of the node at the root of the branch.

Returns: BranchVisibility

Shown/Hidden if all children have the same visibility state, Mixed otherwise.
Model.getCadConfigurations()
getCadConfigurations(): IdStringMap

Gets CAD configurations

Returns: IdStringMap

an object mapping CAD configuration ID to config name
Model.getCadViewConfiguration()
getCadViewConfiguration(cadViewNodeId: number): (None | number)

Get the configuration in which the view is defined

Parameters

cadViewNodeId: number

Returns: (None | number)

ID of CAD Configuration of the view
Model.getCadViewMap()
getCadViewMap(): Map

Gets CAD View information for this model.

Returns: Map

a map mapping associating CAD View ID to name
Model.getCadViewPmis()
getCadViewPmis(nodeId: number): number[]

Get PMI IDs for a CAD View

Parameters

nodeId: number

Returns: number[]

IDs of visible PMIs for the view
Model.getDataFromIds()
getDataFromIds(ids: DataIds): Promise

Returns a data object. During the authoring phase, a user can store general data within a model. (This is how properties are stored, for example.) This function allows you to retrieve the data from the client application.

Parameters

ids: DataIds

Returns: Promise

promise that resolves when this operation has completed returning an array of 8bits int arrays for each ModelKey-DataKey pairs
Model.getDefaultCadConfiguration()
getDefaultCadConfiguration(): (None | number)

Gets CAD default configuration

Returns: (None | number)

ID of default CAD Configuration
Model.getDefaultCadView()
getDefaultCadView(): (None | number)

Gets CAD default view

Returns: (None | number)

ID of default CAD Configuration
Model.getEdgeAttributes()
getEdgeAttributes(nodeId: number, edgeIndex: number): Promise

Returns edge attributes for a node of the given node and edge.

Parameters

nodeId: number

Node to retrieve edge properties from

edgeIndex: number

Index of edge for which to retrieve edge attributes

Returns: Promise

Promise for the requested edge attributes. Properties returned will be null if none associated with the edge.
Model.getEdgeCount()
getEdgeCount(nodeId: number): Promise

Returns edge count for a node of the given node.

Parameters

nodeId: number

Node to retrieve edge count from

Returns: Promise

Promise providing the number of edges
Model.getEdgeProperty()
getEdgeProperty(nodeId: number, edgeId: number): Promise

Returns edge properties for a node of the given node and edge.

Parameters

nodeId: number

Node to retrieve edge properties from

edgeId: number

Returns: Promise

Promise for the requested edge properties. Properties returned will be null if none associated with the edge.
Model.getFaceAttributes()
getFaceAttributes(nodeId: number, faceIndex: number): Promise

Returns face attributes for a node of the given node and face.

Parameters

nodeId: number

Node to retrieve edge properties from

faceIndex: number

Index of face for which to retrieve face attributes

Returns: Promise

Promise for the requested face attributes. Properties returned will be null if none associated with the edge.
Model.getFaceCount()
getFaceCount(nodeId: number): Promise

Returns face count for a node of the given node and face.

Parameters

nodeId: number

Node to retrieve face count from

Returns: Promise

Promise providing the number of faces
Model.getFaceProperty()
getFaceProperty(nodeId: number, faceId: number): Promise

Returns Face properties for a node of the given node and face.

Parameters

nodeId: number

Node to retrieve face properties from

faceId: number

Returns: Promise

Promise for the requested face properties. Properties returned will be null if none associated with the face.
Model.getFilterName()
getFilterName(filterId: FilterId): (None | string)

Parameters

filterId: FilterId

Returns: (None | string)

The name of a filter for the given filter ID index or null if filter was not found
Model.getFilters()
getFilters(): Map

Returns names and ids of all filters available in the scene

Returns: Map

a map associating Filter IDs to filter names
Model.getFiltersWithNode()
getFiltersWithNode(nodeIdSearched: number): FilterId[]

Parameters

nodeIdSearched: number

Returns: FilterId[]

Filters which retain or remove the given node.
Model.getGenericIdFromBimId()
getGenericIdFromBimId(node: number, bimId: string): (None | string)

Retrieves the generic id of the corresponding bim id.

Parameters

node: number

any known node id of the working model.

bimId: string

bim id for which you want its generic id.

Returns: (None | string)

the generic id corresponding to the BimId or null if none.
Model.getGenericTypeIdMap()
getGenericTypeIdMap(): Map

Gets all generic types and NodeIds with that type.

Returns: Map

Map containing generic types and NodeIds
Model.getGenericTypes()
getGenericTypes(): string[]

This function gets all generic types contained in the model.

Returns: string[]

All generic types.
Model.getLayerIdsFromName()
getLayerIdsFromName(name: string): (None | LayerId[])

Parameters

name: string

Returns: (None | LayerId[])

Id of layers for the given filter name or null if no layers are found
Model.getLayerName()
getLayerName(layerId: LayerId): (None | string)

Parameters

layerId: LayerId

Returns: (None | string)

The name of a layer for the given filter ID or null if layer was not found
Model.getLayers()
getLayers(): Map

Returns names and ids of all layers available in the scene

Returns: Map

a map associating Layer IDs to Layer names
Model.getLooseBounding()
getLooseBounding(): Promise

Gets the world space bounding box for the model. This does not take node visibility into account.

Returns: Promise

Promise that resolves with a Box representing the world space bounding box of the model.
Model.getLowestAvailableNodeId()
getLowestAvailableNodeId(): number

Returns the lowest available node ID

Returns: number

Model.getMeshIds()
getMeshIds(nodeIds: number[]): Promise

Retrieve the [[MeshId]] associated with the mesh data attached to the given nodes.

Parameters

nodeIds: number[]

Returns: Promise

Model.getMetallicRoughness()
getMetallicRoughness(nodeIds: number[]): Promise

Gets the metallic and roughness factors for the supplied nodes materials. Materials that are not currently set to use the Metallic Roughness shading model will have a null entry

Parameters

nodeIds: number[]

List of nodes to get material properties for

Returns: Promise

Model.getModelBounding()
getModelBounding(ignoreInvisible: boolean, includeExcluded: boolean, tightBounding: boolean?): Promise

Gets the world space bounding box for the model.

Parameters

ignoreInvisible: boolean

includeExcluded: boolean

tightBounding: boolean = false

Returns: Promise

Promise that resolves with a Box representing the world space bounding box of the model.
Model.getModelFileNameFromNode()
getModelFileNameFromNode(nodeId: number): (None | string)

Parameters

nodeId: number

Returns: (None | string)

the original file name of the model which contain the given node or null if the node is not found.
Model.getModelFileTypeFromNode()
getModelFileTypeFromNode(nodeId: number): (None | FileType)

Parameters

nodeId: number

Returns: (None | FileType)

the original file type of the model which contain the given node or null if the node is not found.
Model.getNodeCappingMeshData()
getNodeCappingMeshData(nodeId: number): Promise

Fetch the mesh data for any capping geometry on a particular node

Parameters

nodeId: number

Returns: Promise

Model.getNodeChildren()
getNodeChildren(nodeId: number, includeOutOfHierarchy: boolean): number[]

Returns IDs for child nodes for the given Id.

Parameters

nodeId: number

includeOutOfHierarchy: boolean

true to include Out Of Hierarchy node, false or null to exclude them

Returns: number[]

ID for the children of this node, or null if the ID is invalid
Model.getNodeColorMap()
getNodeColorMap(startNodeId: number, elementType: ElementType): Promise

Gets a map associating NodeIds to colors that are set on those nodes. Only NodeIds of nodes that have a color set will be included.

Parameters

startNodeId: number

The start node to walk when building the color map.

elementType: ElementType

Returned colors are of this element type.

Returns: Promise

Model.getNodeEffectiveFaceColor()
getNodeEffectiveFaceColor(partId: number, faceIndex: number, view: IView): Promise

Gets the color set via [[setNodeFaceColor]] on a face element. If no color has been set, the node’s face color will be returned. If the node’s face color has not been set, the color specified when the model was authored will be returned.

Parameters

partId: number

faceIndex: number

the index of the face in the node

view: IView

the View to use when calculating view effects

Returns: Promise

Model.getNodeEffectiveLineColor()
getNodeEffectiveLineColor(partId: number, lineIndex: number, view: IView): Promise

Gets the color set via [[setNodeLineColor]] on a line element. If no color has been set, the node’s line color will be returned. If the node’s line color has not been set, the color specified when the model was authored will be returned.

Parameters

partId: number

lineIndex: number

the index of the line in the node

view: IView

the View to use when calculating view effects

Returns: Promise

Model.getNodeEffectivePointColor()
getNodeEffectivePointColor(partId: number, pointIndex: number, view: IView): Promise

Gets the color set via [[setNodePointColor]] on a point element. If no color has been set, the node’s point color will be returned. If the node’s point color has not been set, the color specified when the model was authored will be returned.

Parameters

partId: number

pointIndex: number

the index of the point in the node

view: IView

the View to use for calculating view effects

Returns: Promise

Model.getNodeExchangeId()
getNodeExchangeId(nodeId: number): (None | string)

Returns the Exchange ID of a node in the assembly tree.

Parameters

nodeId: number

The node ID to get the Exchange ID from.

Returns: (None | string)

The Exchange ID of the node with the given nodeId or null if no Exchange ID is found.
Model.getNodeFaceColor()
getNodeFaceColor(partId: number, faceIndex: number): Promise

Gets the color set via [[setNodeFaceColor]] on a face element. If no color has been set, null will be returned. <br><br> See also: [[getNodeEffectiveFaceColor]]

Parameters

partId: number

faceIndex: number

the index of the face in the node

Returns: Promise

Model.getNodeFaceHighlighted()
getNodeFaceHighlighted(nodeId: number, faceIndex: number): Promise

Returns whether the supplied face element has been highlighted with [[setNodeFaceHighlighted]].

Parameters

nodeId: number

the ID of the node containing the face element

faceIndex: number

the index of the face within the node

Returns: Promise

Model.getNodeGenericId()
getNodeGenericId(nodeId: number): (None | string)

Parameters

nodeId: number

Returns: (None | string)

the generic id of the given node or null if the node is not found.
Model.getNodeGenericType()
getNodeGenericType(nodeId: number): (None | string)

Parameters

nodeId: number

Returns: (None | string)

the generic type of the given node or null if the node is not found.
Model.getNodeIdFromBimId()
getNodeIdFromBimId(node: number, bimID: string): (None | number)

Retrieves the node id of the corresponding bim id.

Parameters

node: number

any known node id of the working model.

bimID: string

bim id for which you want its node id.

Returns: (None | number)

the node id corresponding to the BimId or null if none.
Model.getNodeIdFromScInstanceKey()
getNodeIdFromScInstanceKey(inclusionKey: InclusionKey, instanceKey: InstanceKey): (None | number)

Returns the body node instance ID for the given SC instance ID

Parameters

inclusionKey: InclusionKey

instanceKey: InstanceKey

Returns: (None | number)

body node instance ID
Model.getNodeIdOffset()
getNodeIdOffset(nodeId: number): number

Retrieves the node ID offset for a given node.

Parameters

nodeId: number

The node to obtain the node ID offset from.

Returns: number

The node ID offset for the supplied node.
Model.getNodeIdsByGenericIds()
getNodeIdsByGenericIds(genericIds: string[]): number[]

Returns a list of node IDs given a list of generic IDs. Note that the returned list of node IDs may be longer than the provided list of generic IDs since one ID can be used by more than one node.

Parameters

genericIds: string[]

Array of generic IDs to find nodes fore

Returns: number[]

Array of node ids corresponding to the provided generic IDs
Model.getNodeLayerId()
getNodeLayerId(nodeId: number): (None | LayerId)

Returns the layer ID of a node in the assembly tree.

Parameters

nodeId: number

The node ID to get the Exchange ID from.

Returns: (None | LayerId)

The layer ID of the node with the given nodeId or null if no layer is found.
Model.getNodeLineColor()
getNodeLineColor(partId: number, lineIndex: number): Promise

Gets the color set via [[setNodeLineColor]] on a line element. If no color has been set, null will be returned.

Parameters

partId: number

lineIndex: number

the index of the line in the node

Returns: Promise

Model.getNodeLineHighlighted()
getNodeLineHighlighted(nodeId: number, lineIndex: number): Promise

Returns whether the supplied line element has been highlighted with [[setNodeLineHighlighted]].

Parameters

nodeId: number

the ID of the node containing the line element

lineIndex: number

the index of the line within the node

Returns: Promise

Model.getNodeMatrix()
getNodeMatrix(nodeId: number): Matrix

Returns a copy of the Matrix for a node of the given ID

Parameters

nodeId: number

Returns: Matrix

Copy of the Matrix of the node
Model.getNodeMeshData()
getNodeMeshData(nodeId: number): Promise

Fetch the mesh data for a particular node

Parameters

nodeId: number

the node’s ID

Returns: Promise

Model.getNodeName()
getNodeName(nodeId: number): (None | string)

Returns the name for a node in the assembly tree.

Parameters

nodeId: number

The node ID to get the name of.

Returns: (None | string)

The name of the node with the given nodeId or null if no name is found.
Model.getNodeNetMatrix()
getNodeNetMatrix(nodeId: number): Matrix

Returns net matrix for a node of the given ID

Parameters

nodeId: number

Returns: Matrix

Net Matrix of the Node
Model.getNodeParent()
getNodeParent(nodeId: number): (None | number)

Returns the parent Id for the given node id.

Parameters

nodeId: number

Returns: (None | number)

ID of the parent node for the supplied ID. If the ID is invalid or the root ID, null is returned.
Model.getNodePointColor()
getNodePointColor(partId: number, pointIndex: number): Promise

Gets the color set via [[setNodePointColor]] on a point element. If no color has been set, null will be returned. <br><br> See also: [[getNodeEffectivePointColor]]

Parameters

partId: number

pointIndex: number

the index of the point in the node

Returns: Promise

Model.getNodePointHighlighted()
getNodePointHighlighted(nodeId: number, pointIndex: number): Promise

Returns whether the supplied point element has been highlighted with [[setNodePointHighlighted]].

Parameters

nodeId: number

the ID of the node containing the point element

pointIndex: number

the index of the point within the node

Returns: Promise

Model.getNodeProperties()
getNodeProperties(nodeId: number, computeFromChildren: boolean?): Promise

Returns the properties for the given node ID.

Parameters

nodeId: number

computeFromChildren: boolean = true

If true physical properties will be computed from child nodes.

Returns: Promise

object properties for the supplied ID, or null if the ID was invalid
Model.getNodeRealBounding()
getNodeRealBounding(nodeId: number, view: IView): Promise

Gets the world space bounding box for a node including any effects (explosion, camera suppression, etc). Note: This function can have performance implications when used on nodes with many children.

Parameters

nodeId: number

ID of the node for which you wish to get the bounding box.

view: IView

View to use for determining visibility.

Returns: Promise

Promise that resolves with the world space bounding box for the given ID.
Model.getNodesAmbientColor()
getNodesAmbientColor(nodeIds: number[]): Promise

Gets the ambient color on the faces for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose color to get

Returns: Promise

Model.getNodesBounding()
getNodesBounding(nodeIds: number[], config: GetNodesBoundingConfig): Promise

Gets the world space bounding box for a list of nodes.

Parameters

nodeIds: number[]

IDs of the nodes for which you wish to get the bounding box.

config: GetNodesBoundingConfig

Allows fine control of what body types to compute the bounding against. If not provided, all body types are considered.

Returns: Promise

Promise that resolves with the world space bounding box for the given IDs.
Model.getNodesByGenericType()
getNodesByGenericType(genericType: string): (None | Set)

This function returns all NodeIds with an IFC type.

Parameters

genericType: string

Returns: (None | Set)

All NodeIds with an IFC type
Model.getNodesCappingMeshData()
getNodesCappingMeshData(nodeIds: number[]): Promise

Fetch the mesh data for any capping geometry on a list of nodes and their children

Parameters

nodeIds: number[]

the node IDs to get capping data from.

Returns: Promise

Model.getNodesCullingVectors()
getNodesCullingVectors(nodeIds: number[]): Promise

Retrieves the vector and angle used to determine an object’s visibility based on camera orientation. If unset, null will appear at the corresponding array index.

Parameters

nodeIds: number[]

The nodes to query culling vectors from.

Returns: Promise

A promise of culling vectors.
Model.getNodesDrawMode()
getNodesDrawMode(nodeIds: number[]): Record

Get overridden draw mode for the given node ids. Only leaf nodes attached to a body are considered. Other wont be in the returned record.

Parameters

nodeIds: number[]

The node ids to get the draw mode from.

Returns: Record

A record mapping node ids to their overridden draw modes.
Model.getNodesEffectiveAmbientColor()
getNodesEffectiveAmbientColor(nodeIds: number[]): Promise

Gets the ambient color set on the faces of a list of leaf nodes. If no color has been set, the color specified when the model was authored will be returned.

Parameters

nodeIds: number[]

IDs of the nodes to be queried

Returns: Promise

Model.getNodesEffectiveEmissiveColor()
getNodesEffectiveEmissiveColor(nodeIds: number[]): Promise

Gets the emissive color set on the faces of a list of leaf nodes. If no color has been set, the color specified when the model was authored will be returned.

Parameters

nodeIds: number[]

IDs of the nodes to be queried

Returns: Promise

Model.getNodesEffectiveFaceColor()
getNodesEffectiveFaceColor(nodeIds: number[]): Promise

Gets the color set on the faces of a list of leaf nodes. If no color has been set, the color specified when the model was authored will be returned.

Parameters

nodeIds: number[]

IDs of the nodes to be queried

Returns: Promise

Model.getNodesEffectiveLineColor()
getNodesEffectiveLineColor(nodeIds: number[]): Promise

Gets the color set on the lines of a list of leaf nodes. If no color has been set, the color specified when the model was authored will be returned.

Parameters

nodeIds: number[]

IDs of the nodes to be queried

Returns: Promise

Model.getNodesEffectiveOpacity()
getNodesEffectiveOpacity(leafNodes: number[], elementType: ElementType): Promise

Gets the opacity set on a list of leaf nodes multiplied by the opacity specified when the model was authored. If no opacity has been set, the opacity specified when the model was authored will be returned directly.

Parameters

leafNodes: number[]

elementType: ElementType

the type of element (faces, lines or points) to query

Returns: Promise

Model.getNodesEffectivePointColor()
getNodesEffectivePointColor(nodeIds: number[]): Promise

Gets the color set on the points of a list of leaf nodes. If no color has been set, the color specified when the model was authored will be returned.

Parameters

nodeIds: number[]

IDs of the nodes to be queried

Returns: Promise

Model.getNodesEffectiveSpecularColor()
getNodesEffectiveSpecularColor(nodeIds: number[]): Promise

Gets the specular color set on the faces of a list of leaf nodes. If no color has been set, the color specified when the model was authored will be returned.

Parameters

nodeIds: number[]

IDs of the nodes to be queried

Returns: Promise

Model.getNodesFaceColor()
getNodesFaceColor(nodeIds: number[]): Promise

Gets the color set via [[setNodesFaceColor]] on the faces of a list of leaf nodes. If no color has been explicitly set for a particular node, null will appear at the corresponding position in the returned array. <br><br> See also: [[getNodesEffectiveFaceColor]]

Parameters

nodeIds: number[]

IDs of the nodes to be queried

Returns: Promise

Model.getNodesFaceEmissiveColor()
getNodesFaceEmissiveColor(nodeIds: number[]): Promise

Gets the emissive color on the faces for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose color to get

Returns: Promise

Model.getNodesFaceSpecularColor()
getNodesFaceSpecularColor(nodeIds: number[]): Promise

Gets the specular color on the faces for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose color to get

Returns: Promise

Model.getNodesFromFiltersId()
getNodesFromFiltersId(filtersId: FilterId[]): (None | FilteredNodes)

Parameters

filtersId: FilterId[]

array of filters indexes to take in account

Returns: (None | FilteredNodes)

nodesId of nodes retained by the given filter indices and the type of filter (inclusive or not). Returns null if no filter is found.
Model.getNodesFromLayer()
getNodesFromLayer(layerId: LayerId, onlyTreeNodes: boolean): (None | number[])

Returns IDs of nodes in the given layer.

Parameters

layerId: LayerId

The layer ID to get nodes from.

onlyTreeNodes: boolean

if true return only nodes present in model Tree

Returns: (None | number[])

An array of nodes Id of nodes with the given layerId or null if no layers are found.
Model.getNodesFromLayerName()
getNodesFromLayerName(layerName: string, onlyTreeNodes: boolean): (None | number[])

Returns IDs of nodes in the given layer.

Parameters

layerName: string

onlyTreeNodes: boolean

if true return only nodes present in model Tree

Returns: (None | number[])

An array of nodes Id of nodes with the given layerName or null if no layers are found.
Model.getNodesFromLayers()
getNodesFromLayers(layersId: LayerId[], onlyTreeNodes: boolean): (None | number[])

Returns IDs of nodes in given layers.

Parameters

layersId: LayerId[]

Array of layers Id to get nodes from.

onlyTreeNodes: boolean

if true return only nodes present in model Tree

Returns: (None | number[])

An array of nodes Id of nodes with one of the given layerId or null if no layers are found.
Model.getNodesHaveTransparency()
getNodesHaveTransparency(nodeIds: number[]): Promise

Returns whether nodes with the given NodeIds have an opacity value that is not fully opaque.

Parameters

nodeIds: number[]

IDs of nodes to query.

Returns: Promise

array of boolean values corresponding to the id array passed into the function. A value of true indicates that the node contains transparency and is not fully opaque.
Model.getNodesHighlighted()
getNodesHighlighted(partIds: number[]): Promise

Returns whether the supplied nodes have been highlighted with [[setNodesHighlighted]].

Parameters

partIds: number[]

Returns: Promise

Model.getNodesInstancingSamePart()
getNodesInstancingSamePart(nodeId: number): Promise

Returns IDs of nodes who instance the same part as the supplied node. This method should be called on nodes whose type is PartInstance.

Parameters

nodeId: number

Returns: Promise

Array containing PartInstance node IDs. These nodes all instance the same part as the supplied node. If this method is called on a node which is not of type PartInstance then null will be returned.
Model.getNodesLineColor()
getNodesLineColor(nodeIds: number[]): Promise

Gets the color set via [[setNodesLineColor]] on the lines of a list of leaf nodes. If no color has been set for a particular node, null will appear at the corresponding position in the returned array.

Parameters

nodeIds: number[]

IDs of the nodes to be queried

Returns: Promise

Model.getNodesMaterial()
getNodesMaterial(nodeIds: number[]): Promise

Gets the material properties of a node. This will combine material properties set at runtime with authored material properties to return the complete current material.

Parameters

nodeIds: number[]

IDs of the nodes to be queried

Returns: Promise

Promise that resolves with an array of material properties for each node
Model.getNodesOpacity()
getNodesOpacity(leafNodes: number[]): Promise

Gets the opacity set via [[setNodesOpacity]] on a list of leaf nodes. If no value has been set for a particular node, null will appear at the corresponding position in the returned array.

Parameters

leafNodes: number[]

Returns: Promise

Model.getNodesPointColor()
getNodesPointColor(nodeIds: number[]): Promise

Gets the color set via [[setNodesPointColor]] on the points of a list of leaf nodes. If no color has been explicitly set for a particular node, null will appear at the corresponding position in the returned array. <br><br> See also: [[getNodesEffectivePointColor]]

Parameters

nodeIds: number[]

IDs of the nodes to be queried

Returns: Promise

Model.getNodeType()
getNodeType(nodeId: number): NodeType

Returns the type of the node with the given ID.

Parameters

nodeId: number

Returns: NodeType

The type of the node.
Model.getNodeUnitMultiplier()
getNodeUnitMultiplier(nodeId: number): number

Returns the unit multiplier affecting the supplied node. This number is a multiplier of millimeters (for example inches will be 25.4). The default value is 1.0.

Parameters

nodeId: number

Returns: number

The unit multiplier for the model (in mm)
Model.getNodeUserData()
getNodeUserData(nodeId: number, index: UserDataIndex): Uint8Array

Returns the user data for a given node and index.

Parameters

nodeId: number

The ID of the node to query.

index: UserDataIndex

The index of the data.

Returns: Uint8Array

The user data.
Model.getNodeUserDataIndices()
getNodeUserDataIndices(nodeId: number): UserDataIndex[]

Returns all the UserDataIndex items associated with the input node.

Parameters

nodeId: number

The ID of the node to query.

Returns: UserDataIndex[]

A list of UserDataIndex, possibly empty.
Model.getNodeVisibility()
getNodeVisibility(nodeId: number): boolean

Returns the current visibility for a node.

Parameters

nodeId: number

ID of the node to get visibility for.

Returns: boolean

true if the current node’s visibility state is on or false if it is not.
Model.getOutOfHierarchy()
getOutOfHierarchy(nodeId: number): boolean

Returns “Out Of Hierarchy” status for child node for the given Id.

Parameters

nodeId: number

Returns: boolean

false if node is Out Of Hierarchy, true if it is
Model.getPmiColor()
getPmiColor(): Color

Returns the set PMI override color (if none is set, defaults to black)

Returns: Color

color
Model.getPmiColorOverride()
getPmiColorOverride(): boolean

Returns: boolean

a boolean value indicating the status of the PMI override color.
Model.getPmis()
getPmis(): IdStringMap

Returns names and ids of all the PMIs available in the scene

Returns: IdStringMap

a map associating PMI IDs to PMI names
Model.getPmiSubtype()
getPmiSubtype(pmiId: number): PmiSubType

Returns the subtype of a given PMI

Parameters

pmiId: number

Returns: PmiSubType

Subtype of the PMI (Dimension distance, Datum target, GD&T fcf…)
Model.getPmiTopologyReferences()
getPmiTopologyReferences(pmiNodeId: number): (None | RefOnTopoItem[])

Gets an array of PMI topology references linking a PMI node to a body element, like a face or an edge.

Parameters

pmiNodeId: number

the ID of the PMI node.

Returns: (None | RefOnTopoItem[])

Model.getPmiType()
getPmiType(pmiId: number): PmiType

Returns the type of a given PMI

Parameters

pmiId: number

Returns: PmiType

Type of the PMI (Dimension, Datum, GD&T…)
Model.getPointAttributes()
getPointAttributes(nodeId: number, pointIndex: number): Promise

Returns point attributes for a node of the given node and point.

Parameters

nodeId: number

Node to retrieve point properties from

pointIndex: number

Index of point for which to retrieve point attributes

Returns: Promise

Promise for the requested point attributes. Properties returned will be null if none associated with the point.
Model.getRelationshipTypesFromBimId()
getRelationshipTypesFromBimId(node: number, bimId: string): RelationshipType[]

Retrieves all type of relationships that a bim id has.

Parameters

node: number

any known node id of the working model.

bimId: string

bim id for which you want its types of relationships.

Returns: RelationshipType[]

array of type of relationship corresponding to the BimId.
Model.getScInstanceKey()
getScInstanceKey(nodeId: number): (None | InstanceInc)

Returns the SC ID of a body instance

Parameters

nodeId: number

node instance ID. This must be a body node

Returns: (None | InstanceInc)

SC instance ID, a pair of numbers consisting of the inclusion ID and the instance ID. null is returned if the function fails.
Model.getUniqueLayerNames()
getUniqueLayerNames(): string[]

Return names of layers. Different layers can have the same name. Some layers can be unnamed.

Returns: string[]

Names of layers
Model.getViewAxes()
getViewAxes(): ViewAxes

Returns: ViewAxes

the up and front vectors for the model coordinate system.
Model.getVisibilityState()
getVisibilityState(startNodeId: number): Promise

Returns a defaultVisibility boolean value and a visibilityException set of NodeIds. defaultVisibility will be true if there are more nodes visible than hidden, and false otherwise. If defaultVisibility is true, set of nodes that are hidden, if false, nodes that are visible.

Parameters

startNodeId: number

Returns: Promise

Model.hasDepthRange()
hasDepthRange(nodeIds: number[]): Promise

Parameters

nodeIds: number[]

Returns: Promise

Model.hasEffectiveGenericType()
hasEffectiveGenericType(nodeId: number, genericType: string): boolean

Checks if a [[NodeId]] is a generic type.

Parameters

nodeId: number

genericType: string

Returns: boolean

Model.isAnnotationView()
isAnnotationView(cadViewNodeId: number): boolean

Tells if the view is an annotation view or not

Parameters

cadViewNodeId: number

Node ID of the CAD view

Returns: boolean

true if the view is an annotation view
Model.isCombineStateView()
isCombineStateView(cadViewNodeId: number): boolean

Tells if the view is a combine state view or not

Parameters

cadViewNodeId: number

Node ID of the CAD view

Returns: boolean

true if the view is a combine state view
Model.isDrawing()
isDrawing(): boolean

Tells if the model is a CAD drawing or not

Returns: boolean

true if the model is a CAD drawing
Model.isFaceMeasurable()
isFaceMeasurable(bodyId: number, faceIndex: number): Promise

Parameters

bodyId: number

faceIndex: number

Returns: Promise

Model.isLineMeasurable()
isLineMeasurable(bodyId: number, lineIndex: number): Promise

Parameters

bodyId: number

ID of the body node containing the line

lineIndex: number

Index of the line ot be checked

Returns: Promise

true if the line has associated measurement data
Model.isMeasurable()
isMeasurable(): boolean

Returns: boolean

true if the model contains measurement data.
Model.isNodeLoaded()
isNodeLoaded(nodeId: number): boolean

Queries if a node is fully loaded or not.

Parameters

nodeId: number

The node to query.

Returns: boolean

True if the node is fully loaded; false otherwise.
Model.isWithinExternalModel()
isWithinExternalModel(nodeId: number): boolean

Returns true if the node is within an external model.

Parameters

nodeId: number

Returns: boolean

Model.loadMeasurementFromFile()
loadMeasurementFromFile(filename: string): Promise

Loads measurement data from a ZIP file

Parameters

filename: string

Name of a file containing ZIP measurement data

Returns: Promise

Model.loadMeasurementFromJson()
loadMeasurementFromJson(json: any): Promise

Loads measurement data from a JSON object

Parameters

json: any

JSON object containing measurement data

Returns: Promise

Model.loadMeasurementFromString()
loadMeasurementFromString(str: string): Promise

Loads measurement data from a JSON string

Parameters

str: string

JSON string containing measurement data

Returns: Promise

Model.loadSubtreeFromModel()
loadSubtreeFromModel(nodeId: number, modelName: string, config: LoadSubtreeConfig): Promise

Loads the tree stored in a model file and query loading of required meshes

Parameters

nodeId: number

ID of the node to link the subtree with. This ID should not have a type of Body or BodyInstance. If this parameter is null, the sub tree will be linked to the root. This method will trigger a subtreeLoaded event.

modelName: string

The name of the model to load.

config: LoadSubtreeConfig

Configuration to control load behavior.

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs.
loadSubtreeFromModel(nodeId: number, modelName: string, additionalMatrix: (None | Matrix)): Promise

Loads the tree stored in a model file and query loading of required meshes

Parameters

nodeId: number

ID of the node to link the subtree with. This ID should not have a type of Body or BodyInstance. If this parameter is null, the sub tree will be linked to the root. This method will trigger a subtreeLoaded event.

modelName: string

The name of the model to load.

additionalMatrix: (None | Matrix)

Optional matrix to get multiplied into the net attachment matrix.

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs.
Model.loadSubtreeFromScsBuffer()
loadSubtreeFromScsBuffer(nodeId: number, buffer: ScsBuffer, config: LoadSubtreeConfig): Promise

Loads the tree stored in a model file and query loading of required meshes

Parameters

nodeId: number

ID of the node to link the subtree with. This ID should not have a type of Body or BodyInstance. If this parameter is null, the sub tree will be linked to the root. This method will trigger a subtreeLoaded event.

buffer: ScsBuffer

The SCS buffer to load.

config: LoadSubtreeConfig

Configuration to control load behavior.

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs.
loadSubtreeFromScsBuffer(nodeId: number, buffer: ScsBuffer, additionalMatrix: (None | Matrix)): Promise

Loads the tree stored in a model file and query loading of required meshes

Parameters

nodeId: number

ID of the node to link the subtree with. This ID should not have a type of Body or BodyInstance. If this parameter is null, the sub tree will be linked to the root. This method will trigger a subtreeLoaded event.

buffer: ScsBuffer

The SCS buffer to load.

additionalMatrix: (None | Matrix)

Optional matrix to get multiplied into the net attachment matrix.

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs.
Model.loadSubtreeFromScsFile()
loadSubtreeFromScsFile(nodeId: number, scsFilename: string, config: LoadSubtreeConfig): Promise

Loads the tree stored in a model file and query loading of required meshes

Parameters

nodeId: number

ID of the node to link the subtree with. This ID should not have a type of Body or BodyInstance. If this parameter is null, the sub tree will be linked to the root. This method will trigger a subtreeLoaded event.

scsFilename: string

The name of the SCS file to load.

config: LoadSubtreeConfig

Configuration to control load behavior.

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs.
loadSubtreeFromScsFile(nodeId: number, scsFilename: string, additionalMatrix: (None | Matrix)): Promise

Loads the tree stored in a model file and query loading of required meshes

Parameters

nodeId: number

ID of the node to link the subtree with. This ID should not have a type of Body or BodyInstance. If this parameter is null, the sub tree will be linked to the root. This method will trigger a subtreeLoaded event.

scsFilename: string

The name of the SCS file to load.

additionalMatrix: (None | Matrix)

Optional matrix to get multiplied into the net attachment matrix.

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs.
Model.loadSubtreeFromScsXmlBuffer()
loadSubtreeFromScsXmlBuffer(nodeId: number, xmlData: (string | Document), modelNameToScs: (None | ModelNameToScsFileFunc), config: LoadSubtreeConfig): Promise

Loads the tree stored in the XML and query loading of required meshes Load order is determined by the projected size of bounding information present in the XML. If streamCutoffScale is set to a non zero value, a file whose projected size is lower than the cutoff will not be streamed until its projected size reaches the cutoff.

Parameters

nodeId: number

ID of the node to link the sub tree with. This ID should not have a type of Body or BodyInstance. If this parameter is null, the sub tree will be linked to the root. This method will trigger a subtreeLoaded event.

xmlData: (string | Document)

XML document or XML document string.

modelNameToScs: (None | ModelNameToScsFileFunc)

Optional callback to massage model names within the XML file to SCS file URLS or SCS file buffers. Return null to skip the model.

config: LoadSubtreeConfig

Configuration to control load behavior.

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs that will resolve when all files have been loaded.
loadSubtreeFromScsXmlBuffer(nodeId: number, xmlData: (string | Document), modelNameToScs: (None | ModelNameToScsFileFunc), additionalMatrix: (None | Matrix), allowMissingExternalModels: boolean): Promise

Loads the tree stored in the XML and query loading of required meshes. Load order is determined by the projected size of bounding information present in the XML. If streamCutoffScale is set to a non zero value, a file whose projected size is lower than the cutoff will not be streamed until its projected size reaches the cutoff.

Parameters

nodeId: number

ID of the node to link the sub tree with. This ID should not have a type of Body or BodyInstance. If this parameter is null, the sub tree will be linked to the root. This method will trigger a subtreeLoaded event.

xmlData: (string | Document)

XML document or XML document string.

modelNameToScs: (None | ModelNameToScsFileFunc)

Optional callback to massage model names within the XML file to SCS file URLS or SCS file buffers. Return null to skip the model.

additionalMatrix: (None | Matrix)

Optional matrix to get multiplied into the net attachment matrix.

allowMissingExternalModels: boolean

Optional boolean to control whether or not missing models in the XML file are ignored or cause an error.

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs that will resolve when all files have been loaded.
Model.loadSubtreeFromScsXmlFile()
loadSubtreeFromScsXmlFile(nodeId: number, xmlFilename: string, modelNameToScs: (None | ModelNameToScsFileFunc), config: LoadSubtreeConfig): Promise

Loads the tree stored in the XML and query loading of required meshes Load order is determined by the projected size of bounding information present in the XML. If streamCutoffScale is set to a non zero value, a file whose projected size is lower than the cutoff will not be streamed until its projected size reaches the cutoff.

Parameters

nodeId: number

ID of the node to link the sub tree with. This ID should not have a type of Body or BodyInstance. If this parameter is null, the sub tree will be linked to the root. This method will trigger a subtreeLoaded event.

xmlFilename: string

URL of XML file to load.

modelNameToScs: (None | ModelNameToScsFileFunc)

Optional callback to massage model names within the XML file to SCS file URLS or SCS file buffers. Return null to skip the model.

config: LoadSubtreeConfig

Configuration to control load behavior.

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs that will resolve when all files have been loaded.
loadSubtreeFromScsXmlFile(nodeId: number, xmlFilename: string, modelNameToScs: (None | ModelNameToScsFileFunc), additionalMatrix: (None | Matrix), allowMissingExternalModels: boolean): Promise

Loads the tree stored in the XML and query loading of required meshes Load order is determined by the projected size of bounding information present in the XML. If streamCutoffScale is set to a non zero value, a file whose projected size is lower than the cutoff will not be streamed until its projected size reaches the cutoff.

Parameters

nodeId: number

ID of the node to link the sub tree with. This ID should not have a type of Body or BodyInstance. If this parameter is null, the sub tree will be linked to the root. This method will trigger a subtreeLoaded event.

xmlFilename: string

URL of XML file to load.

modelNameToScs: (None | ModelNameToScsFileFunc)

Optional callback to massage model names within the XML file to SCS file URLS or SCS file buffers. Return null to skip the model.

additionalMatrix: (None | Matrix)

Optional matrix to get multiplied into the net attachment matrix.

allowMissingExternalModels: boolean

Optional boolean to control whether or not missing models in the XML file are ignored or cause an error.

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs that will resolve when all files have been loaded.
Model.loadSubtreeFromXmlBuffer()
loadSubtreeFromXmlBuffer(nodeId: number, xmlData: (string | Document), massageModelName: (None | MassageModelNameFunc), config: LoadSubtreeConfig): Promise

Loads the tree stored in the XML and query loading of required meshes

Parameters

nodeId: number

ID of the node to link the sub tree with. This ID should not have a type of Body or BodyInstance. If this parameter is null, the sub tree will be linked to the root. This method will trigger a subtreeLoaded event.

xmlData: (string | Document)

XML document or XML document string.

massageModelName: (None | MassageModelNameFunc)

Optional callback to massage model names within the XML file. Return null to skip the model.

config: LoadSubtreeConfig

Configuration to control load behavior.

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs.
loadSubtreeFromXmlBuffer(nodeId: number, xmlData: (string | Document), massageModelName: (None | MassageModelNameFunc), additionalMatrix: (None | Matrix), allowMissingExternalModels: boolean): Promise

Loads the tree stored in the XML and query loading of required meshes

Parameters

nodeId: number

ID of the node to link the sub tree with. This ID should not have a type of Body or BodyInstance. If this parameter is null, the sub tree will be linked to the root. This method will trigger a subtreeLoaded event.

xmlData: (string | Document)

XML document or XML document string.

massageModelName: (None | MassageModelNameFunc)

Optional callback to massage model names within the XML file. Return null to skip the model.

additionalMatrix: (None | Matrix)

Optional matrix to get multiplied into the net attachment matrix.

allowMissingExternalModels: boolean

Optional boolean to control whether or not missing models in the XML file are ignored or cause an error.

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs.
Model.loadSubtreeFromXmlFile()
loadSubtreeFromXmlFile(nodeId: number, xmlFilename: string, massageModelName: (None | MassageModelNameFunc), config: LoadSubtreeConfig): Promise

Loads the tree stored in the XML and query loading of required meshes

Parameters

nodeId: number

ID of the node to link the sub tree with. This ID should not have a type of Body or BodyInstance. If this parameter is null, the sub tree will be linked to the root. This method will trigger a subtreeLoaded event.

xmlFilename: string

URL of XML file to load.

massageModelName: (None | MassageModelNameFunc)

Optional callback to massage model names within the XML file. Return null to skip the model.

config: LoadSubtreeConfig

Configuration to control load behavior.

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs.
loadSubtreeFromXmlFile(nodeId: number, xmlFilename: string, massageModelName: (None | MassageModelNameFunc), additionalMatrix: (None | Matrix), allowMissingExternalModels: boolean): Promise

Loads the tree stored in the XML and query loading of required meshes

Parameters

nodeId: number

ID of the node to link the sub tree with. This ID should not have a type of Body or BodyInstance. If this parameter is null, the sub tree will be linked to the root. This method will trigger a subtreeLoaded event.

xmlFilename: string

URL of XML file to load.

massageModelName: (None | MassageModelNameFunc)

Optional callback to massage model names within the XML file. Return null to skip the model.

additionalMatrix: (None | Matrix)

Optional matrix to get multiplied into the net attachment matrix.

allowMissingExternalModels: boolean

Optional boolean to control whether or not missing models in the XML file are ignored or cause an error.

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs.
Model.registerBimNodes()
registerBimNodes(startNodeId: number, attributeToMask: (value: string) => BimMask, legacy_useAttributeTitle: (None | string | boolean)?): Promise

This function recursively discovers BIM nodes in the supplied subtree and registers them.

Parameters

startNodeId: number

The root of the subtree to walk for registration.

attributeToMask: (value: string) => BimMask

The callback used to obtain a node’s [[BimMask]] from its attributes.

legacy_useAttributeTitle: (None | string | boolean) = null

Returns: Promise

Promise that resolves when the operation has completed.
Model.registerIfcNodes()
registerIfcNodes(startNodeId: number, legacy_useAttributeTitle: (None | string | boolean)?): Promise

This function recursively discovers IFC nodes in the supplied subtree and registers them.

Parameters

startNodeId: number

The root of the subtree to walk for registration.

legacy_useAttributeTitle: (None | string | boolean) = null

Returns: Promise

Promise that resolves when the operation has completed.
Model.replaceMesh()
replaceMesh(id: MeshId, data: MeshData): Promise

Replace a mesh’s data. This will affect all instances of that mesh.

Parameters

id: MeshId

data: MeshData

the new data

Returns: Promise

Model.requestNodes()
requestNodes(nodeIds: number[]): Promise

Specifies nodes for the system to load. This method is useful when the viewer was created with the <code>streamOnDemand</code> option set to true.

Parameters

nodeIds: number[]

array of unique IDs for the system to load

Returns: Promise

Model.reset()
reset(): Promise

Resets the state of the model to its default

Returns: Promise

Promise that resolves when the operation has completed.
Model.resetModelHighlight()
resetModelHighlight(): Promise

Resets highlight for all nodes in the model.

Returns: Promise

Promise that resolves when this operation has completed.
Model.resetModelOpacity()
resetModelOpacity(): void

Resets opacity for all nodes in the model.

Returns: void

Promise that resolves when this operation has completed.
Model.resetNodeMatrixToInitial()
resetNodeMatrixToInitial(nodeId: number): Promise

Reset node matrix to the one set as the initial one

Parameters

nodeId: number

Returns: Promise

Model.resetNodesColor()
resetNodesColor(): Promise

Resets color for all nodes in the model.

Returns: Promise

Promise that resolves when this operation has completed.
Model.resetNodesMaterial()
resetNodesMaterial(nodeIds: number[], params: keyof IMaterial[]): void

Resets material properties for a given list of nodes to their default values.

Parameters

nodeIds: number[]

IDs of nodes whose material properties to reset

params: keyof IMaterial[]

optional array of specific material parameters to reset. If not provided, all material properties will be reset.

Returns: void

Model.resetNodesOpacity()
resetNodesOpacity(nodeIds: number[]): void

Resets opacity for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose opacity will be reset to their default values

Returns: void

Model.resetNodesTransform()
resetNodesTransform(): Promise

Resets transform for all nodes in the model.

Returns: Promise

Promise that resolves when the operation has completed.
Model.resetNodesVisibility()
resetNodesVisibility(): Promise

Resets visibility for all nodes in the model.

Returns: Promise

Promise that resolves when the operation has completed.
Model.setBehaviorInitiallyHidden()
setBehaviorInitiallyHidden(enabled: boolean): void

By default, objects that are initially hidden stays hidden unless specifically set to be shown. This function allows this behavior to be disabled.

Parameters

enabled: boolean

value indicating if initially hidden objects stay hidden

Returns: void

Model.setBodyNodesVisibility()
setBodyNodesVisibility(startNodeId: number, visibility: boolean): Promise

Sets the visibility of all body nodes starting from a given node.

Parameters

startNodeId: number

The start node to walk when updating body nodes visibility.

visibility: boolean

If true, nodes will be shown. If false, they will be hidden.

Returns: Promise

Promise that resolves when the operation has completed.
setBodyNodesVisibility(startNodeId: number, visibilityFormatter: (node: number) => (undefined | boolean)): Promise

Sets the visibility of all body nodes starting from a given node.

Parameters

startNodeId: number

The start node to walk when updating body nodes visibility.

visibilityFormatter: (node: number) => (undefined | boolean)

A function that returns the visibility for a given node id

Returns: Promise

Promise that resolves when the operation has completed.
Model.setDepthRange()
setDepthRange(nodeIds: number[], min: number, max: number): Promise

Remaps the depth values used for z-ordering of pixels to the given range, which must be a subset of [0,1]. The depth value at the near plane (normally 0) is mapped to min and the value at the far plane (normally 1) is mapped to max.

The smaller the range, the more z-fighting you will see among objects set to that range.

Parameters

nodeIds: number[]

the node IDs to operate on

min: number

the depth value at the near plane

max: number

the depth value at the far plane

Returns: Promise

Model.setEdgeProperty()
setEdgeProperty(nodeId: number, edgeId: number, prop: Base): void

Set edge property for a node of the given node and edge.

Parameters

nodeId: number

edgeId: number

prop: Base

property (CircleElement, LineElement…)

Returns: void

Model.setEnableAutomaticUnitScaling()
setEnableAutomaticUnitScaling(enabled: boolean): void

If enabled then models loaded into an existing scene with a different unit value will be scaled to the unit value of the current scene.

Parameters

enabled: boolean

value indicating if automatic unit scaling will be active

Returns: void

Model.setFaceProperty()
setFaceProperty(nodeId: number, faceId: number, prop: Base): void

Set face property for a node of the given node and face.

Parameters

nodeId: number

faceId: number

prop: Base

property (CylinderElement, PlaneElement…)

Returns: void

Model.setInstanceModifier()
setInstanceModifier(instanceModifier: InstanceModifier, nodeIds: number[], value: boolean): Promise

Allows changing the behavior in the viewer

Parameters

instanceModifier: InstanceModifier

InstanceModifier

nodeIds: number[]

Array of node ids

value: boolean

boolean

Returns: Promise

Model.setMeshLevel()
setMeshLevel(nodeIds: number[], meshLevel: number): Promise

Sets the desired mesh level

Parameters

nodeIds: number[]

IDs of nodes in the assembly on which mesh level will be set

meshLevel: number

0 standard, 1 low, 2 extra low

Returns: Promise

Promise that resolves when the operation has completed.
Model.setMetallicRoughness()
setMetallicRoughness(nodeIds: number[], metallicFactor: number, roughnessFactor: number): void

Sets the metallic and roughness factors for the supplied nodes materials. Materials that are not currently set to use the Metallic Roughness shading model will be upgraded to use this mode.

Parameters

nodeIds: number[]

List of nodes to set material properties for

metallicFactor: number

The metalness of the material

roughnessFactor: number

The roughness of the material

Returns: void

Model.setNodeFaceColor()
setNodeFaceColor(partId: number, faceId: number, color: Color): Promise

Sets the color for a face element. This color will take precedence over any currently set color on the node

Parameters

partId: number

faceId: number

the Id of the face in the node that will have its color set

color: Color

the color to set

Returns: Promise

Model.setNodeFaceHighlighted()
setNodeFaceHighlighted(nodeId: number, faceId: number, highlighted: boolean): Promise

Sets whether the face element for a given node should appear highlighted. When a face element is highlighted, the highlight color will override any color previously set on the element.

Parameters

nodeId: number

the id for the node containing the face element.

faceId: number

the face Id that is the target of this operation.

highlighted: boolean

value indicating whether the supplied face element should be highlighted.

Returns: Promise

Model.setNodeFaceVisibility()
setNodeFaceVisibility(partId: number, faceId: number, visibility: boolean): void

Sets the visibility for a face element. This visibility setting will take precedence over other element visibility settings

Parameters

partId: number

the Id of the part containing the face

faceId: number

the Id of the face in the node that will have its visibility set

visibility: boolean

visibility state to be set

Returns: void

Model.setNodeLineColor()
setNodeLineColor(partId: number, lineId: number, color: Color): Promise

Sets the color for a line element.

Parameters

partId: number

lineId: number

the Id of the line in the node that will have its color set.

color: Color

the color to set.

Returns: Promise

Model.setNodeLineHighlighted()
setNodeLineHighlighted(partId: number, lineId: number, highlighted: boolean): Promise

Sets whether the line element for a given node should appear highlighted. When a line element is highlighted, the highlight color will override any color previously set on the element.

Parameters

partId: number

lineId: number

the line Id that is the target of this operation.

highlighted: boolean

value indicating whether the supplied line element should be highlighted.

Returns: Promise

Model.setNodeLineVisibility()
setNodeLineVisibility(partId: number, lineId: number, visibility: boolean): void

Sets the visibility for a line element. This visibility setting will take precedence over other element visibility settings

Parameters

partId: number

the Id of the part containing the line

lineId: number

the Id of the line in the node that will have its visibility set

visibility: boolean

visibility state to be set

Returns: void

Model.setNodeMatrix()
setNodeMatrix(nodeId: number, matrix: Matrix, setAsInitial: boolean?): Promise

Sets Matrix for a node of the given ID

Parameters

nodeId: number

matrix: Matrix

setAsInitial: boolean = false

tells if you want to change the node initial matrix or not

Returns: Promise

Model.setNodePointColor()
setNodePointColor(partId: number, pointId: number, color: Color): void

Sets the color for a point element.

Parameters

partId: number

the Id of the node containing the point.

pointId: number

the Id of the point in the node that will have its color set.

color: Color

the color to set.

Returns: void

Model.setNodePointHighlighted()
setNodePointHighlighted(partId: number, pointId: number, highlighted: boolean): Promise

Sets whether the point element for a given node should appear highlighted. When a point element is highlighted, the highlight color will override any color previously set on the element.

Parameters

partId: number

pointId: number

the point Id that is the target of this operation.

highlighted: boolean

value indicating whether the supplied point element should be highlighted.

Returns: Promise

Model.setNodePointVisibility()
setNodePointVisibility(partId: number, pointId: number, visibility: boolean): void

Sets the visibility for a point element. This visibility setting will take precedence over other element visibility settings

Parameters

partId: number

the Id of the part containing the point

pointId: number

the Id of the point in the node that will have its visibility set

visibility: boolean

visibility state to be set

Returns: void

Model.setNodesAmbientColor()
setNodesAmbientColor(nodeIds: number[], color: Color): void

Sets the ambient color on the faces for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose color to set

color: Color

the color to set

Returns: void

Model.setNodesAmbientMix()
setNodesAmbientMix(nodeIds: number[], value: number): void

Sets the ambient mix on the faces for a given list of nodes. The mix is between the material ambient light and the global ambient light, with 1.0 representing full material ambient mix and 0.0 representing full global ambient light.

Parameters

nodeIds: number[]

IDs of nodes whose color to set

value: number

the decimal value to set, between 0 and 1

Returns: void

Model.setNodesColors()
setNodesColors(colorMap: (Map | IdColorMap), alsoApplyToWireframe: boolean?, alsoApplyToPoints: boolean?): Promise

Sets colors for a given set of nodes.

Parameters

colorMap: (Map | IdColorMap)

alsoApplyToWireframe: boolean = false

change or not lines color

alsoApplyToPoints: boolean = false

change or not points color

Returns: Promise

Promise that resolves when this operation has completed.
Model.setNodesCullingVector()
setNodesCullingVector(nodeIds: number[], space: CullingVectorSpace, vector: Point3, toleranceDegrees: number): Promise

Sets a vector and angle used to determine an object’s visibility based on camera orientation.

Parameters

nodeIds: number[]

space: CullingVectorSpace

The space in which the culling vector is defined.

vector: Point3

A vector that will be compared with the view vector.

toleranceDegrees: number

The maximum angle between the culling vector and the view vector within which the object will be visible.

Returns: Promise

Model.setNodesDrawModes()
setNodesDrawModes(nodesDrawModes: Record): void

Set the draw modes for the given node ids. Given nodes will be drawn according to their specified draw modes, overriding draw mode of the view. Only leaf nodes attached to a body can have overriden draw mode. If other nodes are passed, the draw mode will be applied recursively to the children and grand children which are attached to a body.

Parameters

nodesDrawModes: Record

A record mapping node ids to their desired draw modes.

Returns: void

Model.setNodesFaceColor()
setNodesFaceColor(nodeIds: number[], color: Color): Promise

Sets the color on the faces for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose color to set

color: Color

the color to set

Returns: Promise

Promise that resolves when this operation has completed.
Model.setNodesFaceEmissiveColor()
setNodesFaceEmissiveColor(nodeIds: number[], color: Color): void

Sets the emissive color on the faces for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose color to set

color: Color

the color to set

Returns: void

Model.setNodesFaceSpecularColor()
setNodesFaceSpecularColor(nodeIds: number[], color: Color): void

Sets the specular color on the faces for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose color to set

color: Color

the color to set

Returns: void

Model.setNodesFaceSpecularIntensity()
setNodesFaceSpecularIntensity(nodeIds: number[], value: number): void

Sets the specular intensity on the faces for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose color to set

value: number

the value to set

Returns: void

Model.setNodesHighlighted()
setNodesHighlighted(partIds: number[], highlighted: boolean): Promise

Sets whether the supplied nodes should appear highlighted. When a node is highlighted, the highlight color will override any color previously set on the model.

Tip: An easy way to unhighlight the entire model is to call [[setNodesHighlighted]] on the root node of the model:

hwv.model.setNodesHighlighted([hwv.model.getAbsoluteRootNode()], false);

(In this case, hwv is your instance of [[WebViewer]].)

Parameters

partIds: number[]

highlighted: boolean

value indicating whether the supplied nodes should be highlighted.

Returns: Promise

Promise that resolves when this operation has completed.
Model.setNodesLineColor()
setNodesLineColor(nodeIds: number[], color: Color): Promise

Sets the color on the lines/edges for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose color to set

color: Color

the color to set

Returns: Promise

Promise that resolves when this operation has completed.
Model.setNodesLinePattern()
setNodesLinePattern(nodeIds: number[], pattern: LinePattern, patternLength: number, patternLengthUnit: LinePatternLengthUnit): void

Applies the given line pattern to the specified nodes. See also [[unsetNodesLinePattern]].

Parameters

nodeIds: number[]

The IDs of the nodes.

pattern: LinePattern

The line pattern. See [[LinePattern]] for details.

patternLength: number

The length of a single repetition of the line pattern.

patternLengthUnit: LinePatternLengthUnit

The unit in which the length of the pattern is measured. See [[LinePatternLengthUnit]] for details.

Returns: void

Model.setNodesMaterial()
setNodesMaterial(nodeIds: number[], material: IMaterial): void

Sets material properties for a given list of nodes. Any properties not defined in the provided material will be left as-is.

Parameters

nodeIds: number[]

IDs of nodes whose material properties to set

material: IMaterial

the material properties to apply

Returns: void

Model.setNodesOpacities()
setNodesOpacities(params: (Map | IdNumberMap)): void

Sets opacity for a given set of nodes.

Parameters

params: (Map | IdNumberMap)

object mapping node IDs to opacity to set for that NodeId. The opacity value should be between the range of 0.0 and 1.0. 0.0 indicates fully transparent, while 1.0 is fully opaque.

Returns: void

Model.setNodesOpacity()
setNodesOpacity(nodeIds: number[], opacity: number): void

Sets opacity for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose opacity will be set

opacity: number

opacity value to apply to each node. The value should be between the range of 0.0 and 1.0. 0.0 indicates fully transparent, while 1.0 is fully opaque.

Returns: void

Model.setNodesPointColor()
setNodesPointColor(nodeIds: number[], color: Color): void

Sets the color on the points for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose color to set

color: Color

Returns: void

Promise that resolves when this operation has completed.
Model.setNodesTexture()
setNodesTexture(nodeIds: number[], options: TextureOptions): Promise

Apply an image to a node as a texture map. See [[createImage]] and [[unsetNodesTexture]].

Parameters

nodeIds: number[]

The nodes on which to apply the texture

options: TextureOptions

Options specifying how the texture is applied

Returns: Promise

Model.setNodesVisibilities()
setNodesVisibilities(mapping: (Map | IdBooleanMap), initiallyHiddenStayHidden: (None | boolean)?): Promise

Sets the visibility for a given set of nodes.

Parameters

mapping: (Map | IdBooleanMap)

The mapping of node IDs to boolean value indicating the visibility setting for that node.

initiallyHiddenStayHidden: (None | boolean) = null

Controls whether or not initially hidden geometries stay hidden. Default behavior is driven by [[setBehaviorInitiallyHidden]].

Returns: Promise

Promise that resolves when the operation has completed.
Model.setNodesVisibility()
setNodesVisibility(nodeIds: number[], visibility: boolean, initiallyHiddenStayHidden: (None | boolean)?): Promise

Sets visibility for a given list of nodes.

Parameters

nodeIds: number[]

The node IDs whose visibilities will be set.

visibility: boolean

If true, nodes will be shown. If false, they will be hidden.

initiallyHiddenStayHidden: (None | boolean) = null

Controls whether or not initially hidden geometries stay hidden. Default behavior is driven by [[setBehaviorInitiallyHidden]].

Returns: Promise

Promise that resolves when the operation has completed.
Model.setPart()
setPart(assemblyNodeId: (undefined | None | number), partNodeId: (undefined | None | number)): boolean

Set a part on an assembly node

Parameters

assemblyNodeId: (undefined | None | number)

partNodeId: (undefined | None | number)

Returns: boolean

true if all went right, false otherwise
Model.setPhysicalProperties()
setPhysicalProperties(nodeId: number, gravityCenter: Point3, surfaceArea: number, volume: number): boolean

Purpose: Sets physical properties

Parameters

nodeId: number

gravityCenter: Point3

surfaceArea: number

volume: number

Returns: boolean

true if all went right, false otherwise
Model.setPmiColor()
setPmiColor(color: Color): void

Saves a PMI override color

Parameters

color: Color

the override color

Returns: void

Model.setPmiColorOverride()
setPmiColorOverride(enableOverride: boolean, rootId: number): Promise

Takes a boolean value and either enables the set PMI override color or resets all PMI colors to their default

Parameters

enableOverride: boolean

rootId: number

Returns: Promise

Promise that resolves when this operation has completed.
Model.setViewAxes()
setViewAxes(frontVector: Point3, upVector: Point3): void

Sets the up and front vectors for the model coordinate system. Both the upVector and frontVector must be unique, cardinal axes.

Parameters

frontVector: Point3

upVector: Point3

Returns: void

Model.switchToModel()
switchToModel(newModelFilename: string): Promise

Delete all the current scene and load the specified model instead. Also triggers a “modelSwitched” when finished.

Parameters

newModelFilename: string

Name of the model file to load after the existing scene gets deleted

Returns: Promise

A Promise of the newly loaded model’s root nodes IDs.
Model.triangulatePolygon()
triangulatePolygon(polygonPoints: (number[] | Float32Array), normal: Point3): Float32Array

Triangulates the supplied polygon.

Parameters

polygonPoints: (number[] | Float32Array)

An array of point data for the polygon. Points are stored [XYZXYZXYZ…] format.

normal: Point3

The normal of the polygon to triangulate.

Returns: Float32Array

An array containing the point data for the generated triangles. Points are stored [XYZXYZXYZ…] format. This returned list is always divisible by 9 (3 points per triangle; 3 floats per point).
Model.unsetDepthRange()
unsetDepthRange(nodeIds: number[]): void

Unsets the depth range set by [[setDepthRange]].

Parameters

nodeIds: number[]

the node IDs to operate on

Returns: void

Model.unsetMetallicRoughness()
unsetMetallicRoughness(nodeIds: number[]): void

Unsets the metallic and roughness values set with [[setMetallicRoughness]] These materials will no longer use the Metallic Roughness shading model.

Parameters

nodeIds: number[]

List of nodes to unset material properties for

Returns: void

Model.unsetNodeFaceColor()
unsetNodeFaceColor(partId: number, faceId: number): Promise

Unsets the color for a face element. This will return the face’s color to its default state.

Parameters

partId: number

faceId: number

the Id of the face in the node that will have its color unset

Returns: Promise

Model.unsetNodeLineColor()
unsetNodeLineColor(partId: number, lineId: number): Promise

Unsets the color for a line element. This will return the line’s color to its default state.

Parameters

partId: number

lineId: number

the Id of the line in the node that will have its color unset

Returns: Promise

Model.unsetNodePointColor()
unsetNodePointColor(partId: number, pointId: number): void

Unsets the color for a point element. This will return the point’s color to its default state.

Parameters

partId: number

the Id of the node containing the point

pointId: number

the Id of the point in the node that will have its color unset

Returns: void

Model.unsetNodesAmbientColor()
unsetNodesAmbientColor(nodeIds: number[]): void

Unsets the ambient color on the faces for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose color to unset

Returns: void

Model.unsetNodesCullingVectors()
unsetNodesCullingVectors(nodeIds: number[]): Promise

Unsets the vector and angle used to determine an object’s visibility based on camera orientation.

Parameters

nodeIds: number[]

The nodes to unset culling vectors on.

Returns: Promise

Model.unsetNodesFaceColor()
unsetNodesFaceColor(nodeIds: number[]): Promise

Unsets the color on the faces for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes to modify

Returns: Promise

Promise that resolves when this operation has completed.
Model.unsetNodesFaceEmissiveColor()
unsetNodesFaceEmissiveColor(nodeIds: number[]): void

Resets the emissive color on the faces for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose color to reset

Returns: void

Model.unsetNodesFaceSpecularColor()
unsetNodesFaceSpecularColor(nodeIds: number[]): void

Resets the specular color on the faces for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose color to reset

Returns: void

Model.unsetNodesFaceSpecularIntensity()
unsetNodesFaceSpecularIntensity(nodeIds: number[]): void

Resets the specular intensity on the faces for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes whose color to set

Returns: void

Model.unsetNodesLineColor()
unsetNodesLineColor(nodeIds: number[]): Promise

Unsets the color on the lines for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes to modify

Returns: Promise

Promise that resolves when this operation has completed.
Model.unsetNodesLinePattern()
unsetNodesLinePattern(nodeIds: number[]): void

Removes the line pattern applied by [[setNodesLinePattern]].

Parameters

nodeIds: number[]

The IDs of the nodes.

Returns: void

Model.unsetNodesPointColor()
unsetNodesPointColor(nodeIds: number[]): void

Unsets the color on the points for a given list of nodes.

Parameters

nodeIds: number[]

IDs of nodes to modify

Returns: void

Model.unsetNodesTexture()
unsetNodesTexture(nodeIds: number[]): void

Remove one or more textures applied via [[setNodesTexture]].

Parameters

nodeIds: number[]

The nodes from which to remove the texture or textures

Returns: void

Model.viewAxesHaveBeenSet()
viewAxesHaveBeenSet(): boolean

Gets whether there has been a successful call to setViewAxes.

Returns: boolean