Model

class Communicator.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.

Methods


Methods

activateCADConfiguration

Model.activateCADConfiguration(nodeId)
Deprecated

Use activateCadConfiguration instead.

Arguments
Return type

Promise <void>

activateCADDefaultConfiguration

Model.activateCADDefaultConfiguration()
Deprecated

Use activateDefaultCadConfiguration instead.

Return type

Promise <void>

activateCADView

Model.activateCADView(nodeId[, duration])
Deprecated

Use activateCadView instead.

Arguments
  • nodeId (NodeId) –

  • duration (number()) – optional

Return type

Promise <void>

activateCadConfiguration

Model.activateCadConfiguration(nodeId)

Activates a CAD configuration

Arguments
Return type

Promise <void>

Returns

None.

activateCadView

Model.activateCadView(nodeId[, duration[, massageCamera]])

Activates a CAD View

Arguments
  • nodeId (NodeId) –

  • duration (number()) – optional camera transition time in milliseconds.

  • massageCamera (boolean()) – optional If true, undesirable authored cameras may be modified into a camera with more reasonable values

Return type

Promise <void>

Returns

None.

activateDefaultCadConfiguration

Model.activateDefaultCadConfiguration([fitNodes])

Activates Default CAD configuration

Arguments
  • fitNodes (boolean()) – optional Fit view to visible nodes if possible (default true)

Return type

Promise <void>

Returns

None.

activateDefaultCadView

Model.activateDefaultCadView([duration[, massageCamera]])

Activate the default CAD view

Arguments
  • duration (number()) – optional Duration of the camera animation

  • massageCamera (boolean()) – optional If true, undesirable authored cameras may be modified into a camera with more reasonable values

Return type

Promise <void>

Returns

None.

addPropertyToNode

Model.addPropertyToNode(nodeId, propertyName, propertyValue, propertyUnit)

Purpose: Adds a property to the node

Arguments
  • nodeId (NodeId) – node id to set the property on

  • propertyName (string()) –

  • propertyValue (string()) –

  • propertyUnit ([UnitElement()]) –

Return type

boolean

Returns

true if all went right, false otherwise

cadConfigurationsEnabled

Model.cadConfigurationsEnabled()

Gets whether or not cad configurations are enabled

Return type

Promise <boolean>

Returns

Boolean indicating whether or not cad configurations are enabled

clear

Model.clear()

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.

Return type

Promise <void>

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.

clearNodeFaceVisibility

Model.clearNodeFaceVisibility(partId)

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

Arguments
  • partId (PartId) – the Id of the part to be reset

Return type

void

clearNodeLineVisibility

Model.clearNodeLineVisibility(partId)

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

Arguments
  • partId (PartId) – the Id of the part to clear visibilities from

Return type

void

clearNodePointVisibility

Model.clearNodePointVisibility(partId)

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

Arguments
  • partId (PartId) – the Id of the part to clear visibilities from

Return type

void

computeMinimumBodyBodyDistance

Model.computeMinimumBodyBodyDistance(partId1, partId2)

Computes the distance between two bodies

Arguments
  • partId1 (PartId) – id for the part which the first face belongs to

  • partId2 (PartId) – id for the part which the second face belongs to

Return type

Promise <FaceFaceDistanceItem()>

Returns

a promise that resolves with a Markup.Measure.FaceFaceDistanceItem when the operation completes

computeMinimumFaceFaceDistance

Model.computeMinimumFaceFaceDistance(partId1, faceId1, partId2, faceId2)

Computes the distance between two faces

Arguments
  • partId1 (PartId) – id for the part which the first face belongs to

  • faceId1 (number()) – id for the face in the first part

  • partId2 (PartId) – id for the part which the second face belongs to

  • faceId2 (number()) – id for the face in the second part

Return type

Promise <FaceFaceDistanceItem()>

Returns

a promise that resolves with a Markup.Measure.FaceFaceDistanceItem when the operation completes

computeMinimumFaceLineDistance

Model.computeMinimumFaceLineDistance(partId, faceId, ray)

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

Arguments
  • partId (PartId) –

  • faceId (number()) – id of the face in the node

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

Return type

Promise <FaceFaceDistanceItem()>

Returns

a promise that resolves with a Markup.Measure.FaceFaceDistanceItem when the operation completes

computeMinimumFaceRayDistance

Model.computeMinimumFaceRayDistance(partId, faceId, ray)

Computers the minimum distance between a face and a ray.

Arguments
  • partId (PartId) –

  • faceId (number()) – id of the face in the node

  • ray (Ray()) – the ray to test against

Return type

Promise <FaceFaceDistanceItem()>

Returns

a promise that resolves with a Markup.Measure.FaceFaceDistanceItem when the operation completes

createAndAddBody

Model.createAndAddBody(partNodeId[, repItemId])
Deprecated

Use createAndAddRepresentationItem instead.

Arguments
  • partNodeId (PartId | undefined | null) –

  • repItemId (NodeId | null) – optional

Return type

NodeId | null

createAndAddRepresentationItem

Model.createAndAddRepresentationItem(partNodeId[, repItemId])

Creates a representation item on a part

Arguments
  • partNodeId (PartId | undefined | null) – ID of the part node

  • repItemId (NodeId | null) – optional (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.

Return type

NodeId | null

Returns

node ID to access the created representation item, null is returned if something went wrong

createCADView

Model.createCADView(nodeId, viewName, camera[, pmiIds[, nodesToShow[, nodesToHide[, nodesIdAndLocalTransforms[, cuttingPlane[, meshInstanceData]]]]]])
Deprecated

Use createCadView instead.

Arguments
Return type

CadViewId | null

createCadView

Model.createCadView(nodeId, viewName, camera[, pmiIds[, nodesToShow[, nodesToHide[, nodeIdsAndLocalTransforms[, cuttingPlane[, meshInstanceData]]]]]])

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

Arguments
  • nodeId (NodeId) –

  • viewName (string()) – Name of the view

  • camera (Camera()) – Camera that will be set when the view gets activated

  • pmiIds ([PmiId] | null) – optional (optional, pass null or empty array if none to send) Node IDs of the PMI to show for the view

  • nodesToShow ([NodeId] | null) – optional (optional, pass null or empty array if none to send) Node IDs of the elements to force visibility on

  • nodesToHide ([NodeId] | null) – optional (optional, pass null or empty array if none to send) Node IDs of the elements to force visibility off

  • nodeIdsAndLocalTransforms ([(NodeId, Matrix())] | null) – optional (optional, pass null or empty array if none to send) array of node ID and matrix pair, defining specific local transform to apply

  • cuttingPlane (Plane() | null) – optional (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 (MeshInstanceData() | null) – optional (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)

Return type

CadViewId | null

Returns

id of the view, null is returned if the function fails

createImage

Model.createImage(primaryImage[, thumbnailImage])

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

Arguments
  • primaryImage (ImageOptions()) – The image data and associated options

  • thumbnailImage (ImageOptions()) – optional 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.

Return type

Promise <ImageId>

createMesh

Model.createMesh(meshData[, config])
Arguments
  • meshData (MeshData()) – MeshData object containing data to insert into the scene.

  • config (function()) – optional

Return type

Promise <MeshId>

Returns

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

createMeshInstance

Model.createMeshInstance(data[, parentNodeId[, preventFromResetting[, isOutOfHierarchy]]])

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

Arguments
  • data (MeshInstanceData()) – object that specifies the data for this mesh instance

  • parentNodeId (NodeId | null) – optional the ID of the desired parent node

  • preventFromResetting (boolean | null()) – optional if set to true, then the visibility and positioning won’t be reset when resetxxx() functions gets called.

  • isOutOfHierarchy (boolean | null()) – optional True if the node created shouldn’t appear in the model structure.

Return type

Promise <NodeId>

Returns

Promise that resolves with a node ID that can be used to perform operations on this instance.

createNode

Model.createNode(parentNodeId, nodeName[, nodeId[, localMatrix[, visibility[, measurementUnit]]]])

Creates a node

Arguments
  • parentNodeId (NodeId | undefined | null) – 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 (NodeId | null) – optional

  • localMatrix (Matrix() | null) – optional (optional) Initial local matrix of the node (identity if none set)

  • visibility (boolean | null()) – optional (optional) Initial visibility of the node (visible if nothing set)

  • measurementUnit (number | null()) – optional

Return type

NodeId

Returns

child node ID

createPMIInstance

Model.createPMIInstance(data, pmiType, pmiSubType, refOnTopoItems[, parentNodeId])
Deprecated

Use createPmiInstance instead.

Arguments
Return type

Promise <PmiId>

createPart

Model.createPart([nodeId])

Creates an part node

Arguments
  • nodeId (NodeId | null) – optional

Return type

PartId

Returns

a node ID to access the created part node

createPmiInstance

Model.createPmiInstance(data, pmiType, pmiSubType, refOnTopoItems[, parentNodeId])

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

Arguments
  • 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 (NodeId | null) – optional the ID of the desired parent node

Return type

Promise <PmiId>

Returns

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

deleteImages

Model.deleteImages(imageIds)

Deletes images created with createImage

Arguments
  • imageIds ([ImageId]) – The IDs of the images to be deleted

Return type

Promise <void>

deleteMeshInstances

Model.deleteMeshInstances(nodeIds)

Deletes mesh instances that have been created at run time

Arguments
  • nodeIds ([NodeId]) – array of IDs for mesh instances created at run time that should be destroyed

Return type

Promise <void>

Returns

Promise that resolves when this operation has completed.

deleteMeshes

Model.deleteMeshes(ids)

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

Arguments
Return type

Promise <void>

Returns

Promise that resolves when this operation has completed.

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

deleteNode

Model.deleteNode(nodeId)

Delete a node and all its children

Arguments
Return type

Promise <void>

getAbsoluteRootNode

Model.getAbsoluteRootNode()

Returns the absolute root node of the assembly tree.

Return type

NodeId

Returns

Id for the model tree root node or null if the model structure is not loaded.

getActiveCadConfiguration

Model.getActiveCadConfiguration()

Gets Active CAD configuration

Return type

NodeId | null

Returns

ID of activated CAD Configuration

getAssociatedModelKey

Model.getAssociatedModelKey(nodeId)
Arguments
Return type

Promise <SC.ModelKey | null>

getBimIdConnectedElements

Model.getBimIdConnectedElements(node, bimId, type)

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

Arguments
  • node (NodeId) – any known node id of the working model.

  • bimId (BimId) – bim id for which you want its relationships.

  • type (RelationshipType) –

Return type

function

Returns

double array of bim id of relationship of the BimId sorted by its relateds and its relatings.

getBimIdFromNode

Model.getBimIdFromNode(node)

Retrieves the bim id of the corresponding node id.

Arguments
  • node (NodeId) – the id of the node for which you want its bim id.

Return type

BimId | null

Returns

the bim id corresponding to the node or null if none.

getBimIdRelatedElements

Model.getBimIdRelatedElements(node, bimId, type)

Retrieve all related relationships that a bim id have.

Arguments
  • node (NodeId) – any known node id of the working model.

  • bimId (BimId) – bim id for which you want its related relationships.

  • type (RelationshipType) –

Return type

[BimId]

Returns

array of bim id which are the related relationship of the BimId.

getBimIdRelatingElements

Model.getBimIdRelatingElements(node, bimId, type)

Retrieve all relating relationships that a bim id have.

Arguments
  • node (NodeId) – any known node id of the working model.

  • bimId (BimId) – bim id for which you want its relating relationships.

  • type (RelationshipType) –

Return type

[BimId]

Returns

array of bim id which are the relating relationship of the BimId.

getBimIdsFromGenericId

Model.getBimIdsFromGenericId(ifcGuid)

Retrieves the bim ids of the corresponding generic id.

Arguments
  • ifcGuid (GenericId) – the generic id for which you want its bim id.

Return type

[BimId]

Returns

the bim id corresponding to the ifcGuid or null if none.

getBimInfoFromBimId

Model.getBimInfoFromBimId(node, bimId)

Retrieve the name of the bim element

Arguments
  • node (NodeId) – any known node id of the working model.

  • bimId (BimId) – bim id for which you want the bim element name.

Return type

function

Returns

the name and the info regarding the connection to a node of the bim element.

getBranchVisibility

Model.getBranchVisibility(nodeId)

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

Arguments
  • nodeId (NodeId) – ID of the node at the root of the branch.

Return type

BranchVisibility

Returns

Shown/Hidden if all children have the same visibility state, Mixed otherwise.

getCADActiveConfiguration

Model.getCADActiveConfiguration()
Deprecated

Use getActiveCadConfiguration instead.

Return type

NodeId | null

getCADConfigurations

Model.getCADConfigurations()
Deprecated

Use getCadConfigurations instead.

Return type

IdStringMap()

getCADDefaultConfiguration

Model.getCADDefaultConfiguration()
Deprecated

Use getDefaultCadConfiguration instead.

Return type

NodeId | null

getCADViewPMIs

Model.getCADViewPMIs(nodeId)
Deprecated

Use getCadViewPmis instead.

Arguments
Return type

[PmiId]

getCADViews

Model.getCADViews()
Deprecated

Use getCadViews instead.

Return type

IdStringMap()

getCadConfigurations

Model.getCadConfigurations()

Gets CAD configurations

Return type

IdStringMap()

Returns

an object mapping CAD configuration ID to config name

getCadViewConfiguration

Model.getCadViewConfiguration(cadViewNodeId)

Get the configuration in which the view is defined

Arguments
Return type

NodeId | null

Returns

ID of CAD Configuration of the view

getCadViewMap

Model.getCadViewMap()

Gets CAD View information for this model.

Return type

Map <NodeId, string>

Returns

a map mapping associating CAD View ID to name

getCadViewPmis

Model.getCadViewPmis(nodeId)

Get PMI IDs for a CAD View

Arguments
Return type

[PmiId]

Returns

IDs of visible PMIs for the view

getCadViews

Model.getCadViews()
Deprecated

Use getCadViewMap instead.

Return type

IdStringMap()

getClientDimensions

Model.getClientDimensions()

Returns the dimensions of the viewer container in pixels.

Deprecated

use View.getCanvasSize

Return type

(number, number)

Returns

a pair of numbers, [width, height].

getDataFromIds

Model.getDataFromIds(ids)

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.

See

{@link https://docs.techsoft3d.com/communicator/latest/api_ref/data_import/libsc/classSC_1_1Store_1_1Model.html#_CPPv4N2SC5Store5Model6InsertE8uint32_tPK7uint8_t8uint32_t Model::Insert}

Arguments
  • ids (SC.DataIds()) –

Return type

Promise <[Uint8Array]>

Returns

promise that resolves when this operation has completed returning an array of 8bits int arrays for each ModelKey-DataKey pairs

getDataFromKeys

Model.getDataFromKeys(ids)
Deprecated

Use getDataFromIds instead.

Arguments
  • ids (SC.DataIds()) –

Return type

Promise <[Uint8Array]>

getDefaultCadConfiguration

Model.getDefaultCadConfiguration()

Gets CAD default configuration

Return type

NodeId | null

Returns

ID of default CAD Configuration

getDefaultCadView

Model.getDefaultCadView()

Gets CAD default view

Return type

NodeId | null

Returns

ID of default CAD Configuration

getEdgeAttributes

Model.getEdgeAttributes(nodeId, edgeIndex)

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

Arguments
  • nodeId (NodeId) – Node to retrieve edge properties from

  • edgeIndex (number()) – Index of edge for which to retrieve edge attributes

Return type

Promise <SubentityAttributes() | null>

Returns

Promise for the requested edge attributes. Properties returned will be null if none associated with the edge.

getEdgeCount

Model.getEdgeCount(nodeId)

Returns edge count for a node of the given node.

Arguments
  • nodeId (NodeId) – Node to retrieve edge count from

Return type

Promise <number>

Returns

Promise providing the number of edges

getEdgeProperty

Model.getEdgeProperty(nodeId, edgeId)

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

Arguments
  • nodeId (NodeId) – Node to retrieve edge properties from

  • edgeId (number()) –

Return type

Promise <Edge | null>

Returns

Promise for the requested edge properties. Properties returned will be null if none associated with the edge.

getFaceAttributes

Model.getFaceAttributes(nodeId, faceIndex)

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

Arguments
  • nodeId (NodeId) – Node to retrieve edge properties from

  • faceIndex (number()) – Index of face for which to retrieve face attributes

Return type

Promise <SubentityAttributes() | null>

Returns

Promise for the requested face attributes. Properties returned will be null if none associated with the edge.

getFaceCount

Model.getFaceCount(nodeId)

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

Arguments
  • nodeId (NodeId) – Node to retrieve face count from

Return type

Promise <number>

Returns

Promise providing the number of faces

getFaceProperty

Model.getFaceProperty(nodeId, faceId)

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

Arguments
  • nodeId (NodeId) – Node to retrieve face properties from

  • faceId (number()) –

Return type

Promise <Face | null>

Returns

Promise for the requested face properties. Properties returned will be null if none associated with the face.

getFilterName

Model.getFilterName(filterId)
Arguments
Return type

FilterName | null

Returns

The name of a filter for the given filter ID index or null if filter was not found

getFilters

Model.getFilters()

Returns names and ids of all filters available in the scene

Return type

Map <FilterId, FilterName>

Returns

a map associating Filter IDs to filter names

getFiltersWithNode

Model.getFiltersWithNode(nodeIdSearched)
Arguments
Return type

[FilterId]

Returns

Filters which retain or remove the given node.

getGenericIdFromBimId

Model.getGenericIdFromBimId(node, bimId)

Retrieves the generic id of the corresponding bim id.

Arguments
  • node (NodeId) – any known node id of the working model.

  • bimId (BimId) – bim id for which you want its generic id.

Return type

GenericId | null

Returns

the generic id corresponding to the BimId or null if none.

getGenericTypeIdMap

Model.getGenericTypeIdMap()

Gets all generic types and NodeIds with that type.

Return type

Map <GenericType, Set <NodeId>>

Returns

Map containing generic types and NodeIds

getGenericTypes

Model.getGenericTypes()

This function gets all generic types contained in the model.

Return type

[GenericType]

Returns

All generic types.

getIfcNodeIds

Model.getIfcNodeIds()
Deprecated

Use getGenericTypeIdMap instead.

Return type

Map <GenericType, Set <NodeId>>

getIfcTypeByNodeId

Model.getIfcTypeByNodeId(id)
Deprecated

Use getGenericTypeIdMap instead.

Arguments
Return type

GenericType | null

getIfcTypes

Model.getIfcTypes()
Deprecated

Use getGenericTypes instead.

Return type

[GenericType]

getLayerIdsFromName

Model.getLayerIdsFromName(name)
Arguments
Return type

[LayerId] | null

Returns

Id of layers for the given filter name or null if no layers are found

getLayerName

Model.getLayerName(layerId)
Arguments
Return type

LayerName | null

Returns

The name of a layer for the given filter ID or null if layer was not found

getLayers

Model.getLayers()

Returns names and ids of all layers available in the scene

Return type

Map <LayerId, LayerName>

Returns

a map associating Layer IDs to Layer names

getLooseBounding

Model.getLooseBounding()

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

Return type

Promise <Box()>

Returns

Promise that resolves with a Box representing the world space bounding box of the model.

getLowestAvailableNodeID

Model.getLowestAvailableNodeID()
Deprecated

Use getLowestAvailableNodeId instead.

Return type

NodeId

getLowestAvailableNodeId

Model.getLowestAvailableNodeId()

Returns the lowest available node ID

Return type

NodeId

getMeshIds

Model.getMeshIds(nodeIds)

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

Arguments
Return type

Promise <[MeshId]>

getMetallicRoughness

Model.getMetallicRoughness(nodeIds)

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

Arguments
  • nodeIds ([NodeId]) – List of nodes to get material properties for

Return type

Promise <[null | MetallicRoughnessValue()]>

getModelBounding

Model.getModelBounding(ignoreInvisible, includeExcluded[, tightBounding])

Gets the world space bounding box for the model.

Arguments
  • ignoreInvisible (boolean()) –

  • includeExcluded (boolean()) –

  • tightBounding (boolean()) – optional

Return type

Promise <Box()>

Returns

Promise that resolves with a Box representing the world space bounding box of the model.

getModelFileNameFromNode

Model.getModelFileNameFromNode(nodeId)
Arguments
Return type

string | null

Returns

the original file name of the model which contain the given node or null if the node is not found.

getModelFileTypeFromNode

Model.getModelFileTypeFromNode(nodeId)
Arguments
Return type

FileType | null

Returns

the original file type of the model which contain the given node or null if the node is not found.

getNodeCappingMeshData

Model.getNodeCappingMeshData(nodeId)

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

Arguments
Return type

Promise <MeshDataCopy() | null>

getNodeChildren

Model.getNodeChildren(nodeId[, includeOutOfHierarchy])

Returns IDs for child nodes for the given Id.

Arguments
  • nodeId (NodeId) –

  • includeOutOfHierarchy (boolean()) – optional true to include Out Of Hierarchy node, false or null to exclude them

Return type

[NodeId]

Returns

ID for the children of this node, or null if the ID is invalid

getNodeColorMap

Model.getNodeColorMap(startNodeId, elementType)

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.

Arguments
  • startNodeId (NodeId) – The start node to walk when building the color map.

  • elementType (ElementType) – Returned colors are of this element type.

Return type

Promise <Map <NodeId, Color()>>

getNodeEffectiveFaceColor

Model.getNodeEffectiveFaceColor(partId, faceIndex)

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.

Arguments
  • partId (PartId) –

  • faceIndex (number()) – the index of the face in the node

Return type

Promise <Color() | null>

getNodeEffectiveLineColor

Model.getNodeEffectiveLineColor(partId, lineIndex)

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.

Arguments
  • partId (PartId) –

  • lineIndex (number()) – the index of the line in the node

Return type

Promise <Color() | null>

getNodeEffectivePointColor

Model.getNodeEffectivePointColor(partId, pointIndex)

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.

Arguments
  • partId (PartId) –

  • pointIndex (number()) – the index of the point in the node

Return type

Promise <Color() | null>

getNodeExchangeId

Model.getNodeExchangeId(nodeId)

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

Arguments
  • nodeId (NodeId) – The node ID to get the Exchange ID from.

Return type

ExchangeId | null

Returns

The Exchange ID of the node with the given nodeId or null if no Exchange ID is found.

getNodeFaceColor

Model.getNodeFaceColor(partId, faceIndex)

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

Arguments
  • partId (PartId) –

  • faceIndex (number()) – the index of the face in the node

Return type

Promise <Color() | null>

getNodeFaceHighlighted

Model.getNodeFaceHighlighted(nodeId, faceIndex)

Returns whether the supplied face element has been highlighted with setNodeFaceHighlighted

Arguments
  • nodeId (NodeId) – the ID of the node containing the face element

  • faceIndex (number()) – the index of the face within the node

Return type

Promise <boolean>

getNodeGenericId

Model.getNodeGenericId(nodeId)
Arguments
Return type

GenericId | null

Returns

the generic id of the given node or null if the node is not found.

getNodeGenericType

Model.getNodeGenericType(nodeId)
Arguments
Return type

GenericType | null

Returns

the generic type of the given node or null if the node is not found.

getNodeIDFromSCInstanceKey

Model.getNodeIDFromSCInstanceKey(inclusionKey, instanceKey)

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

Deprecated

Arguments
  • inclusionKey (SC.InclusionKey()) –

  • instanceKey (SC.InstanceKey()) –

Return type

NodeId | null

Returns

body node instance ID

getNodeIdFromBimId

Model.getNodeIdFromBimId(node, bimID)

Retrieves the node id of the corresponding bim id.

Arguments
  • node (NodeId) – any known node id of the working model.

  • bimID (BimId) – bim id for which you want its node id.

Return type

NodeId | null

Returns

the node id corresponding to the BimId or null if none.

getNodeIdOffset

Model.getNodeIdOffset(nodeId)

Retrieves the node ID offset for a given node.

Arguments
  • nodeId (NodeId) – The node to obtain the node ID offset from.

Return type

NodeIdOffset

Returns

The node ID offset for the supplied node.

getNodeIdsByGenericIds

Model.getNodeIdsByGenericIds(genericIds)

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.

Arguments
  • genericIds ([GenericId]) – Array of generic IDs to find nodes fore

Return type

[NodeId]

Returns

Array of node ids corresponding to the provided generic IDs

getNodeIdsByIfcGuids

Model.getNodeIdsByIfcGuids(ifcGuids)
Deprecated

Use getNodeIdsByGenericIds instead.

Arguments
Return type

[NodeId]

getNodeLayerId

Model.getNodeLayerId(nodeId)

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

Arguments
  • nodeId (NodeId) – The node ID to get the Exchange ID from.

Return type

LayerId | null

Returns

The layer ID of the node with the given nodeId or null if no layer is found.

getNodeLineColor

Model.getNodeLineColor(partId, lineIndex)

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

Arguments
  • partId (PartId) –

  • lineIndex (number()) – the index of the line in the node

Return type

Promise <Color() | null>

getNodeLineHighlighted

Model.getNodeLineHighlighted(nodeId, lineIndex)

Returns whether the supplied line element has been highlighted with setNodeLineHighlighted

Arguments
  • nodeId (NodeId) – the ID of the node containing the line element

  • lineIndex (number()) – the index of the line within the node

Return type

Promise <boolean>

getNodeMatrix

Model.getNodeMatrix(nodeId)

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

Arguments
Return type

Matrix()

Returns

Copy of the Matrix of the node

getNodeMeshData

Model.getNodeMeshData(nodeId)

Fetch the mesh data for a particular node

Arguments
  • nodeId (NodeId) – the node’s ID

Return type

Promise <MeshDataCopy()>

getNodeName

Model.getNodeName(nodeId)

Returns the name for a node in the assembly tree.

Arguments
  • nodeId (NodeId) – The node ID to get the name of.

Return type

string | null

Returns

The name of the node with the given nodeId or null if no name is found.

getNodeNetMatrix

Model.getNodeNetMatrix(nodeId)

Returns net matrix for a node of the given ID

Arguments
Return type

Matrix()

Returns

Net Matrix of the Node

getNodeParent

Model.getNodeParent(nodeId)

Returns the parent Id for the given node id.

Arguments
Return type

NodeId | null

Returns

ID of the parent node for the supplied ID. If the ID is invalid or the root ID, null is returned.

getNodePointColor

Model.getNodePointColor(partId, pointIndex)

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

Arguments
  • partId (PartId) –

  • pointIndex (number()) – the index of the point in the node

Return type

Promise <Color() | null>

getNodePointHighlighted

Model.getNodePointHighlighted(nodeId, pointIndex)

Returns whether the supplied point element has been highlighted with setNodePointHighlighted

Arguments
  • nodeId (NodeId) – the ID of the node containing the point element

  • pointIndex (number()) – the index of the point within the node

Return type

Promise <boolean>

getNodeProperties

Model.getNodeProperties(nodeId[, computeFromChildren])

Returns the properties for the given node ID.

Arguments
  • nodeId (NodeId) –

  • computeFromChildren (boolean()) – optional If true physical properties will be computed from child nodes.

Return type

Promise <StringStringMap() | null>

Returns

object properties for the supplied ID, or null if the ID was invalid

getNodeRealBounding

Model.getNodeRealBounding(nodeId)

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.

Arguments
  • nodeId (NodeId) – ID of the node for which you wish to get the bounding box.

Return type

Promise <Box()>

Returns

Promise that resolves with the world space bounding box for the given ID.

getNodeType

Model.getNodeType(nodeId)

Returns the type of the node with the given ID.

Arguments
Return type

NodeType

Returns

The type of the node.

getNodeUnitMultiplier

Model.getNodeUnitMultiplier(nodeId)

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.

Arguments
Return type

number

Returns

The unit multiplier for the model (in mm)

getNodeUserData

Model.getNodeUserData(nodeId, index)

Returns the user data for a given node and index.

Throws

InvalidNodeIdError InvalidIndexError

Arguments
  • nodeId (NodeId) – The ID of the node to query.

  • index (UserDataIndex) – The index of the data.

Return type

Uint8Array

Returns

The user data.

getNodeUserDataIndices

Model.getNodeUserDataIndices(nodeId)

Returns all the UserDataIndex items associated with the input node.

Throws

InvalidNodeIdError

Arguments
  • nodeId (NodeId) – The ID of the node to query.

Return type

[UserDataIndex]

Returns

A list of UserDataIndex, possibly empty.

getNodeVisibility

Model.getNodeVisibility(nodeId)

Returns the current visibility for a node.

Arguments
  • nodeId (NodeId) – ID of the node to get visibility for.

Return type

boolean

Returns

true if the current node’s visibility state is on or false if it is not.

getNodesBounding

Model.getNodesBounding(nodeIds[, config])

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

Arguments
  • nodeIds ([NodeId]) – IDs of the nodes for which you wish to get the bounding box.

  • config (GetNodesBoundingConfig()) – optional Allows fine control of what body types to compute the bounding against. If not provided, all body types are considered.

Return type

Promise <Box()>

Returns

Promise that resolves with the world space bounding box for the given IDs.

getNodesByGenericType

Model.getNodesByGenericType(genericType)

This function returns all NodeIds with an IFC type.

Arguments
Return type

Set <NodeId> | null

Returns

All NodeIds with an IFC type

getNodesByIfcType

Model.getNodesByIfcType(ifcType)
Deprecated

Use getNodesByGenericType instead.

Arguments
Return type

Set <NodeId> | null

getNodesCappingMeshData

Model.getNodesCappingMeshData(nodeIds)

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

Arguments
  • nodeIds ([NodeId]) – the node IDs to get capping data from.

Return type

Promise <[MeshDataCopy()]>

getNodesCullingVectors

Model.getNodesCullingVectors(nodeIds)

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.

Arguments
  • nodeIds ([NodeId]) – The nodes to query culling vectors from.

Return type

Promise <[null | CullingVector()]>

Returns

A promise of culling vectors.

getNodesEffectiveFaceColor

Model.getNodesEffectiveFaceColor(nodeIds)

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.

Arguments
  • nodeIds ([NodeId]) – IDs of the nodes to be queried

Return type

Promise <[Color()]>

getNodesEffectiveLineColor

Model.getNodesEffectiveLineColor(nodeIds)

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.

Arguments
  • nodeIds ([NodeId]) – IDs of the nodes to be queried

Return type

Promise <[Color()]>

getNodesEffectiveOpacity

Model.getNodesEffectiveOpacity(leafNodes, elementType)

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.

Arguments
  • leafNodes ([NodeId]) –

  • elementType (ElementType) – the type of element (faces, lines or points) to query

Return type

Promise <[number]>

getNodesEffectivePointColor

Model.getNodesEffectivePointColor(nodeIds)

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.

Arguments
  • nodeIds ([NodeId]) – IDs of the nodes to be queried

Return type

Promise <[Color()]>

getNodesEffectiveTransparency

Model.getNodesEffectiveTransparency(leafNodes, elementType)
Deprecated

use getNodesEffectiveOpacity instead.

Arguments
Return type

Promise <[number]>

getNodesFaceColor

Model.getNodesFaceColor(nodeIds)

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. See also: getNodesEffectiveFaceColor

Arguments
  • nodeIds ([NodeId]) – IDs of the nodes to be queried

Return type

Promise <[null | Color()]>

getNodesFromFiltersId

Model.getNodesFromFiltersId(filtersId)
Arguments
  • filtersId ([FilterId]) – array of filters indexes to take in account

Return type

FilteredNodes() | null

Returns

nodesId of nodes retained by the given filter indices and the type of filter (inclusive or not). Returns null if no filter is found.

getNodesFromLayer

Model.getNodesFromLayer(layerId[, onlyTreeNodes])

Returns IDs of nodes in the given layer.

Arguments
  • layerId (LayerId) – The layer ID to get nodes from.

  • onlyTreeNodes (boolean()) – optional if true return only nodes present in model Tree

Return type

[NodeId] | null

Returns

An array of nodes Id of nodes with the given layerId or null if no layers are found.

getNodesFromLayerName

Model.getNodesFromLayerName(layerName[, onlyTreeNodes])

Returns IDs of nodes in the given layer.

Arguments
  • layerName (LayerName) –

  • onlyTreeNodes (boolean()) – optional if true return only nodes present in model Tree

Return type

[NodeId] | null

Returns

An array of nodes Id of nodes with the given layerName or null if no layers are found.

getNodesFromLayers

Model.getNodesFromLayers(layersId[, onlyTreeNodes])

Returns IDs of nodes in given layers.

Arguments
  • layersId ([LayerId]) – Array of layers Id to get nodes from.

  • onlyTreeNodes (boolean()) – optional if true return only nodes present in model Tree

Return type

[NodeId] | null

Returns

An array of nodes Id of nodes with one of the given layerId or null if no layers are found.

getNodesHaveTransparency

Model.getNodesHaveTransparency(nodeIds)

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

Arguments
  • nodeIds ([NodeId]) – IDs of nodes to query.

Return type

Promise <[boolean]>

Returns

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.

getNodesHighlighted

Model.getNodesHighlighted(partIds)

Returns whether the supplied nodes have been highlighted with setNodesHighlighted

Arguments
Return type

Promise <[boolean]>

getNodesInstancingSamePart

Model.getNodesInstancingSamePart(nodeId)

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

Arguments
Return type

Promise <[NodeId] | null>

Returns

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.

getNodesLineColor

Model.getNodesLineColor(nodeIds)

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.

Arguments
  • nodeIds ([NodeId]) – IDs of the nodes to be queried

Return type

Promise <[null | Color()]>

getNodesOpacity

Model.getNodesOpacity(leafNodes)

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.

Arguments
Return type

Promise <[null | number]>

getNodesPointColor

Model.getNodesPointColor(nodeIds)

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. See also: getNodesEffectivePointColor

Arguments
  • nodeIds ([NodeId]) – IDs of the nodes to be queried

Return type

Promise <[null | Color()]>

getNodesTransparency

Model.getNodesTransparency(leafNodes)
Deprecated

use getNodesOpacity instead.

Arguments
Return type

Promise <[null | number]>

getOutOfHierarchy

Model.getOutOfHierarchy(nodeId)

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

Arguments
Return type

boolean

Returns

false if node is Out Of Hierarchy, true if it is

getPMIColor

Model.getPMIColor()
Deprecated

Use getPmiColor instead.

Return type

Color()

getPMIColorOverride

Model.getPMIColorOverride()
Deprecated

Use getPmiColorOverride instead.

Return type

boolean

getPMISubtype

Model.getPMISubtype(pmiId)
Deprecated

Use getPmiSubtype instead.

Arguments
Return type

PmiSubType

getPMIType

Model.getPMIType(pmiId)
Deprecated

Use getPmiType instead.

Arguments
Return type

PmiType

getPMIs

Model.getPMIs()
Deprecated

Use getPmis instead.

Return type

IdStringMap()

getPmiColor

Model.getPmiColor()

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

Return type

Color()

Returns

color

getPmiColorOverride

Model.getPmiColorOverride()
Return type

boolean

Returns

a boolean value indicating the status of the PMI override color.

getPmiSubtype

Model.getPmiSubtype(pmiId)

Returns the subtype of a given PMI

Arguments
Return type

PmiSubType

Returns

Subtype of the PMI (Dimension distance, Datum target, GD&T fcf…)

getPmiTopologyReferences

Model.getPmiTopologyReferences(pmiNodeId)

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

Arguments
  • pmiNodeId (NodeId) – the ID of the PMI node.

Return type

[RefOnTopoItem()] | null

getPmiType

Model.getPmiType(pmiId)

Returns the type of a given PMI

Arguments
Return type

PmiType

Returns

Type of the PMI (Dimension, Datum, GD&T…)

getPmis

Model.getPmis()

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

Return type

IdStringMap()

Returns

a map associating PMI IDs to PMI names

getPointAttributes

Model.getPointAttributes(nodeId, pointIndex)

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

Arguments
  • nodeId (NodeId) – Node to retrieve point properties from

  • pointIndex (number()) – Index of point for which to retrieve point attributes

Return type

Promise <SubentityAttributes() | null>

Returns

Promise for the requested point attributes. Properties returned will be null if none associated with the point.

getPrimaryModelId

Model.getPrimaryModelId()
Deprecated

Return type

Promise <SC.ModelKey>

getPrimaryModelKey

Model.getPrimaryModelKey()
Deprecated

Return type

Promise <SC.ModelKey>

getRelationshipTypesFromBimId

Model.getRelationshipTypesFromBimId(node, bimId)

Retrieves all type of relationships that a bim id has.

Arguments
  • node (NodeId) – any known node id of the working model.

  • bimId (BimId) – bim id for which you want its types of relationships.

Return type

[RelationshipType]

Returns

array of type of relationship corresponding to the BimId.

getRootNode

Model.getRootNode()
Deprecated

Use getAbsoluteRootNode instead.

Return type

NodeId

getSCInstanceKey

Model.getSCInstanceKey(bodyId)

Returns the SC ID of a body instance

Deprecated

Arguments
Return type

SC.InstanceInc | null

Returns

SC instance ID, a pair of numbers consisting of the inclusion ID and the instance ID. null is returned if the function fails.

getUniqueLayerNames

Model.getUniqueLayerNames()

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

Return type

[LayerName]

Returns

Names of layers

getUnitMultiplier

Model.getUnitMultiplier()

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

Deprecated

Use getNodeUnitMultiplier instead.

Return type

number

Returns

The unit multiplier for the model (in mm)

getViewAxes

Model.getViewAxes()
Return type

ViewAxes()

Returns

the up and front vectors for the model coordinate system.

getVisibilityState

Model.getVisibilityState(startNodeId)

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.

Arguments
Return type

Promise <VisibilityState()>

hasDepthRange

Model.hasDepthRange(nodeIds)
Arguments
Return type

Promise <[boolean]>

hasEffectiveGenericType

Model.hasEffectiveGenericType(nodeId, genericType)

Checks if a NodeId is a generic type.

Arguments
Return type

boolean

isAnnotationView

Model.isAnnotationView(cadViewNodeId)

Tells if the view is an annotation view or not

Arguments
  • cadViewNodeId (CadViewId) – Node ID of the CAD view

Return type

boolean

Returns

true if the view is an annotation view

isCombineStateView

Model.isCombineStateView(cadViewNodeId)

Tells if the view is a combine state view or not

Arguments
  • cadViewNodeId (CadViewId) – Node ID of the CAD view

Return type

boolean

Returns

true if the view is a combine state view

isDrawing

Model.isDrawing()

Tells if the model is a CAD drawing or not

Return type

boolean

Returns

true if the model is a CAD drawing

isFaceMeasurable

Model.isFaceMeasurable(bodyId, faceIndex)
Arguments
  • bodyId (NodeId) –

  • faceIndex (number()) –

Return type

Promise <boolean>

isLineMeasurable

Model.isLineMeasurable(bodyId, lineIndex)
Arguments
  • bodyId (NodeId) – ID of the body node containing the line

  • lineIndex (number()) – Index of the line ot be checked

Return type

Promise <boolean>

Returns

true if the line has associated measurement data

isMeasurable

Model.isMeasurable()
Return type

boolean

Returns

true if the model contains measurement data.

isNodeLoaded

Model.isNodeLoaded(nodeId)

Queries if a node is fully loaded or not.

Arguments
  • nodeId (NodeId) – The node to query.

Return type

boolean

Returns

True if the node is fully loaded; false otherwise.

isWithinExternalModel

Model.isWithinExternalModel(nodeId)

Returns true if the node is within an external model.

Arguments
Return type

boolean

loadMeasurementFromFile

Model.loadMeasurementFromFile(filename)

Loads measurement data from a ZIP file

Arguments
  • filename (string()) – Name of a file containing ZIP measurement data

Return type

Promise <void>

loadMeasurementFromJson

Model.loadMeasurementFromJson(json)

Loads measurement data from a JSON object

Arguments
  • json (any()) – JSON object containing measurement data

Return type

Promise <void>

loadMeasurementFromString

Model.loadMeasurementFromString(str)

Loads measurement data from a JSON string

Arguments
  • str (string()) – JSON string containing measurement data

Return type

Promise <void>

loadSubtreeFromModel

Model.loadSubtreeFromModel(nodeId, modelName, config)

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

Arguments
  • nodeId (NodeId) – 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 (ScModelName) – The name of the model to load.

  • config (LoadSubtreeConfig()) – Configuration to control load behavior.

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs.

Model.loadSubtreeFromModel(nodeId, modelName[, additionalMatrix])

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

Arguments
  • nodeId (NodeId) – 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 (ScModelName) – The name of the model to load.

  • additionalMatrix (Matrix() | null) – optional Optional matrix to get multiplied into the net attachment matrix.

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs.

loadSubtreeFromScsBuffer

Model.loadSubtreeFromScsBuffer(nodeId, buffer, config)

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

Arguments
  • nodeId (NodeId) – 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.

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs.

Model.loadSubtreeFromScsBuffer(nodeId, buffer[, additionalMatrix])

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

Arguments
  • nodeId (NodeId) – 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 (Matrix() | null) – optional Optional matrix to get multiplied into the net attachment matrix.

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs.

loadSubtreeFromScsFile

Model.loadSubtreeFromScsFile(nodeId, scsFilename, config)

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

Arguments
  • nodeId (NodeId) – 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 (ScsUri) – The name of the SCS file to load.

  • config (LoadSubtreeConfig()) – Configuration to control load behavior.

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs.

Model.loadSubtreeFromScsFile(nodeId, scsFilename[, additionalMatrix])

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

Arguments
  • nodeId (NodeId) – 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 (ScsUri) – The name of the SCS file to load.

  • additionalMatrix (Matrix() | null) – optional Optional matrix to get multiplied into the net attachment matrix.

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs.

loadSubtreeFromScsXmlBuffer

Model.loadSubtreeFromScsXmlBuffer(nodeId, xmlData, modelNameToScs, config)

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.

Arguments
  • nodeId (NodeId) – 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 (ModelNameToScsFileFunc | null) – 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.

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs that will resolve when all files have been loaded.

Model.loadSubtreeFromScsXmlBuffer(nodeId, xmlData[, modelNameToScs[, additionalMatrix[, allowMissingExternalModels]]])

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.

Arguments
  • nodeId (NodeId) – 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 (ModelNameToScsFileFunc | null) – optional 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 (Matrix() | null) – optional Optional matrix to get multiplied into the net attachment matrix.

  • allowMissingExternalModels (boolean()) – optional Optional boolean to control whether or not missing models in the XML file are ignored or cause an error.

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs that will resolve when all files have been loaded.

loadSubtreeFromScsXmlFile

Model.loadSubtreeFromScsXmlFile(nodeId, xmlFilename, modelNameToScs, config)

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.

Arguments
  • nodeId (NodeId) – 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 (XmlFilename) – URL of XML file to load.

  • modelNameToScs (ModelNameToScsFileFunc | null) – 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.

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs that will resolve when all files have been loaded.

Model.loadSubtreeFromScsXmlFile(nodeId, xmlFilename[, modelNameToScs[, additionalMatrix[, allowMissingExternalModels]]])

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.

Arguments
  • nodeId (NodeId) – 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 (XmlFilename) – URL of XML file to load.

  • modelNameToScs (ModelNameToScsFileFunc | null) – optional 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 (Matrix() | null) – optional Optional matrix to get multiplied into the net attachment matrix.

  • allowMissingExternalModels (boolean()) – optional Optional boolean to control whether or not missing models in the XML file are ignored or cause an error.

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs that will resolve when all files have been loaded.

loadSubtreeFromUrl

Model.loadSubtreeFromUrl(nodeId, xmlFilename)
Deprecated

Use loadSubtreeFromXmlFile instead.

Arguments
Return type

Promise <[NodeId]>

loadSubtreeFromXML

Model.loadSubtreeFromXML(nodeId, xmlData)
Deprecated

Use loadSubtreeFromXmlBuffer instead.

Arguments
  • nodeId (NodeId) –

  • xmlData (string()) –

Return type

Promise <[NodeId]>

loadSubtreeFromXmlBuffer

Model.loadSubtreeFromXmlBuffer(nodeId, xmlData, massageModelName, config)

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

Arguments
  • nodeId (NodeId) – 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 (MassageModelNameFunc | null) – Optional callback to massage model names within the XML file. Return null to skip the model.

  • config (LoadSubtreeConfig()) – Configuration to control load behavior.

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs.

Model.loadSubtreeFromXmlBuffer(nodeId, xmlData[, massageModelName[, additionalMatrix[, allowMissingExternalModels]]])

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

Arguments
  • nodeId (NodeId) – 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 (MassageModelNameFunc | null) – optional Optional callback to massage model names within the XML file. Return null to skip the model.

  • additionalMatrix (Matrix() | null) – optional Optional matrix to get multiplied into the net attachment matrix.

  • allowMissingExternalModels (boolean()) – optional Optional boolean to control whether or not missing models in the XML file are ignored or cause an error.

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs.

loadSubtreeFromXmlFile

Model.loadSubtreeFromXmlFile(nodeId, xmlFilename, massageModelName, config)

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

Arguments
  • nodeId (NodeId) – 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 (XmlFilename) – URL of XML file to load.

  • massageModelName (MassageModelNameFunc | null) – Optional callback to massage model names within the XML file. Return null to skip the model.

  • config (LoadSubtreeConfig()) – Configuration to control load behavior.

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs.

Model.loadSubtreeFromXmlFile(nodeId, xmlFilename[, massageModelName[, additionalMatrix[, allowMissingExternalModels]]])

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

Arguments
  • nodeId (NodeId) – 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 (XmlFilename) – URL of XML file to load.

  • massageModelName (MassageModelNameFunc | null) – optional Optional callback to massage model names within the XML file. Return null to skip the model.

  • additionalMatrix (Matrix() | null) – optional Optional matrix to get multiplied into the net attachment matrix.

  • allowMissingExternalModels (boolean()) – optional Optional boolean to control whether or not missing models in the XML file are ignored or cause an error.

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs.

registerBimNodes

Model.registerBimNodes(startNodeId, attributeToMask[, legacy_useAttributeTitle])

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

Arguments
  • startNodeId (NodeId) – The root of the subtree to walk for registration.

  • attributeToMask (function()) – The callback used to obtain a node’s BimMask from its attributes.

  • legacy_useAttributeTitle (string | boolean | null()) – optional

Return type

Promise <void>

Returns

Promise that resolves when the operation has completed.

Model.attributeToMask(value)
Arguments
  • value (string()) –

Return type

BimMask

registerIfcNodes

Model.registerIfcNodes(startNodeId[, legacy_useAttributeTitle])

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

Arguments
  • startNodeId (NodeId) – The root of the subtree to walk for registration.

  • legacy_useAttributeTitle (string | boolean | null()) – optional

Return type

Promise <void>

Returns

Promise that resolves when the operation has completed.

replaceMesh

Model.replaceMesh(id, data)

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

Arguments
Return type

Promise <void>

requestNodes

Model.requestNodes(nodeIds)

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

Arguments
  • nodeIds ([NodeId]) – array of unique IDs for the system to load

Return type

Promise <void>

reset

Model.reset()

Resets the state of the model to its default

Return type

Promise <void>

Returns

Promise that resolves when the operation has completed.

resetModelHighlight

Model.resetModelHighlight()

Resets highlight for all nodes in the model.

Return type

DeprecatedPromise()

Returns

Promise that resolves when this operation has completed.

resetModelOpacity

Model.resetModelOpacity()

Resets opacity for all nodes in the model.

Return type

void

Returns

Promise that resolves when this operation has completed.

resetModelTransparency

Model.resetModelTransparency()
Deprecated

Use resetModelOpacity instead.

Return type

DeprecatedPromise()

resetNodeMatrixToInitial

Model.resetNodeMatrixToInitial(nodeId)

Reset node matrix to the one set as the initial one

Arguments
Return type

Promise <void>

resetNodesColor

Model.resetNodesColor()

Resets color for all nodes in the model.

Return type

DeprecatedPromise()

Returns

Promise that resolves when this operation has completed.

resetNodesOpacity

Model.resetNodesOpacity(nodeIds)

Resets opacity for a given list of nodes.

Arguments
  • nodeIds ([NodeId]) – IDs of nodes whose opacity will be reset to their default values

Return type

void

resetNodesTransform

Model.resetNodesTransform()

Resets transform for all nodes in the model.

Return type

Promise <void>

Returns

Promise that resolves when the operation has completed.

resetNodesTransparency

Model.resetNodesTransparency(nodeIds)
Deprecated

use resetNodesOpacity instead.

Arguments
Return type

DeprecatedPromise()

resetNodesVisibility

Model.resetNodesVisibility()

Resets visibility for all nodes in the model.

Return type

Promise <void>

Returns

Promise that resolves when the operation has completed.

setBehaviorInitiallyHidden

Model.setBehaviorInitiallyHidden(enabled)

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

Arguments
  • enabled (boolean()) – value indicating if initially hidden objects stay hidden

Return type

void

setBodyNodesVisibility

Model.setBodyNodesVisibility(startNodeId, visibility)

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

Arguments
  • startNodeId (NodeId) – The start node to walk when updating body nodes visibility.

  • visibility (boolean()) – If true, nodes will be shown. If false, they will be hidden.

Return type

Promise <void>

Returns

Promise that resolves when the operation has completed.

Model.setBodyNodesVisibility(startNodeId, visibilityFormatter)

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

Arguments
  • startNodeId (NodeId) – The start node to walk when updating body nodes visibility.

  • visibilityFormatter (function()) – A function that returns the visibility for a given node id

Return type

Promise <void>

Returns

Promise that resolves when the operation has completed.

Model.visibilityFormatter(node)
Arguments
Return type

boolean | undefined

setDepthRange

Model.setDepthRange(nodeIds, min, max)

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.

Arguments
  • nodeIds ([NodeId]) – the node IDs to operate on

  • min (number()) – the depth value at the near plane

  • max (number()) – the depth value at the far plane

Return type

DeprecatedPromise()

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

setEdgeProperty

Model.setEdgeProperty(nodeId, edgeId, prop)

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

Arguments
  • nodeId (NodeId) –

  • edgeId (number()) –

  • prop (Base) – property (CircleElement, LineElement…)

Return type

void

setEnableAutomaticUnitScaling

Model.setEnableAutomaticUnitScaling(enabled)

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.

Arguments
  • enabled (boolean()) – value indicating if automatic unit scaling will be active

Return type

void

setFaceProperty

Model.setFaceProperty(nodeId, faceId, prop)

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

Arguments
  • nodeId (NodeId) –

  • faceId (number()) –

  • prop (Base) – property (CylinderElement, PlaneElement…)

Return type

void

setInstanceModifier

Model.setInstanceModifier(instanceModifier, nodeIds, value)

Allows changing the behavior in the viewer

Arguments
  • instanceModifier (InstanceModifier) – InstanceModifier

  • nodeIds ([NodeId]) – Array of node ids

  • value (boolean()) – boolean

Return type

DeprecatedPromise()

setMeshLevel

Model.setMeshLevel(nodeIds, meshLevel)

Sets the desired mesh level

Arguments
  • nodeIds ([NodeId]) – IDs of nodes in the assembly on which mesh level will be set

  • meshLevel (number()) – 0 standard, 1 low, 2 extra low

Return type

DeprecatedPromise()

Returns

Promise that resolves when the operation has completed.

setMetallicRoughness

Model.setMetallicRoughness(nodeIds, metallicFactor, roughnessFactor)

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.

Arguments
  • nodeIds ([NodeId]) – List of nodes to set material properties for

  • metallicFactor (number()) – The metalness of the material

  • roughnessFactor (number()) – The roughness of the material

Return type

void

setNodeFaceColor

Model.setNodeFaceColor(partId, faceId, color)

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

Arguments
  • partId (PartId) –

  • faceId (number()) – the Id of the face in the node that will have its color set

  • color (Color()) – the color to set

Return type

DeprecatedPromise()

setNodeFaceHighlighted

Model.setNodeFaceHighlighted(nodeId, faceId, highlighted)

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.

Arguments
  • nodeId (NodeId) – 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.

Return type

DeprecatedPromise()

setNodeFaceVisibility

Model.setNodeFaceVisibility(partId, faceId, visibility)

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

Arguments
  • partId (PartId) – 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

Return type

void

setNodeLineColor

Model.setNodeLineColor(partId, lineId, color)

Sets the color for a line element.

Arguments
  • partId (PartId) –

  • lineId (number()) – the Id of the line in the node that will have its color set.

  • color (Color()) – the color to set.

Return type

DeprecatedPromise()

setNodeLineHighlighted

Model.setNodeLineHighlighted(partId, lineId, highlighted)

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.

Arguments
  • partId (PartId) –

  • lineId (number()) – the line Id that is the target of this operation.

  • highlighted (boolean()) – value indicating whether the supplied line element should be highlighted.

Return type

DeprecatedPromise()

setNodeLineVisibility

Model.setNodeLineVisibility(partId, lineId, visibility)

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

Arguments
  • partId (PartId) – 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

Return type

void

setNodeMatrix

Model.setNodeMatrix(nodeId, matrix[, setAsInitial])

Sets Matrix for a node of the given ID

Arguments
  • nodeId (NodeId) –

  • matrix (Matrix()) –

  • setAsInitial (boolean()) – optional tells if you want to change the node initial matrix or not

Return type

Promise <void>

setNodePointColor

Model.setNodePointColor(partId, pointId, color)

Sets the color for a point element.

Arguments
  • partId (PartId) – 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.

Return type

void

setNodePointHighlighted

Model.setNodePointHighlighted(partId, pointId, highlighted)

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.

Arguments
  • partId (NodeId) –

  • pointId (number()) – the point Id that is the target of this operation.

  • highlighted (boolean()) – value indicating whether the supplied point element should be highlighted.

Return type

DeprecatedPromise()

setNodePointVisibility

Model.setNodePointVisibility(partId, pointId, visibility)

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

Arguments
  • partId (PartId) – 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

Return type

void

setNodesAmbientColor

Model.setNodesAmbientColor(nodeIds, color)

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

Arguments
  • nodeIds ([NodeId]) – IDs of nodes whose color to set

  • color (Color()) – the color to set

Return type

void

setNodesAmbientMix

Model.setNodesAmbientMix(nodeIds, value)

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.

Arguments
  • nodeIds ([NodeId]) – IDs of nodes whose color to set

  • value (number()) – the decimal value to set, between 0 and 1

Return type

void

setNodesColors

Model.setNodesColors(colorMap[, alsoApplyToWireframe[, alsoApplyToPoints]])

Sets colors for a given set of nodes.

Arguments
  • colorMap (Map <NodeId, Color()> | IdColorMap()) –

  • alsoApplyToWireframe (boolean()) – optional change or not lines color

  • alsoApplyToPoints (boolean()) – optional change or not points color

Return type

DeprecatedPromise()

Returns

Promise that resolves when this operation has completed.

setNodesCullingVector

Model.setNodesCullingVector(nodeIds, space, vector, toleranceDegrees)

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

Arguments
  • nodeIds ([NodeId]) –

  • space (CullingVectorSpace) – The space in which the culling vector is defined.

  • vector (Point3()) – A vector that will be compared with the view vector.

  • toleranceDegrees (Degrees) – The maximum angle between the culling vector and the view vector within which the object will be visible.

Return type

DeprecatedPromise()

setNodesFaceColor

Model.setNodesFaceColor(nodeIds, color)

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

Arguments
  • nodeIds ([NodeId]) – IDs of nodes whose color to set

  • color (Color()) – the color to set

Return type

DeprecatedPromise()

Returns

Promise that resolves when this operation has completed.

setNodesFaceEmissiveColor

Model.setNodesFaceEmissiveColor(nodeIds, color)

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

Arguments
  • nodeIds ([NodeId]) – IDs of nodes whose color to set

  • color (Color()) – the color to set

Return type

void

setNodesFaceSpecularColor

Model.setNodesFaceSpecularColor(nodeIds, color)

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

Arguments
  • nodeIds ([NodeId]) – IDs of nodes whose color to set

  • color (Color()) – the color to set

Return type

void

setNodesFaceSpecularIntensity

Model.setNodesFaceSpecularIntensity(nodeIds, value)

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

Arguments
  • nodeIds ([NodeId]) – IDs of nodes whose color to set

  • value (number()) – the value to set

Return type

void

setNodesHighlighted

Model.setNodesHighlighted(partIds, highlighted)

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

Arguments
  • partIds ([PartId]) –

  • highlighted (boolean()) – value indicating whether the supplied nodes should be highlighted.

Return type

DeprecatedPromise()

Returns

Promise that resolves when this operation has completed.

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

setNodesLineColor

Model.setNodesLineColor(nodeIds, color)

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

Arguments
  • nodeIds ([NodeId]) – IDs of nodes whose color to set

  • color (Color()) – the color to set

Return type

DeprecatedPromise()

Returns

Promise that resolves when this operation has completed.

setNodesLinePattern

Model.setNodesLinePattern(nodeIds, pattern, patternLength, patternLengthUnit)

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

Arguments
  • nodeIds ([NodeId]) – 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.

Return type

void

setNodesOpacities

Model.setNodesOpacities(params)

Sets opacity for a given set of nodes.

Arguments
  • params (Map <NodeId, number> | 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.

Return type

void

setNodesOpacity

Model.setNodesOpacity(nodeIds, opacity)

Sets opacity for a given list of nodes.

Arguments
  • nodeIds ([NodeId]) – 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.

Return type

void

setNodesPointColor

Model.setNodesPointColor(nodeIds, color)

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

Arguments
  • nodeIds ([NodeId]) – IDs of nodes whose color to set

  • color (Color()) –

Return type

void

Returns

Promise that resolves when this operation has completed.

setNodesTexture

Model.setNodesTexture(nodeIds, options)

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

Arguments
  • nodeIds ([NodeId]) – The nodes on which to apply the texture

  • options (TextureOptions()) – Options specifying how the texture is applied

Return type

Promise <void>

setNodesTransparencies

Model.setNodesTransparencies(params)
Deprecated

use setNodesOpacities instead.

Arguments
Return type

DeprecatedPromise()

setNodesTransparency

Model.setNodesTransparency(nodeIds, transparency)
Deprecated

use setNodesOpacity instead.

Arguments
  • nodeIds ([NodeId]) –

  • transparency (number()) –

Return type

DeprecatedPromise()

setNodesVisibilities

Model.setNodesVisibilities(mapping[, initiallyHiddenStayHidden])

Sets the visibility for a given set of nodes.

Arguments
  • mapping (Map <NodeId, boolean> | IdBooleanMap()) – The mapping of node IDs to boolean value indicating the visibility setting for that node.

  • initiallyHiddenStayHidden (boolean | null()) – optional Controls whether or not initially hidden geometries stay hidden. Default behavior is driven by setBehaviorInitiallyHidden

Return type

Promise <void>

Returns

Promise that resolves when the operation has completed.

setNodesVisibility

Model.setNodesVisibility(nodeIds, visibility[, initiallyHiddenStayHidden])

Sets visibility for a given list of nodes.

Arguments
  • nodeIds ([NodeId]) – The node IDs whose visibilities will be set.

  • visibility (boolean()) – If true, nodes will be shown. If false, they will be hidden.

  • initiallyHiddenStayHidden (boolean | null()) – optional Controls whether or not initially hidden geometries stay hidden. Default behavior is driven by setBehaviorInitiallyHidden

Return type

Promise <void>

Returns

Promise that resolves when the operation has completed.

setPMIColor

Model.setPMIColor(color)
Deprecated

Use setPmiColor instead.

Arguments
Return type

void

setPMIColorOverride

Model.setPMIColorOverride(enableOverride)
Deprecated

Use setPmiColorOverride instead.

Arguments
  • enableOverride (boolean()) –

Return type

DeprecatedPromise()

setPart

Model.setPart(assemblyNodeId, partNodeId)

Set a part on an assembly node

Arguments
  • assemblyNodeId (NodeId | undefined | null) –

  • partNodeId (PartId | undefined | null) –

Return type

boolean

Returns

true if all went right, false otherwise

setPhysicalProperties

Model.setPhysicalProperties(nodeId, gravityCenter, surfaceArea, volume)

Purpose: Sets physical properties

Arguments
  • nodeId (NodeId) – node id to set the property on, the node id has to be a body node

  • gravityCenter (Point3()) – gravity center in local coordinates

  • surfaceArea (number()) – surface area, in squared current unit

  • volume (number()) – volume, in cubed current unit

Return type

boolean

Returns

true if all went right, false otherwise

setPmiColor

Model.setPmiColor(color)

Saves a PMI override color

Arguments
  • color (Color()) – the override color

Return type

void

setPmiColorOverride

Model.setPmiColorOverride(enableOverride[, rootId])

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

Arguments
  • enableOverride (boolean()) –

  • rootId (NodeId) – optional

Return type

DeprecatedPromise()

Returns

Promise that resolves when this operation has completed.

setViewAxes

Model.setViewAxes(frontVector, upVector)

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

Arguments
Return type

void

switchToModel

Model.switchToModel(newModelFilename)

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

Arguments
  • newModelFilename (ScModelName) – Name of the model file to load after the existing scene gets deleted

Return type

Promise <[NodeId]>

Returns

A Promise of the newly loaded model’s root nodes IDs.

triangulatePolygon

Model.triangulatePolygon(polygonPoints, normal)

Triangulates the supplied polygon.

Arguments
  • polygonPoints (Float32Array | [number]()) – An array of point data for the polygon. Points are stored [XYZXYZXYZ…] format.

  • normal (Point3()) – The normal of the polygon to triangulate.

Return type

Float32Array

Returns

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).

unsetDepthRange

Model.unsetDepthRange(nodeIds)

Unsets the depth range set by setDepthRange

Arguments
  • nodeIds ([NodeId]) – the node IDs to operate on

Return type

void

unsetMetallicRoughness

Model.unsetMetallicRoughness(nodeIds)

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

Arguments
  • nodeIds ([NodeId]) – List of nodes to unset material properties for

Return type

void

unsetNodeFaceColor

Model.unsetNodeFaceColor(partId, faceId)

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

Arguments
  • partId (PartId) –

  • faceId (number()) – the Id of the face in the node that will have its color unset

Return type

DeprecatedPromise()

unsetNodeLineColor

Model.unsetNodeLineColor(partId, lineId)

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

Arguments
  • partId (PartId) –

  • lineId (number()) – the Id of the line in the node that will have its color unset

Return type

DeprecatedPromise()

unsetNodePointColor

Model.unsetNodePointColor(partId, pointId)

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

Arguments
  • partId (PartId) – the Id of the node containing the point

  • pointId (number()) – the Id of the point in the node that will have its color unset

Return type

void

unsetNodesCullingVectors

Model.unsetNodesCullingVectors(nodeIds)

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

Arguments
  • nodeIds ([NodeId]) – The nodes to unset culling vectors on.

Return type

DeprecatedPromise()

unsetNodesFaceColor

Model.unsetNodesFaceColor(nodeIds)

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

Arguments
  • nodeIds ([NodeId]) – IDs of nodes to modify

Return type

DeprecatedPromise()

Returns

Promise that resolves when this operation has completed.

unsetNodesFaceEmissiveColor

Model.unsetNodesFaceEmissiveColor(nodeIds)

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

Arguments
  • nodeIds ([NodeId]) – IDs of nodes whose color to reset

Return type

void

unsetNodesFaceSpecularColor

Model.unsetNodesFaceSpecularColor(nodeIds)

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

Arguments
  • nodeIds ([NodeId]) – IDs of nodes whose color to reset

Return type

void

unsetNodesFaceSpecularIntensity

Model.unsetNodesFaceSpecularIntensity(nodeIds)

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

Arguments
  • nodeIds ([NodeId]) – IDs of nodes whose color to set

Return type

void

unsetNodesLineColor

Model.unsetNodesLineColor(nodeIds)

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

Arguments
  • nodeIds ([NodeId]) – IDs of nodes to modify

Return type

DeprecatedPromise()

Returns

Promise that resolves when this operation has completed.

unsetNodesLinePattern

Model.unsetNodesLinePattern(nodeIds)

Removes the line pattern applied by setNodesLinePattern

Arguments
  • nodeIds ([NodeId]) – The IDs of the nodes.

Return type

void

unsetNodesPointColor

Model.unsetNodesPointColor(nodeIds)

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

Arguments
  • nodeIds ([NodeId]) – IDs of nodes to modify

Return type

void

unsetNodesTexture

Model.unsetNodesTexture(nodeIds)

Remove one or more textures applied via setNodesTexture

Arguments
  • nodeIds ([NodeId]) – The nodes from which to remove the texture or textures

Return type

void

viewAxesHaveBeenSet

Model.viewAxesHaveBeenSet()

Gets whether there has been a successful call to setViewAxes.

Return type

boolean