Communicator.Model

 Model

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

More information can be found here.

Methods

Methods

activateCADConfiguration    [deprecated]

  • activateCADConfiguration(nodeId: NodeId): Promise<void>

activateCADDefaultConfiguration    [deprecated]

  • activateCADDefaultConfiguration(): Promise<void>

activateCADView    [deprecated]

  • activateCADView(nodeId: NodeId, duration?: number): Promise<void>
  • deprecated

    Use activateCadView instead.

    Parameters

    • nodeId: NodeId
    • Optional duration: number

    Returns Promise<void>

activateCadConfiguration

  • activateCadConfiguration(nodeId: NodeId): Promise<void>
  • Activates a CAD configuration

    Parameters

    Returns Promise<void>

    None.

activateCadView

  • activateCadView(nodeId: NodeId, duration?: number): Promise<void>
  • Activates a CAD View

    Parameters

    • nodeId: NodeId
    • Optional duration: number

      camera transition time in milliseconds.

    Returns Promise<void>

    None.

activateDefaultCadConfiguration

  • activateDefaultCadConfiguration(): Promise<void>
  • Activates Default CAD configuration

    Returns Promise<void>

    None.

addPropertyToNode

  • addPropertyToNode(nodeId: NodeId, propertyName: string, propertyValue: string): boolean
  • Purpose: Adds a property to the node

    Parameters

    • nodeId: NodeId

      node id to set the property on

    • propertyName: string
    • propertyValue: string

    Returns boolean

    true if all went right, false otherwise

cadConfigurationsEnabled

  • cadConfigurationsEnabled(): Promise<boolean>
  • Gets whether or not cad configurations are enabled

    Returns Promise<boolean>

    Boolean indicating whether or not cad configurations are enabled

clear

  • clear(): Promise<void>
  • Remove all nodes, CAD views, configurations, and sheets from the model.

    Returns Promise<void>

computeMinimumBodyBodyDistance

  • Computes the distance between two bodies

    Parameters

    • partId1: PartId

      id for the part which the first face belongs to

    • partId2: PartId

      id for the part which the second face belongs to

    Returns Promise<FaceFaceDistanceItem>

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

computeMinimumFaceFaceDistance

  • Computes the distance between two faces

    Parameters

    • 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

    Returns Promise<FaceFaceDistanceItem>

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

computeMinimumFaceLineDistance

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

    Parameters

    • partId: PartId
    • faceId: number

      id of the face in the node

    • ray: Ray

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

    Returns Promise<FaceFaceDistanceItem>

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

computeMinimumFaceRayDistance

  • Computers the minimum distance between a face and a ray.

    Parameters

    • partId: PartId
    • faceId: number

      id of the face in the node

    • ray: Ray

      the ray to test against

    Returns Promise<FaceFaceDistanceItem>

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

createAndAddBody    [deprecated]

  • createAndAddBody(partNodeId: PartId | undefined | null, repItemId?: NodeId | null): NodeId | null

createAndAddRepresentationItem

  • createAndAddRepresentationItem(partNodeId: PartId | undefined | null, repItemId?: NodeId | null): NodeId | null
  • Creates a representation item on a part

    Parameters

    • partNodeId: PartId | undefined | null

      ID of the part node

    • Optional repItemId: NodeId | null

      (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 NodeId | null

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

createCADView    [deprecated]

  • createCADView(nodeId: NodeId, viewName: string, camera: Camera, pmiIds?: PmiId[], nodesToShow?: NodeId[], nodesToHide?: NodeId[], nodesIdAndLocalTransforms?: [NodeId, Matrix][], cuttingPlane?: Plane, meshInstanceData?: MeshInstanceData): CadViewId | null
  • deprecated

    Use createCadView instead.

    Parameters

    • nodeId: NodeId
    • viewName: string
    • camera: Camera
    • Optional pmiIds: PmiId[]
    • Optional nodesToShow: NodeId[]
    • Optional nodesToHide: NodeId[]
    • Optional nodesIdAndLocalTransforms: [NodeId, Matrix][]
    • Optional cuttingPlane: Plane
    • Optional meshInstanceData: MeshInstanceData

    Returns CadViewId | null

createCadView

  • createCadView(nodeId: NodeId, viewName: string, camera: Camera, pmiIds?: PmiId[] | null, nodesToShow?: NodeId[] | null, nodesToHide?: NodeId[] | null, nodeIdsAndLocalTransforms?: [NodeId, Matrix][] | null, cuttingPlane?: Plane | null, meshInstanceData?: MeshInstanceData | null): CadViewId | null
  • Creates a CAD view. This method will trigger a "cadViewCreated" callback if the creation is successful.

    Parameters

    • nodeId: NodeId
    • viewName: string

      Name of the view

    • camera: Camera

      Camera that will be set when the view gets activated

    • Optional pmiIds: PmiId[] | null

      (optional, pass null or empty array if none to send) Node IDs of the PMI to show for the view

    • Optional nodesToShow: NodeId[] | null

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

    • Optional nodesToHide: NodeId[] | null

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

    • Optional nodeIdsAndLocalTransforms: [NodeId, Matrix][] | null

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

    • Optional cuttingPlane: Plane | null

      (optional, pass null if none to send) Cutting plane to set when the view gets activated

    • Optional meshInstanceData: MeshInstanceData | null

      (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 CadViewId | null

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

createImage

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

    Parameters

    • primaryImage: ImageOptions

      The image data and associated options

    • Optional 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<ImageId>

createMesh

  • Parameters

    • meshData: MeshData

      MeshData object containing data to insert into the scene.

    • Optional config: object
      • Optional doNotDelete?: boolean

        If true, the mesh won't be deleted when the model is cleared or switched.

    Returns Promise<MeshId>

    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

  • createMeshInstance(data: MeshInstanceData, parentNodeId?: NodeId | null, preventFromResetting?: boolean | null, isOutOfHierarchy?: boolean | null): Promise<NodeId>
  • 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

    • Optional parentNodeId: NodeId | null

      the ID of the desired parent node

    • Optional preventFromResetting: boolean | null

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

    • Optional isOutOfHierarchy: boolean | null

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

    Returns Promise<NodeId>

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

createNode

  • createNode(parentNodeId: NodeId | undefined | null, nodeName: string, nodeId?: NodeId | null, localMatrix?: Matrix | null, visibility?: boolean | null, measurementUnit?: number | null): NodeId
  • Creates a node

    Parameters

    • 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
    • Optional nodeId: NodeId | null
    • Optional localMatrix: Matrix | null

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

    • Optional visibility: boolean | null

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

    • Optional measurementUnit: number | null

    Returns NodeId

    child node ID

createPMIInstance    [deprecated]

createPart

  • Creates an part node

    Parameters

    • Optional nodeId: NodeId | null

    Returns PartId

    a node ID to access the created part node

createPmiInstance

  • 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

    • Optional parentNodeId: NodeId | null

      the ID of the desired parent node

    Returns Promise<PmiId>

    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

  • deleteImages(imageIds: ImageId[]): Promise<void>
  • Deletes images created with createImage.

    Parameters

    • imageIds: ImageId[]

      The IDs of the images to be deleted

    Returns Promise<void>

deleteMeshInstances

  • deleteMeshInstances(nodeIds: NodeId[]): Promise<void>
  • Deletes mesh instances that have been created at run time

    Parameters

    • nodeIds: NodeId[]

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

    Returns Promise<void>

    Promise that resolves when this operation has completed.

deleteMeshes

  • deleteMeshes(ids: MeshId[]): Promise<void>
  • 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<void>

    Promise that resolves when this operation has completed.

deleteNode

  • deleteNode(nodeId: NodeId): Promise<void>
  • Delete a node and all its children

    Parameters

    Returns Promise<void>

getAbsoluteRootNode

  • getAbsoluteRootNode(): NodeId
  • Returns the absolute root node of the assembly tree.

    Returns NodeId

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

getActiveCadConfiguration

  • getActiveCadConfiguration(): NodeId | null
  • Gets Active CAD configuration

    Returns NodeId | null

    ID of activated CAD Configuration

getAssociatedModelKey

  • getAssociatedModelKey(nodeId: NodeId): Promise<ModelKey | null>
  • Parameters

    Returns Promise<ModelKey | null>

getBranchVisibility

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

    Parameters

    • nodeId: NodeId

      ID of the node at the root of the branch.

    Returns BranchVisibility

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

getCADActiveConfiguration    [deprecated]

  • getCADActiveConfiguration(): NodeId | null

getCADConfigurations    [deprecated]

getCADDefaultConfiguration    [deprecated]

  • getCADDefaultConfiguration(): NodeId | null

getCADViewPMIs    [deprecated]

  • getCADViewPMIs(nodeId: NodeId): PmiId[]

getCADViews    [deprecated]

getCadConfigurations

  • Gets CAD configurations

    Returns IdStringMap

    an object mapping CAD configuration ID to config name

getCadViewMap

  • getCadViewMap(): Map<NodeId, string>
  • Gets CAD View information for this model.

    Returns Map<NodeId, string>

    a map mapping associating CAD View ID to name

getCadViewPmis

  • getCadViewPmis(nodeId: NodeId): PmiId[]
  • Get PMI IDs for a CAD View

    Parameters

    Returns PmiId[]

    IDs of visible PMIs for the view

getCadViews    [deprecated]

getClientDimensions

  • getClientDimensions(): [number, number]
  • Returns the dimensions of the client.

    Returns [number, number]

    a pair of numbers, [width, height].

getDataFromIds

  • getDataFromIds(ids: SC.DataIds): Promise<Uint8Array[]>
  • Returns a chunk of keyed data

    Parameters

    • ids: SC.DataIds

    Returns Promise<Uint8Array[]>

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

getDataFromKeys    [deprecated]

  • getDataFromKeys(ids: SC.DataIds): Promise<Uint8Array[]>
  • deprecated

    Use getDataFromIds instead.

    Parameters

    • ids: SC.DataIds

    Returns Promise<Uint8Array[]>

getDefaultCadConfiguration

  • getDefaultCadConfiguration(): NodeId | null
  • Gets CAD default configuration

    Returns NodeId | null

    ID of default CAD Configuration

getEdgeAttributes

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

    Parameters

    • nodeId: NodeId

      Node to retrieve edge properties from

    • edgeIndex: number

      Index of edge for which to retrieve edge attributes

    Returns Promise<SubentityAttributes | null>

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

getEdgeCount

  • getEdgeCount(nodeId: NodeId): Promise<number>
  • Returns edge count for a node of the given node.

    Parameters

    • nodeId: NodeId

      Node to retrieve edge count from

    Returns Promise<number>

    Promise providing the number of edges

getEdgeProperty

  • getEdgeProperty(nodeId: NodeId, edgeId: number): Promise<Edge | null>
  • Returns edge properties for a node of the given node and edge.

    Parameters

    • nodeId: NodeId

      Node to retrieve edge properties from

    • edgeId: number

    Returns Promise<Edge | null>

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

getFaceAttributes

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

    Parameters

    • nodeId: NodeId

      Node to retrieve edge properties from

    • faceIndex: number

      Index of face for which to retrieve face attributes

    Returns Promise<SubentityAttributes | null>

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

getFaceCount

  • getFaceCount(nodeId: NodeId): Promise<number>
  • Returns face count for a node of the given node and face.

    Parameters

    • nodeId: NodeId

      Node to retrieve face count from

    Returns Promise<number>

    Promise providing the number of faces

getFaceProperty

  • getFaceProperty(nodeId: NodeId, faceId: number): Promise<Face | null>
  • Returns Face properties for a node of the given node and face.

    Parameters

    • nodeId: NodeId

      Node to retrieve face properties from

    • faceId: number

    Returns Promise<Face | null>

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

getFilterName

  • Parameters

    Returns FilterName | null

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

getFilters

  • Returns names and ids of all filters available in the scene

    Returns Map<FilterId, FilterName>

    a map associating Filter IDs to filter names

getFiltersWithNode

  • getFiltersWithNode(nodeIdSearched: NodeId): FilterId[]
  • Parameters

    Returns FilterId[]

    Filters which retain or remove the given node.

getGenericTypeIdMap

  • Gets all generic types and NodeIds with that type.

    Returns Map<GenericType, Set<NodeId>>

    Map containing generic types and NodeIds

getGenericTypes

  • getGenericTypes(): GenericType[]
  • This function gets all generic types contained in the model.

    Returns GenericType[]

    All generic types.

getIfcNodeIds    [deprecated]

getIfcTypeByNodeId    [deprecated]

getIfcTypes    [deprecated]

  • getIfcTypes(): GenericType[]

getLayerIdsFromName

  • getLayerIdsFromName(name: LayerName): LayerId[] | null
  • Parameters

    Returns LayerId[] | null

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

getLayerName

  • Parameters

    Returns LayerName | null

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

getLayers

  • Returns names and ids of all layers available in the scene

    Returns Map<LayerId, LayerName>

    a map associating Layer IDs to Layer names

getLowestAvailableNodeID    [deprecated]

  • getLowestAvailableNodeID(): NodeId

getLowestAvailableNodeId

  • getLowestAvailableNodeId(): NodeId
  • Returns the lowest available node ID

    Returns NodeId

getMeshIds

  • getMeshIds(nodeIds: NodeId[]): Promise<MeshId[]>
  • Retrieve the MeshId associated with the mesh data attached to the given nodes.

    Parameters

    • nodeIds: NodeId[]

    Returns Promise<MeshId[]>

getModelBounding

  • getModelBounding(ignoreInvisible: boolean, includeExcluded: boolean, tightBounding?: boolean): Promise<Box>
  • Gets the world space bounding box for the model.

    Parameters

    • ignoreInvisible: boolean
    • includeExcluded: boolean
    • Optional tightBounding: boolean

    Returns Promise<Box>

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

getModelFileNameFromNode

  • getModelFileNameFromNode(nodeId: NodeId): string | null
  • Parameters

    Returns string | null

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

getModelFileTypeFromNode

  • Parameters

    Returns FileType | null

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

getNodeChildren

  • getNodeChildren(nodeId: NodeId, includeOutOfHierarchy?: boolean): NodeId[]
  • Returns IDs for child nodes for the given Id.

    Parameters

    • nodeId: NodeId
    • Optional includeOutOfHierarchy: boolean

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

    Returns NodeId[]

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

getNodeColorMap

  • 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: NodeId

      The start node to walk when building the color map.

    • elementType: ElementType

      Returned colors are of this element type.

    Returns Promise<Map<NodeId, Color>>

getNodeEffectiveFaceColor

  • getNodeEffectiveFaceColor(partId: PartId, faceIndex: number): Promise<Color | null>
  • 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: PartId
    • faceIndex: number

      the index of the face in the node

    Returns Promise<Color | null>

getNodeEffectiveLineColor

  • getNodeEffectiveLineColor(partId: PartId, lineIndex: number): Promise<Color | null>
  • 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: PartId
    • lineIndex: number

      the index of the line in the node

    Returns Promise<Color | null>

getNodeExchangeId

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

    Parameters

    • nodeId: NodeId

      The node ID to get the Exchange ID of.

    Returns ExchangeId | null

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

getNodeFaceColor

  • getNodeFaceColor(partId: PartId, faceIndex: number): Promise<Color | null>

getNodeFaceHighlighted

  • getNodeFaceHighlighted(nodeId: NodeId, faceIndex: number): Promise<boolean>
  • Returns whether the supplied face element has been highlighted with setNodeFaceHighlighted.

    Parameters

    • nodeId: NodeId

      the ID of the node containing the face element

    • faceIndex: number

      the index of the face within the node

    Returns Promise<boolean>

getNodeGenericId

  • Parameters

    Returns GenericId | null

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

getNodeGenericType

  • Parameters

    Returns GenericType | null

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

getNodeIDFromSCInstanceKey    [deprecated]

  • getNodeIDFromSCInstanceKey(inclusionKey: InclusionKey, instanceKey: InstanceKey): NodeId | null
  • Returns the body node instance ID for the given SC instance ID

    deprecated

    Parameters

    • inclusionKey: InclusionKey
    • instanceKey: InstanceKey

    Returns NodeId | null

    body node instance ID

getNodeIdOffset

  • Retrieves the node ID offset for a given node.

    Parameters

    • nodeId: NodeId

      The node to obtain the node ID offset from.

    Returns NodeIdOffset

    The node ID offset for the supplied node.

getNodeIdsByGenericIds

  • getNodeIdsByGenericIds(genericIds: GenericId[]): NodeId[]
  • Parameters

    • genericIds: GenericId[]

    Returns NodeId[]

getNodeIdsByIfcGuids    [deprecated]

  • getNodeIdsByIfcGuids(ifcGuids: IfcGuid[]): NodeId[]

getNodeLayerId

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

    Parameters

    • nodeId: NodeId

      The node ID to get the Exchange ID of.

    Returns LayerId | null

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

getNodeLineColor

  • getNodeLineColor(partId: PartId, lineIndex: number): Promise<Color | null>
  • Gets the color set via setNodeLineColor on a line element. If no color has been set, null will be returned.

    Parameters

    • partId: PartId
    • lineIndex: number

      the index of the line in the node

    Returns Promise<Color | null>

getNodeLineHighlighted

  • getNodeLineHighlighted(nodeId: NodeId, lineIndex: number): Promise<boolean>
  • Returns whether the supplied line element has been highlighted with setNodeLineHighlighted.

    Parameters

    • nodeId: NodeId

      the ID of the node containing the line element

    • lineIndex: number

      the index of the line within the node

    Returns Promise<boolean>

getNodeMatrix

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

    Parameters

    Returns Matrix

    Copy of the Matrix of the node

getNodeMeshData

  • Fetch the mesh data for a particular node

    Parameters

    • nodeId: NodeId

      the node's ID

    Returns Promise<MeshDataCopy>

getNodeName

  • getNodeName(nodeId: NodeId): string | null
  • Returns the name for a node in the assembly tree.

    Parameters

    • nodeId: NodeId

      The node ID to get the name of.

    Returns string | null

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

getNodeNetMatrix

  • Returns net matrix for a node of the given ID

    Parameters

    Returns Matrix

    Net Matrix of the Node

getNodeParent

  • Returns the parent Id for the given node id.

    Parameters

    Returns NodeId | null

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

getNodePointHighlighted

  • getNodePointHighlighted(nodeId: NodeId, pointIndex: number): Promise<boolean>
  • Returns whether the supplied point element has been highlighted with setNodePointHighlighted.

    Parameters

    • nodeId: NodeId

      the ID of the node containing the point element

    • pointIndex: number

      the index of the point within the node

    Returns Promise<boolean>

getNodeProperties

  • Returns the properties for the given node ID.

    Parameters

    Returns Promise<StringStringMap | null>

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

getNodeRealBounding

  • getNodeRealBounding(nodeId: NodeId): Promise<Box>
  • 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: NodeId

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

    Returns Promise<Box>

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

getNodeType

  • Returns the type of the node with the given ID.

    Parameters

    Returns NodeType

    The type of the node.

getNodeUnitMultiplier

  • getNodeUnitMultiplier(nodeId: NodeId): 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

    Returns number

    The unit multiplier for the model (in mm)

getNodeUserData

  • Returns the user data for a given node and index.

    throws

    InvalidNodeIdError InvalidIndexError

    Parameters

    Returns Uint8Array

    The user data.

getNodeUserDataIndices

  • getNodeUserDataIndices(nodeId: NodeId): UserDataIndex[]
  • Returns all the UserDataIndex items associated with the input node.

    throws

    InvalidNodeIdError

    Parameters

    • nodeId: NodeId

      The ID of the node to query.

    Returns UserDataIndex[]

    A list of UserDataIndex, possibly empty.

getNodeVisibility

  • getNodeVisibility(nodeId: NodeId): boolean
  • Returns the current visibility for a node.

    Parameters

    • nodeId: NodeId

      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.

getNodesBounding

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

    Parameters

    • nodeIds: NodeId[]

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

    • Optional config: GetNodesBoundingConfig

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

    Returns Promise<Box>

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

getNodesByGenericType

  • This function returns all NodeIds with an IFC type.

    Parameters

    Returns Set<NodeId> | null

    All NodeIds with an IFC type

getNodesByIfcType    [deprecated]

getNodesCullingVectors

  • getNodesCullingVectors(nodeIds: NodeId[]): Promise<CullingVector[]>
  • 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: NodeId[]

      The nodes to query culling vectors from.

    Returns Promise<CullingVector[]>

    A promise of culling vectors.

getNodesEffectiveFaceColor

  • getNodesEffectiveFaceColor(nodeIds: NodeId[]): Promise<Color[]>
  • 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: NodeId[]

      IDs of the nodes to be queried

    Returns Promise<Color[]>

getNodesEffectiveLineColor

  • getNodesEffectiveLineColor(nodeIds: NodeId[]): Promise<Color[]>
  • 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: NodeId[]

      IDs of the nodes to be queried

    Returns Promise<Color[]>

getNodesEffectiveOpacity

  • getNodesEffectiveOpacity(leafNodes: NodeId[], elementType: ElementType): Promise<number[]>
  • 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: NodeId[]
    • elementType: ElementType

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

    Returns Promise<number[]>

getNodesEffectiveTransparency    [deprecated]

  • getNodesEffectiveTransparency(leafNodes: NodeId[], elementType: ElementType): Promise<number[]>

getNodesFaceColor

  • getNodesFaceColor(nodeIds: NodeId[]): Promise<Color[]>
  • 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

    Parameters

    • nodeIds: NodeId[]

      IDs of the nodes to be queried

    Returns Promise<Color[]>

getNodesFromFiltersId

  • getNodesFromFiltersId(filtersId: FilterId[]): FilteredNodes | null
  • Parameters

    • filtersId: FilterId[]

      array of filters indexes to take in account

    Returns FilteredNodes | null

    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

  • getNodesFromLayer(layerId: LayerId, onlyTreeNodes?: boolean): NodeId[] | null
  • Returns IDs of nodes in the given layer.

    Parameters

    • layerId: LayerId

      The layer ID to get nodes from.

    • Optional onlyTreeNodes: boolean

      if true return only nodes present in model Tree

    Returns NodeId[] | null

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

getNodesFromLayerName

  • getNodesFromLayerName(layerName: LayerName, onlyTreeNodes?: boolean): NodeId[] | null
  • Returns IDs of nodes in the given layer.

    Parameters

    • layerName: LayerName
    • Optional onlyTreeNodes: boolean

      if true return only nodes present in model Tree

    Returns NodeId[] | null

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

getNodesFromLayers

  • getNodesFromLayers(layersId: LayerId[], onlyTreeNodes?: boolean): NodeId[] | null
  • Returns IDs of nodes in given layers.

    Parameters

    • layersId: LayerId[]

      Array of layers Id to get nodes from.

    • Optional onlyTreeNodes: boolean

      if true return only nodes present in model Tree

    Returns NodeId[] | null

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

getNodesHaveTransparency

  • getNodesHaveTransparency(nodeIds: NodeId[]): Promise<boolean[]>
  • Returns whether nodes with the given NodeIds have an opacity value that is not fully opaque.

    Parameters

    • nodeIds: NodeId[]

      IDs of nodes to query.

    Returns Promise<boolean[]>

    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

  • getNodesHighlighted(partIds: PartId[]): Promise<boolean[]>
  • Returns whether the supplied nodes have been highlighted with setNodesHighlighted.

    Parameters

    • partIds: PartId[]

    Returns Promise<boolean[]>

getNodesInstancingSamePart

  • getNodesInstancingSamePart(nodeId: NodeId): Promise<NodeId[] | null>
  • 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

    Returns Promise<NodeId[] | null>

    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

  • getNodesLineColor(nodeIds: NodeId[]): Promise<Color[]>
  • 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: NodeId[]

      IDs of the nodes to be queried

    Returns Promise<Color[]>

getNodesOpacity

  • getNodesOpacity(leafNodes: NodeId[]): Promise<number[]>
  • 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: NodeId[]

    Returns Promise<number[]>

getNodesTransparency    [deprecated]

  • getNodesTransparency(leafNodes: NodeId[]): Promise<number[]>
  • deprecated

    use getNodesOpacity instead.

    Parameters

    • leafNodes: NodeId[]

    Returns Promise<number[]>

getOutOfHierarchy

  • getOutOfHierarchy(nodeId: NodeId): boolean
  • Returns "Out Of Hierarchy" status for child node for the given Id.

    Parameters

    Returns boolean

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

getPMIColor    [deprecated]

getPMIColorOverride    [deprecated]

  • getPMIColorOverride(): boolean

getPMISubtype    [deprecated]

getPMIType    [deprecated]

getPMIs    [deprecated]

getPmiColor

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

    Returns Color

    color

getPmiColorOverride

  • getPmiColorOverride(): boolean
  • Returns boolean

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

getPmiSubtype

  • Returns the subtype of a given PMI

    Parameters

    Returns PmiSubType

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

getPmiTopologyReferences

  • getPmiTopologyReferences(pmiNodeId: NodeId): RefOnTopoItem[] | null
  • Gets an array of PMI topology references linking a PMI node to a body element, like a face or an edge.

    Parameters

    • pmiNodeId: NodeId

      the ID of the PMI node.

    Returns RefOnTopoItem[] | null

getPmiType

  • Returns the type of a given PMI

    Parameters

    Returns PmiType

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

getPmis

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

    Returns IdStringMap

    a map associating PMI IDs to PMI names

getPrimaryModelId    [deprecated]

  • getPrimaryModelId(): Promise<ModelKey>
  • deprecated

    Returns Promise<ModelKey>

getPrimaryModelKey    [deprecated]

  • getPrimaryModelKey(): Promise<ModelKey>
  • deprecated

    Returns Promise<ModelKey>

getRootNode    [deprecated]

getSCInstanceKey    [deprecated]

  • getSCInstanceKey(bodyId: BodyId): SC.InstanceInc | null
  • Returns the SC ID of a body instance

    deprecated

    Parameters

    Returns SC.InstanceInc | null

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

getUniqueLayerNames

  • getUniqueLayerNames(): LayerName[]
  • Return names of layers. Different layers can have the same name. Some layers can be unnamed.

    Returns LayerName[]

    Names of layers

getUnitMultiplier    [deprecated]

  • getUnitMultiplier(): number
  • 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.

    Returns number

    The unit multiplier for the model (in mm)

getViewAxes

  • Returns ViewAxes

    the up and front vectors for the model coordinate system.

getVisibilityState

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

    Parameters

    Returns Promise<VisibilityState>

hasDepthRange

  • hasDepthRange(nodeIds: NodeId[]): Promise<boolean[]>
  • Parameters

    • nodeIds: NodeId[]

    Returns Promise<boolean[]>

hasEffectiveGenericType

isAnnotationView

  • isAnnotationView(cadViewNodeId: CadViewId): boolean
  • Tells if the view is an annotation view or not

    Parameters

    • cadViewNodeId: CadViewId

      Node ID of the CAD view

    Returns boolean

    true if the view is an annotation view

isDrawing

  • isDrawing(): boolean
  • Tells if the model is a CAD drawing or not

    Returns boolean

    true if the model is a CAD drawing

isMeasurable

  • isMeasurable(): boolean
  • Returns boolean

    true if the model contains measurement data.

isNodeLoaded

  • isNodeLoaded(nodeId: NodeId): boolean
  • Queries if a node is fully loaded or not.

    Parameters

    • nodeId: NodeId

      The node to query.

    Returns boolean

    True if the node is fully loaded; false otherwise.

isWithinExternalModel

  • isWithinExternalModel(nodeId: NodeId): boolean
  • Returns true if the node is within an external model.

    Parameters

    Returns boolean

loadSubtreeFromModel

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

    Parameters

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

    Returns Promise<NodeId[]>

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

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

    Parameters

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

    • Optional additionalMatrix: Matrix | null

      Optional matrix to get multiplied into the net attachment matrix.

    Returns Promise<NodeId[]>

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

loadSubtreeFromScsBuffer

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

    Parameters

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

    Returns Promise<NodeId[]>

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

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

    Parameters

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

    • Optional additionalMatrix: Matrix | null

      Optional matrix to get multiplied into the net attachment matrix.

    Returns Promise<NodeId[]>

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

loadSubtreeFromScsFile

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

    Parameters

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

    Returns Promise<NodeId[]>

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

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

    Parameters

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

    • Optional additionalMatrix: Matrix | null

      Optional matrix to get multiplied into the net attachment matrix.

    Returns Promise<NodeId[]>

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

loadSubtreeFromScsXmlBuffer

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

    Parameters

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

    Returns Promise<NodeId[]>

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

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

    Parameters

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

    • Optional 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.

    • Optional additionalMatrix: Matrix | null

      Optional matrix to get multiplied into the net attachment matrix.

    • Optional allowMissingExternalModels: boolean

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

    Returns Promise<NodeId[]>

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

loadSubtreeFromScsXmlFile

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

    Parameters

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

    Returns Promise<NodeId[]>

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

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

    Parameters

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

    • Optional 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.

    • Optional additionalMatrix: Matrix | null

      Optional matrix to get multiplied into the net attachment matrix.

    • Optional allowMissingExternalModels: boolean

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

    Returns Promise<NodeId[]>

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

loadSubtreeFromUrl    [deprecated]

loadSubtreeFromXML    [deprecated]

  • loadSubtreeFromXML(nodeId: NodeId, xmlData: string): Promise<NodeId[]>

loadSubtreeFromXmlBuffer

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

    Parameters

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

    Returns Promise<NodeId[]>

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

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

    Parameters

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

    • Optional massageModelName: MassageModelNameFunc | null

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

    • Optional additionalMatrix: Matrix | null

      Optional matrix to get multiplied into the net attachment matrix.

    • Optional allowMissingExternalModels: boolean

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

    Returns Promise<NodeId[]>

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

loadSubtreeFromXmlFile

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

    Parameters

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

    Returns Promise<NodeId[]>

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

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

    Parameters

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

    • Optional massageModelName: MassageModelNameFunc | null

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

    • Optional additionalMatrix: Matrix | null

      Optional matrix to get multiplied into the net attachment matrix.

    • Optional allowMissingExternalModels: boolean

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

    Returns Promise<NodeId[]>

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

registerBimNodes

  • registerBimNodes(startNodeId: NodeId, attributeToMask: function, legacy_useAttributeTitle?: string | boolean | null): Promise<void>
  • This function recursively discovers BIM nodes in the supplied subtree and registers them.

    Parameters

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

    • Optional legacy_useAttributeTitle: string | boolean | null

    Returns Promise<void>

    Promise that resolves when the operation has completed.

registerIfcNodes

  • registerIfcNodes(startNodeId: NodeId, legacy_useAttributeTitle?: string | boolean | null): Promise<void>
  • This function recursively discovers IFC nodes in the supplied subtree and registers them.

    Parameters

    • startNodeId: NodeId

      The root of the subtree to walk for registration.

    • Optional legacy_useAttributeTitle: string | boolean | null

    Returns Promise<void>

    Promise that resolves when the operation has completed.

replaceMesh

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

    Parameters

    Returns Promise<void>

requestNodes

  • requestNodes(nodeIds: NodeId[]): Promise<void>
  • Specifies nodes for the system to load. This method is useful when the viewer was created with the streamOnDemand option set to true.

    Parameters

    • nodeIds: NodeId[]

      array of unique IDs for the system to load

    Returns Promise<void>

reset

  • reset(): Promise<void>
  • Resets the state of the model to its default

    Returns Promise<void>

    Promise that resolves when the operation has completed.

resetModelHighlight

  • Resets highlight for all nodes in the model.

    Returns DeprecatedPromise

    Promise that resolves when this operation has completed.

resetModelOpacity

  • resetModelOpacity(): void
  • Resets opacity for all nodes in the model.

    Returns void

    Promise that resolves when this operation has completed.

resetModelTransparency    [deprecated]

resetNodeMatrixToInitial

  • resetNodeMatrixToInitial(nodeId: NodeId): Promise<void>
  • Reset node matrix to the one set as the initial one

    Parameters

    Returns Promise<void>

resetNodesColor

  • Resets color for all nodes in the model.

    Returns DeprecatedPromise

    Promise that resolves when this operation has completed.

resetNodesOpacity

  • resetNodesOpacity(nodeIds: NodeId[]): void
  • Resets opacity for a given list of nodes.

    Parameters

    • nodeIds: NodeId[]

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

    Returns void

resetNodesTransform

  • resetNodesTransform(): Promise<void>
  • Resets transform for all nodes in the model.

    Returns Promise<void>

    Promise that resolves when the operation has completed.

resetNodesTransparency    [deprecated]

resetNodesVisibility

  • resetNodesVisibility(): Promise<void>
  • Resets visibility for all nodes in the model.

    Returns Promise<void>

    Promise that resolves when the operation has completed.

setBehaviorInitiallyHidden

  • setBehaviorInitiallyHidden(enabled: boolean): void
  • By default, objects that are intially hidden stays hidden unless specificaly set to be shown. This function allows this behavior to be disabled.

    Parameters

    • enabled: boolean

      value indicating if intially hidden objects stay hidden

    Returns void

setDepthRange

  • 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: 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

    Returns DeprecatedPromise

setEdgeProperty

  • setEdgeProperty(nodeId: NodeId, edgeId: number, prop: Base): void
  • Set edge property for a node of the given node and edge.

    Parameters

    • nodeId: NodeId
    • edgeId: number
    • prop: Base

      property (CircleElement, LineElement...)

    Returns void

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

setFaceProperty

  • setFaceProperty(nodeId: NodeId, faceId: number, prop: Base): void
  • Set face property for a node of the given node and face.

    Parameters

    • nodeId: NodeId
    • faceId: number
    • prop: Base

      property (CylinderElement, PlaneElement...)

    Returns void

setInstanceModifier

  • Allows changing the behavior in the viewer

    Parameters

    • instanceModifier: InstanceModifier

      InstanceModifier

    • nodeIds: NodeId[]

      Array of node ids

    • value: boolean

      boolean

    Returns DeprecatedPromise

setMeshLevel

  • Sets the desired mesh level

    Parameters

    • nodeIds: NodeId[]

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

    • meshLevel: number

      0 standard, 1 low, 2 extra low

    Returns DeprecatedPromise

    Promise that resolves when the operation has completed.

setNodeFaceColor

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

    Parameters

    • partId: PartId
    • faceId: number

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

    • color: Color

      the color to set

    Returns DeprecatedPromise

setNodeFaceHighlighted

  • 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: 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.

    Returns DeprecatedPromise

setNodeLineColor

  • Sets the color for a line element.

    Parameters

    • partId: PartId
    • lineId: number

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

    • color: Color

      the color to set.

    Returns DeprecatedPromise

setNodeLineHighlighted

  • 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: 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.

    Returns DeprecatedPromise

setNodeMatrix

  • setNodeMatrix(nodeId: NodeId, matrix: Matrix, setAsInitial?: boolean): Promise<void>
  • Sets Matrix for a node of the given ID

    Parameters

    • nodeId: NodeId
    • matrix: Matrix
    • Optional setAsInitial: boolean

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

    Returns Promise<void>

setNodePointHighlighted

  • 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: 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.

    Returns DeprecatedPromise

setNodesColors

  • Sets colors for a given set of nodes.

    Parameters

    • colorMap: Map<NodeId, Color> | IdColorMap
    • Optional alsoApplyToWireframe: boolean

      change or not lines color

    Returns DeprecatedPromise

    Promise that resolves when this operation has completed.

setNodesCullingVector

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

    Parameters

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

    Returns DeprecatedPromise

setNodesFaceColor

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

    Parameters

    • nodeIds: NodeId[]

      IDs of nodes whose color to set

    • color: Color

      the color to set

    Returns DeprecatedPromise

    Promise that resolves when this operation has completed.

setNodesHighlighted

  • 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: PartId[]
    • highlighted: boolean

      value indicating whether the supplied nodes should be highlighted.

    Returns DeprecatedPromise

    Promise that resolves when this operation has completed.

setNodesLineColor

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

    Parameters

    • nodeIds: NodeId[]

      IDs of nodes whose color to set

    • color: Color

      the color to set

    Returns DeprecatedPromise

    Promise that resolves when this operation has completed.

setNodesLinePattern

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

    Parameters

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

    Returns void

setNodesOpacities

  • Sets opacity for a given set of nodes.

    Parameters

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

    Returns void

setNodesOpacity

  • setNodesOpacity(nodeIds: NodeId[], opacity: number): void
  • Sets opacity for a given list of nodes.

    Parameters

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

    Returns void

setNodesTexture

  • setNodesTexture(nodeIds: NodeId[], options: TextureOptions): Promise<void>
  • Apply an image to a node as a texture map. See createImage and unsetNodesTexture.

    Parameters

    • nodeIds: NodeId[]

      The nodes on which to apply the texture

    • options: TextureOptions

      Options specifying how the texture is applied

    Returns Promise<void>

setNodesTransparencies    [deprecated]

setNodesTransparency    [deprecated]

setNodesVisibilities

  • setNodesVisibilities(mapping: Map<NodeId, boolean> | IdBooleanMap, initiallyHiddenStayHidden?: boolean | null): Promise<void>
  • Sets the visibility for a given set of nodes.

    Parameters

    • mapping: Map<NodeId, boolean> | IdBooleanMap

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

    • Optional initiallyHiddenStayHidden: boolean | null

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

    Returns Promise<void>

    Promise that resolves when the operation has completed.

setNodesVisibility

  • setNodesVisibility(nodeIds: NodeId[], visibility: boolean, initiallyHiddenStayHidden?: boolean | null): Promise<void>
  • Sets visibility for a given list of nodes.

    Parameters

    • nodeIds: NodeId[]

      The node IDs whose visibilities will be set.

    • visibility: boolean

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

    • Optional initiallyHiddenStayHidden: boolean | null

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

    Returns Promise<void>

    Promise that resolves when the operation has completed.

setPMIColor    [deprecated]

  • setPMIColor(color: Color): void

setPMIColorOverride    [deprecated]

setPart

  • setPart(assemblyNodeId: NodeId | undefined | null, partNodeId: PartId | undefined | null): boolean
  • Set a part on an assembly node

    Parameters

    • assemblyNodeId: NodeId | undefined | null
    • partNodeId: PartId | undefined | null

    Returns boolean

    true if all went right, false otherwise

setPhysicalProperties

  • setPhysicalProperties(nodeId: NodeId, gravityCenter: Point3, surfaceArea: number, volume: number): boolean
  • Purpose: Sets physical properties

    Parameters

    • 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

    Returns boolean

    true if all went right, false otherwise

setPmiColor

  • setPmiColor(color: Color): void
  • Saves a PMI override color

    Parameters

    • color: Color

      the override color

    Returns void

setPmiColorOverride

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

    Parameters

    • enableOverride: boolean
    • Optional rootId: NodeId

    Returns DeprecatedPromise

    Promise that resolves when this operation has completed.

setViewAxes

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

    Parameters

    Returns void

switchToModel

  • switchToModel(newModelFilename: ScModelName): Promise<NodeId[]>
  • Delete all the current scene and load the specified model instead. Also triggers a "modelSwitched" when finished.

    Parameters

    • newModelFilename: ScModelName

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

    Returns Promise<NodeId[]>

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

triangulatePolygon

  • triangulatePolygon(polygonPoints: Float32Array | number[], normal: Point3): Float32Array
  • Triangulates the supplied polygon.

    Parameters

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

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

unsetDepthRange

  • unsetDepthRange(nodeIds: NodeId[]): void
  • Unsets the depth range set by setDepthRange.

    Parameters

    • nodeIds: NodeId[]

      the node IDs to operate on

    Returns void

unsetNodeFaceColor

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

    Parameters

    • partId: PartId
    • faceId: number

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

    Returns DeprecatedPromise

unsetNodeLineColor

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

    Parameters

    • partId: PartId
    • lineId: number

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

    Returns DeprecatedPromise

unsetNodesCullingVectors

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

    Parameters

    • nodeIds: NodeId[]

      The nodes to unset culling vectors on.

    Returns DeprecatedPromise

unsetNodesFaceColor

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

    Parameters

    • nodeIds: NodeId[]

      IDs of nodes to modify

    Returns DeprecatedPromise

    Promise that resolves when this operation has completed.

unsetNodesLineColor

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

    Parameters

    • nodeIds: NodeId[]

      IDs of nodes to modify

    Returns DeprecatedPromise

    Promise that resolves when this operation has completed.

unsetNodesLinePattern

  • unsetNodesLinePattern(nodeIds: NodeId[]): void
  • Removes the line pattern applied by setNodesLinePattern.

    Parameters

    • nodeIds: NodeId[]

      The IDs of the nodes.

    Returns void

unsetNodesTexture

  • unsetNodesTexture(nodeIds: NodeId[]): void
  • Remove one or more textures applied via setNodesTexture.

    Parameters

    • nodeIds: NodeId[]

      The nodes from which to remove the texture or textures

    Returns void

viewAxesHaveBeenSet

  • viewAxesHaveBeenSet(): boolean
  • Gets whether there has been a successful call to setViewAxes.

    Returns boolean