Options
All
  • Public
  • Public/Protected
  • All
Menu

The API for communicating with Trimble Connect 3D Viewer viewer.

Hierarchy

  • ViewerAPI

Index

Methods

  • activateTool(name: string, options?: Partial<ToolOptions>): Promise<void>
  • Activates the tool in the viewer.

    Parameters

    • name: string

      The name of the tool. "reset" value resets the tool to the default tool

    • Optional options: Partial<ToolOptions>

      The options to be set for the tool

    Returns Promise<void>

    The awaitable task

  • Adds the icon to the viewer.

    Parameters

    Returns Promise<void>

    The awaitable task

  • Adds the panorama tiles in the viewer space.

    Parameters

    Returns Promise<boolean>

    The awaitable task that will resolve into boolean.

  • Adds the point clouds into the viewer space.

    Parameters

    Returns Promise<boolean>

    The awaitable task that will resolve into boolean.

  • Adds a trimbim model to the viewer. If only visibility and placement needs to be changed, then it is suggested not to pass blob which will result in serialization penalty and reloading of the trimbim. The limit for trimbim size is 10MB.

    Parameters

    Returns Promise<boolean[]>

    The added TrimBimModel(s)

  • convertToObjectIds(modelId: string, runtimeIds: number[]): Promise<string[]>
  • Gets the external IDs for the loaded objects in the viewer with the given runtime entity IDs.

    The function throws an exception if no matching external ID is found for every runtime ID in the runtimeIds argument.

    Parameters

    • modelId: string

      The model identifier

    • runtimeIds: number[]

      The runtime identifiers of the objects

    Returns Promise<string[]>

    The awaitable task that returns the external IDs for the loaded objects in the viewer with the given runtime IDs

  • convertToObjectRuntimeIds(modelId: string, objectIds: string[]): Promise<number[]>
  • Gets the runtime entity IDs of the objects identified by external unique IDs. E.g. For the IFC format, and external id is the uncompressed guid associated with the object.

    Parameters

    • modelId: string

      The model identifier

    • objectIds: string[]

      The external object identifiers

    Returns Promise<number[]>

    A Promise which resolves to an array of runtime IDs. The return value array is always of same length as the objectIds argument array. For any index where no runtime ID was found for the given objectId, the value of the said index will be undefined or null.

  • Gets the current camera data asynchronously.

    Returns Promise<Camera>

    The awaitable task that returns the current camera data

  • Gets the current camera navigation mode in the viewer

    Returns Promise<CameraMode>

    The awaitable task that will resolve into CameraMode.

  • Gets all the colored objects in the current Trimble Connect project asynchronously.

    Returns Promise<ModelObjects[]>

    The awaitable task that returns the colored object entities in the current Trimble Connect project.

  • Retreives hierarchy children of given parent

    Parameters

    • modelId: string

      The model identifier

    • entityIds: number[]

      The parent entity ids

    • Optional hierarchyType: HierarchyType

      The hierarchy type

    • Optional recursive: boolean

      (default false) if false only direct children are returned, otherwise returns tho whole tree or children.

    Returns Promise<HierarchyEntity[]>

  • getHierarchyParents(modelId: string, entityIds: number[], hierarchyType?: HierarchyType, recursive?: boolean, containedOnly?: boolean): Promise<HierarchyEntity[]>
  • Retreives hierarchy parents of given children

    Parameters

    • modelId: string

      The model identifier

    • entityIds: number[]

      The children entity ids

    • Optional hierarchyType: HierarchyType

      The hierarchy type

    • Optional recursive: boolean

      (default false) if false only direct parents are returned, otherwise returns all parents up to hierarchy roots.

    • Optional containedOnly: boolean

      (default false) if false the parent will be returned when atleast one child is given in entityIds, otherwise parent is returned only when all its children are.

    Returns Promise<HierarchyEntity[]>

  • Gets the list of icons that where added through the API.

    Returns Promise<PointIcon[]>

    The awaitable task that returns the list of icons.

  • getLayers(modelId: string): Promise<Layer[]>
  • Gets the list of layers asynchronously.

    Parameters

    • modelId: string

      The identifier of the model to which the layers belong

    Returns Promise<Layer[]>

    The awaitable task that returns the model object entities in the current Trimble Connect 3D Viewer

  • getLoadedModel(modelId: string): Promise<File>
  • Get the loaded model file

    Parameters

    • modelId: string

      The identifier of the model

    Returns Promise<File>

    The awaitable task that returns the model file

  • Gets the list of all models that are available from the file tree asynchronously.

    remarks

    This may not include all files in the current Trimble Connect project as the file tree only loads the files at root level at start-up. The file hierarchy is lazy-loaded when users expand a tree node.

    Parameters

    Returns Promise<ModelSpec[]>

    The awaitable task that returns the model files

  • getObjectBoundingBoxes(modelId: string, objectRuntimeIds: number[]): Promise<ObjectBoundingBox[]>
  • Gets the bounding box of the objects based on the ObjectRuntimeId.

    Parameters

    • modelId: string

      The identifier of the model to which the object belongs

    • objectRuntimeIds: number[]

      Array of objectRuntimeId.

    Returns Promise<ObjectBoundingBox[]>

    The awaitable task that returns the ObjectBoundingBox.

  • getObjectPositions(modelId: string, objectRuntimeIds: number[]): Promise<ObjectPosition[]>
  • Gets the positions of the objects based on the ObjectRuntimeId.

    deprecated

    Parameters

    • modelId: string

      The identifier of the model to which the object belongs

    • objectRuntimeIds: number[]

      Array of objectRuntimeId.

    Returns Promise<ObjectPosition[]>

    The awaitable task that returns the ObjectPosition.

  • getObjectProperties(modelId: string, objectRuntimeIds: number[]): Promise<ObjectProperties[]>
  • Gets the object properties asynchronously.

    Parameters

    • modelId: string

      The identifier of the model to which the object belongs

    • objectRuntimeIds: number[]

      The object runtime identifiers

    Returns Promise<ObjectProperties[]>

    The awaitable task that returns the model object entities in the current Trimble Connect 3D Viewer

  • Gets the objects satisfying the selector and object state criteria.

    Parameters

    • Optional selector: ObjectSelector

      The selector defining the selection criteria to retrieve the objects.

    • Optional objectState: ObjectState

      The objectState defining the visibility criteria to retrieve the objects.

    Returns Promise<ModelObjects[]>

    The awaitable task that returns the model object entities in the current Trimble Connect 3D Viewer.

  • Gets the point cloud and panorama tiles added to the viewer using addPointCloud and addPanorama

    Returns Promise<PointCloud[]>

    The awaitable task that will resolve into PointCloud

  • Gets the presentation of the current view.

    Returns Promise<Presentation>

    The awaitable task that returns the current view's presentation data.

  • Gets the list of section planes that are in 3D.

    Returns Promise<SectionPlane[]>

    The awaitable task that returns the current objects selection data

  • Gets the current objects selection data asynchronously.

    remarks

    Use ViewerAPI.getObjects to get the data of the objects with the specified identifiers.

    Returns Promise<Selection>

    The awaitable task that returns the current objects selection data

  • Gets the current viewer settings asynchronously.

    Returns Promise<ViewerSettings>

    The awaitable task that returns the current viewer settings.

  • getSnapshot(): Promise<string>
  • Gets the snapshot of the current view.

    Returns Promise<string>

    A Promise which resolves to a Data URL string containing a base64 encoded image. E.g. data:image/png;base64,SGVsbG8sIFdvcmxkIQ...

  • Gets the loaded trimbim models.

    Returns Promise<TrimbimModel[]>

    The awaitable task that returns the loaded trimbims.

  • Equivalent to the "Show only selected objects" feature in the viewer. It will simply hide all objects except the ones provided in the input.

    Parameters

    Returns Promise<boolean>

    The awaitable task that will resolve into boolean.

  • Sets the model placement asynchronously.

    Parameters

    • modelId: string

      The ID of the model whose placement will be changed

    • placement: ModelPlacement

      The model placement data to be applied

    Returns Promise<void>

    The awaitable task

  • Removes the icon from the viewer.

    Parameters

    • Optional pointIcon: PointIcon | PointIcon[]

      The icon to be removed. If the parameter is undefined, all added icons will be removed

    Returns Promise<void>

    The awaitable task

  • removeModel(modelId: string, fitToView?: boolean): Promise<boolean>
  • Removes any model file from the viewer

    Parameters

    • modelId: string

      unique identifier of the model file

    • Optional fitToView: boolean

      allows to reset the viewer camera position

    Returns Promise<boolean>

    The awaitable task that will resolve into boolean.

  • removeSectionPlanes(sectionPlaneIds?: number[]): Promise<void>
  • Removes section planes in viewer.

    Parameters

    • Optional sectionPlaneIds: number[]

      The identifiers of the sectionPlanes that needs to be removed(optional). If this value is not provided or empty array is given then all sectionPlanes will be removed.

    Returns Promise<void>

  • removeTrimbimModel(modelId?: string | string[]): Promise<void>
  • Removes the trimbim model from the viewer.

    Parameters

    • Optional modelId: string | string[]

    Returns Promise<void>

    The awaitable task

  • reset(): Promise<void>
  • Resets model, camera and tools to their default states asynchronously

    Returns Promise<void>

    The awaitable task

  • setAccessTokens(accessToken: string, refreshToken?: string): Promise<void>
  • Sets the access token of the 3D viewer asynchronously.

    deprecated

    Use EmbedAPI.setTokens instead.

    Parameters

    • accessToken: string

      The Trimble Connect access token

    • Optional refreshToken: string

      The Trimble Connect refresh token

    Returns Promise<void>

    The awaitable task

  • Sets the camera data asynchronously.

    Parameters

    • camera: CameraPreset | Camera | "reset" | ObjectSelector

      The camera data to be applied; or sets the camera to fit according to the object selector; or "reset" string to reset the camera to default; or the camera preset to be applied

    • Optional options: Partial<CameraOptions>

      The camera options to be applied, like animationTime;

    Returns Promise<void>

    The awaitable task

  • Sets the current camera navigation mode in the viewer

    Parameters

    • mode: CameraMode

      allowed camera navigation modes by the viewer

    • Optional spawnPoint: Vector3

      The spawn point for the camera mode - walk

    Returns Promise<boolean>

    The awaitable task that will resolve into boolean.

  • setLayersVisibility(modelId: string, layers: Layer[]): Promise<void>
  • Sets the layers visibility of the model asynchronously.

    Parameters

    • modelId: string

      The ID of the model whose layers visibility will be changed

    • layers: Layer[]

      A value containing the layers whom visibility will be changed

    Returns Promise<void>

    The awaitable task

  • Sets the object state asynchronously.

    Parameters

    • selector: undefined | ObjectSelector

      The selector which defines the affected objects. If the argument is undefined, the objectState is applied to all objects in the loaded models

    • objectState: ObjectState

      The object state to be applied

    Returns Promise<void>

    The awaitable task

  • setOpacity(transparency: number): Promise<void>
  • Sets the opacity of the 3D viewer asynchronously.

    Parameters

    • transparency: number

      The opacity level, which ranges from 0 to 100

    Returns Promise<void>

    The awaitable task

  • Sets the configuration of point clouds based on the modeId

    Parameters

    Returns Promise<boolean>

    The awaitable task that will resolve into boolean.

  • Define object selection in loaded 3d models.

    Parameters

    • selector: ObjectSelector

      A selector which defines to which objects to apply the mode argument to.

    • mode: SelectorMode

      The mode is applied to all objects matching the criteria defined by the selector argument

      • add = Add objects to the currently selected objects
      • remove = Remove objects from the currently selected objects
      • set = Set objects as selected. Any other objects are deselected.

    Returns Promise<void>

    The awaitable task

  • Sets the viewer settings asynchronously.

    Parameters

    Returns Promise<void>

    The awaitable task.

  • toggleModel(modelId: string | string[], loaded?: boolean, fitToView?: boolean): Promise<void>
  • Toggles the model state asynchronously.

    Parameters

    • modelId: string | string[]

      The model identifier or array of model identifiers

    • Optional loaded: boolean

      A value indicating whether the model should be loaded or unloaded. If this parameter is not defined, the model state will be toggled

    • Optional fitToView: boolean

      Value indicating if model(s) should be fitted to view after loading.

    Returns Promise<void>

    The awaitable task

  • Toggles the model version state asynchronously.

    Parameters

    • modelId: ModelVersionIdentifier | ModelVersionIdentifier[]

      The model identifier or array of model identifiers. The model identifier includes model id and version id.

    • Optional loaded: boolean

      A value indicating whether the model should be loaded or unloaded. If this parameter is not defined, the model state will be toggled

    • Optional fitToView: boolean

      Value indicating if model(s) should be fitted to view after loading.

    Returns Promise<void>

    The awaitable task