Options
All
  • Public
  • Public/Protected
  • All
Menu

Trimble Connect Workspace API

Index

Enumerations

Interfaces

Type Aliases

Variables

Functions

Type Aliases

AccessTokenCallback: EventCallback<"extension.accessToken", AccessTokenEventArgument>

The signature of the callback in the event of access token. The first parameter is the event name and the second parameter contains the access token.

AccessTokenRefreshedEventCallback: EventCallback<"embed.session.refreshed", AccessTokenEventArgument>

The signature of the callback in the event of access token. The first parameter is the event name and the second parameter contains the access token.

AngleUnit: "deg" | "rad" | "deg-min-sec"

The data structure representing the angle unit.

BackgroundColor: "White" | "LightGray" | "Default" | "Gray1" | "Gray2" | "Gray3" | "GrayDark2"

The enum structure representing the accepted background color values.

CameraChangedCallback: EventCallback<"viewer.onCameraChanged", CameraChangedEventArgument>

The signature of the callback in the event of changed camera. The first parameter is the event name and the second parameter contains the data of the new camera data.

CameraPreset: "top" | "bottom" | "front" | "back" | "left" | "right"

The supported camera preset.

DataTableConfigChangedCallback: EventCallback<"datatable.onConfigChanged", DataTableConfigChangedEventArgument>

The signature of the callback in the event of changed data table config. The first parameter is the event name and the second parameter contains the data of the changed data table config

DataTableMode: "all" | "selected" | "visible"
DetailsPanelViewMode: "edit" | "view"
EmbedSessionInvalidEventCallback: EventCallback<"embed.session.invalid", EmbedSessionInvalidEventArgument>

The signature of the callback in the event of embed session invalid. The parameter is the flag indicating the embed session being invalid.

EventCallback<TEvent, TData>: ((event: TEvent, data: TData) => void)

Type Parameters

Type declaration

    • (event: TEvent, data: TData): void
    • The callback signature for events emitted by the Trimble Connect 3D Viewer client.

      Parameters

      • event: TEvent

        The event identifier

      • data: TData

        The event data

      Returns void

EventId: keyof EventToArgMap

The IDs of the internal application events

ExtensionBroadcastCallback: EventCallback<"extension.broadcast", ExtensionBroadcastEventArgument>

The signature of the callback in the event a broadcast to the extension. The parameter is any data broadcasted by another extension or the host application.

ExtensionClosingCallback: EventCallback<"extension.closing", ExtensionCloseEventArgument>

The signature of the callback in the event of extension close. The parameter is the event name.

ExtensionCommandCallback: EventCallback<"extension.command", ExtensionCommandEventArgument>

The signature of the callback in the event of commands to the extension. The parameter is the flag indicating the command was received.

ExtensionEvents: "extension.command" | "extension.accessToken" | "extension.userSettingsChanged"

Possible events back from the Trimble Connect Web application to Trimble Connect project extension.

ExtensionType: "panel" | "properties" | "settings" | "popover" | "page"

The Extension type.

HexColor: string

The HEX color

IRouteKey: "settings-extensions" | "settings-details" | "3dviewer"

Route key for navigating the Trimble Connect Web application to a specific route

IconPickCallback: EventCallback<"viewer.onIconPicked", IconPickedEventArgument>

The signature of the callback in the event of icon picking. The first parameter is the event name and the second parameter contains the data of picked icon(s).

ImperialAreaUnit: "in2" | "ft2" | "yd2"
ImperialLengthUnit: "in" | "ft" | "yd" | "mi"
ImperialMassUnit: "oz" | "lb" | "ton"
ImperialVolumeUnit: "in3" | "ft3" | "yd3"
MetricAreaUnit: "mm2" | "cm2" | "m2" | "km2"

The data structure representing the area unit.

MetricLengthUnit: "mm" | "cm" | "m" | "km"

The data structure representing the length unit.

MetricMassUnit: "mg" | "g" | "kg" | "t"

The data structure representing the mass unit.

MetricVolumeUnit: "mm3" | "cm3" | "m3" | "km3"

The data structure representing the volume unit.

ModelId: string

The type of the model identifier

ModelResetCallback: EventCallback<"viewer.onModelReset", undefined>

The signature of the callback in the event of model reset. The first parameter is the event name.

ModelState: "loaded" | "unloaded"

The type of the model state

ModelStateChangedCallback: EventCallback<"viewer.onModelStateChanged", ModelStateChangedEventArgument>

The signature of the callback in the event of changed model state. The first parameter is the event name and the second parameter contains the state of the model.

ModelVersionId: string

The type of the model version identifier

ModelsPanelConfigChangedCallback: EventCallback<"modelsPanel.onConfigChanged", ModelsPanelConfigChangedEventArgument>

The signature of the callback in the event of changed models panel config. The first parameter is the event name and the second parameter contains the data of the changed models panel config

ModelsPanelMode: "all" | "selected"

The models panel visualisation mode.

ObjectId: string

The type of the object identifier. This is the identifier that is used to uniquely identify an object (e.g. externally in Connect).

remarks

Use the ViewerAPI.convertToObjectRuntimeIds to retrieve the ObjectRuntimeId.

ObjectRuntimeId: number

The type of the object runtime identifier. The is the identifier that is used to query the object at runtime (e.g. internally in 3D Viewer).

remarks

Use the ViewerAPI.convertToObjectIds to retrieve the ObjectId.

Permission: "accesstoken"

The state of the UI elements.

PickCallback: EventCallback<"viewer.onPicked", PointPickedEventArgument>

The signature of the callback in the event of point picking. The first parameter is the event name and the second parameter contains the data of the picked point(s).

ProjectChangedCallback: EventCallback<"project.onChanged", ProjectChangedEventArgument>

The signature of the callback in the event of changed project. The first parameter is the event name and the second parameter contains the data of the changed active project

ProjectSettingsChangedCallback: EventCallback<"project.onSettingsChanged", ProjectSettingsChangedEventArgument>

The signature of the callback in the event of changed project settings. The first parameter is the event name and the second parameter contains the data of the changed active project settings

ProjectionType: "ortho" | "perspective"

The camera projection type

PropertyPanelModelChangedCallback: EventCallback<"propertyPanel.onModelChanged", PropertyPanelModelArgument>

The signature of the callback in the event of changed property panel model. The first parameter is the event name and the second parameter contains the data of the changed property panel model

Selection: ModelObjectIds[]

The model objects selection.

SelectionCallback: EventCallback<"viewer.onSelectionChanged", SelectionChangedEventArgument>

The signature of the callback in the event of changed selection. The first parameter is the event name and the second parameter contains the selection data.

SelectorMode: "add" | "remove" | "set"

The selector mode.

SessionInvalidCallback: EventCallback<"extension.sessionInvalid", SessionInvalidEventArgument>

The signature of the callback in the event of session invalid. The parameter is the flag indicating the session being invalid.

SessionLogOutCallback: EventCallback<"extension.sessionLogOut", SessionLogOutEventArgument>

The signature of the callback in the event of session log out. The parameter is the flag indicating the session being logged out.

ShadingOptions: "DEFAULT" | "EYE_DOME_LIGHTING"
UIElementName: "MainToolbar" | "MenuToolbar" | "SidePanel" | "DetailsPanel" | "DetailsPanel.ToDos" | "DetailsPanel.Views" | "DetailsPanel.Clashes"

The name of the UI elements.

deprecated

''MenuToolbar'' option has been deprecated. It will be removed in future.

UIElementState: "collapsed" | "expanded" | "visible" | "hidden"

The state of the UI elements.

USSurveyFeetLengthUnit: "sIN" | "sFT" | "sYD" | "sMI"
UnitSystemType: "metric" | "imperial" | "ussurveyfeet" | "custom"

The available and supported unit systems.

UserDetailsChangedEventCallback: EventCallback<"extension.userSettingsChanged", UserDetailsChangedEventArgument>

The signature of the callback in the event of changed user details. The first parameter is the event name and the second parameter contains the data of the changed user settings

UserSettingsChangedCallback: EventCallback<"user.onSettingsChanged", UserSettingsChangedEventArgument>

The signature of the callback in the event of changed user settings. The first parameter is the event name and the second parameter contains the data of the changed user settings

ViewActionCallback: EventCallback<"view.onViewAction", ViewActionEventArgument>

The signature of the callback in the event of changed view spec. The first parameter is the event name and the second parameter contains the data of the changed view spec

ViewerSettingsChangedCallback: EventCallback<"viewer.onSettingsChanged", ViewerSettingsChangedEventArgument>

The signature of the callback in the event of changed viewer settings. The first parameter is the event name and the second parameter contains the data of the changed viewer settings

ViewerToolChangedCallback: EventCallback<"viewer.onToolChanged", ViewerToolChangedEventArgument>

The signature of the callback in the event of changed viewer tool. The first parameter is the event name and the second parameter contains the data of the changed viewer tool

The supported event callbacks

WorkspaceEventData<TEvent>: EventToArgMap[TEvent]

The type of the event data

Type Parameters

Variables

TOOLS: string[] = ...

The tools that can be activated.

TOOL_SNAP_TYPES: string[] = ...

The snapping types that can be configured for a tool.

Functions

  • Connects to the 3D Viewer application.

    Parameters

    • target: Window | HTMLIFrameElement

      The target dispatcher or the iframe hosting the 3D Viewer application.

    • Optional onEvent: WorkspaceEventCallback

      The callback that receives the events dispatched from the 3D Viewer application.

    • Optional timeout: number

      The optional timeout in milliseconds. If not specified default timeout is 10000ms

    Returns Promise<WorkspaceAPI>

    A promise that resolves to the set of exposed external API from the 3D Viewer application. Use the exposed API to communicate with the 3D Viewer application.

  • dispatcherEventListener(e: MessageEvent<any>): Promise<void>
  • Add this listener to window.addEventListener to receive messages from connected clients

    For example:

    window.addEventListener("message", dispatcherEventListener)

    Parameters

    • e: MessageEvent<any>

    Returns Promise<void>

  • Expose Workspace API implementation to connected clients

    Parameters

    Returns void

  • Send an event to connected clients

    Type Parameters

    Parameters

    • dispatcher: IDispatcher

      an object able to call postMessage(). Most likely a window or an iframe contentWindow.

    • targetOrigin: string

      — The target origin, or "*" if any origin is allowed.

      Example of sending a message to a client in an iframe :

      sendEvent(clientIframe.contentWindow, '*', 'extension.accessToken', {data:'abc123'})

    • event: T
    • data: WorkspaceEventData<T>

    Returns void