Hierarchy

  • UnityUtil

Clipping Plane

Compare Tool

Configurations

Configurations Quits unity instance & reset all custom callback and promises

GIS

Measuring tool

Model Interactions

Navigations

Object Highlighting

Other

Pins

Streaming

Clipping Plane

  • Start clip editing in box mode

    Returns void

  • Start editing mode with current clip plane state

    Returns void

  • Start clip editing in single plane mode

    Returns void

Compare Tool

  • When Compare tool is enabled, visalise in differencing view Models will be rendered in greyscale, detailing the difference/clash

    Returns void

  • Disable compare tool This also unloads the comparator models

    Returns void

  • Enable compare tool This starts the compare tool in clash mode

    Returns void

  • Enable compare tool This starts the compare tool in diff mode

    Returns void

  • Load comparator model for compare tool This returns a promise which will be resolved when the comparator model is loaded

    Parameters

    • account: string

      teamspace

    • model: string

      model ID

    • revision: string = 'head'

      Specific revision ID/tag to load

    Returns Promise<void>

    returns a promise that resolves upon comparator model finished loading.

  • Compare transparent objects as of normal

    Returns void

  • Ignore semi-transparent objects in diff

    Returns void

  • Compare transparent objects as if they are opaque objects

    Returns void

  • Set an existing submodel/model as a comparator model This will return as a base model when you have cleared the comparator (i.e. disabled diff)

    Parameters

    • account: string

      name of teamspace

    • model: string

      model ID

    Returns void

  • Set tolerance threshold. In general you should not need to tweak this, but if the differencing looks off, this is the value to tweak

    Parameters

    • theshold: number

      tolerance level for diffing/clashing

    Returns void

  • Only show the base model i.e. It will show only the original model, not the comparator nor the diff view *

    Returns void

  • Only show the comparator model i.e. Only show the model you are trying to compare with, not the base model

    Returns void

Configurations

  • Reset viewer background to default

    Returns void

  • Enable snapping to snap the cursor to the closest edge

    Returns void

  • Enable soft shadows - the highest shadow quality

    Returns void

  • Hide x y z coordinates of current point

    Returns void

  • Initialise Unity.

    Parameters

    • errorCallback: any

      function to call when an error occurs. This function should take a string(message), boolean(requires reload), boolean(came from unity).

    • progressCallback: any
    • modelLoaderProgressCallback: any
    • useBetaViewer: boolean = false

    Returns void

  • Loading another model. NOTE: this will also clear the canvas of existing models Use branch = master and revision = head to get the latest revision. If you want to know when the model finishes loading, use [[onLoaded]]

    Parameters

    • account: string

      name of teamspace

    • model: string

      name of model

    • branch: string = ''

      ID of the branch (deprecated value)

    • revision: string = 'head'

      ID of revision

    • initView: any = null
    • clearCanvas: boolean = true

    Returns Promise<void>

    returns a promise that resolves when the model start loading.

  • Launch the Unity Game. *

    Parameters

    Returns Promise<void>

    returns a promise which resolves when the game is loaded.

  • Offload a model that is currently loaded

    Parameters

    • account: string

      name of teamspace

    • model: string

      name of model

    • revision: string = 'head'

      ID of revision

    Returns void

  • Clear the canvas and reset all settings

    Parameters

    • resetProjection: boolean = true

    Returns void

  • Set API key to use for authentication. Ensure setAPIHost is called before this.

    Parameters

    • apiKey: string

    Returns void

  • Change the background colour of the viewer note: alpha defaults to 1 if an array of 3 numbers is sent

    Parameters

    • color: number[]

      rgba colour value to set to e.g.[1,0,0,1] for solid red.

    Returns void

  • Set the default near plane value. This can be use to tweak situations where geometry closest to you are being clipped

    Parameters

    • value: number

      the closest distance (in model units) the camera will render.

    Returns void

  • Set the maximum rending distance for shadows. Smaller value may increase shadow quality.

    Parameters

    • value: number

      The maximum distance (in model units) the renderer will render shadows for

    Returns void

  • Set the number of simultaneously threads for cache access *

    Parameters

    • thread: any

    Returns void

  • Sets the render quality to default

    Returns void

  • Set the units By default, units are set to mm. This is used for GIS and measuring tool.

    Parameters

    • units: any

      i.e. "m", "mm", "ft" etc.

    Returns void

  • Show x y z coordinates of current point

    Returns void

  • Toggle on/off rendering statistics. When it is toggled on, list of stats will be displayed in the top left corner of the viewer.

    Returns void

Configurations Quits unity instance & reset all custom callback and promises

GIS

  • Add map source.

    Parameters

    • mapSource: string

      This can be "OSM", "HERE", "HERE_AERIAL", "HERE_TRAFFIC", "HERE_TRAFFIC_FLOW"

    Returns void

  • Initialise map tiles within unity

    Parameters

    • surveyingInfo: [object]

      array of survey points and it's respective latitude and longitude value

    Returns void

  • Remove map source.

    Parameters

    • mapSource: string

      This can be "OSM", "HERE", "HERE_AERIAL", "HERE_TRAFFIC", "HERE_TRAFFIC_FLOW"

    Returns void

  • Reset map sources. This removes all currently displayed maps

    Returns void

Measuring tool

  • Clear all measurements

    Returns void

  • Enable the measure tool toolbar.

    Returns void

  • Disnable measure display mode to xyz.

    Returns void

  • Disable the Measuring tool.

    Returns void

  • Enable the measure tool toolbar.

    Returns void

  • Enable measure display mode to xyz.

    Returns void

  • Enable measuring tool. This will allow you to start measuring by clicking on the model

    Returns void

  • Set the measure tool mode.

    Parameters

    • mode: any

      The measuring mode, accepted values are "Point", "Raycast", "MinimumDistance", "SurfaceArea" or "PolygonArea".

    Returns void

  • Set the measure tool units.

    Parameters

    • units: any

      The measuring units accepted values are "cm", "mm", "m"

    Returns void

Model Interactions

  • Reset clipping plane This will also toggle edit mode to false

    Returns void

  • Get Object Status within the viewer. This will return you the list of objects that are currently set invisible, and a list of object that are currently highlighted.

    The object status will be returned via the promise provided.

    Parameters

    • account: string

      name of teamspace

    • model: string

      name of the model

    Returns Promise<object>

  • Hide objects that are hidden by default (e.g. IFCSpaces)

    Returns void

  • Move mesh/meshes by a given transformation matrix. NOTE: this currently only works as desired in Synchro Scenarios

    Parameters

    • teamspace: string

      teamspace of the model

    • modelId: string

      modelID the meshes belongs in

    • meshes: string[]

      array of mesh unique IDs

    • matrix: number[]

      array of 16 numbers, representing the transformation on the meshes (row major)

    Returns void

  • Request a screenshot. The screenshot will be returned as a JSON object with a single field, ssByte, containing the screenshot in base64.

    Returns Promise<object>

    returns a promise which will resolve with an object with a screenshot in base64 format

  • Request the information of the current viewpoint

    Parameters

    • account: string

      name of teamspace

    • model: string

      name of model

    Returns Promise<any>

    returns a promises which will resolve with the viewpoint information

  • Move mesh/meshes by a given transformation matrix. NOTE: this currently only works as desired in Synchro Scenarios

    Parameters

    • teamspace: string

      teamspace of the model

    • modelId: string

      modelID the meshes belongs in

    • meshes: string[]

      array of mesh unique IDs

    Returns void

  • Sets the navigations interaction off

    Returns any

  • Sets the navigations interaction on

    Returns any

  • Change the colour of the clipping planes border

    Parameters

    • color: number[]

    Returns void

  • Change the width of the clipping planes border

    Parameters

    • width: number

      the width of the clipping plane border

    Returns void

  • Sets the render quality to high

    Returns void

  • Sets the highlighting to show xray

    Returns any

  • Sets the highlighting to show xray

    Returns any

  • Make all hidden by default objects visible (typically IFC Spaces)

    Returns void

  • Toggle visibility of the given list of objects

    Parameters

    • account: string

      name of teamspace

    • model: string

      name of model

    • ids: [string]

      list of unique ids to toggle visibility

    • visibility: boolean

      true = visible, false = invisible

    Returns void

  • Update the clipping plane to the given direction teamspace and model is only needed if the viewpoint is relative to a model Clipping plane is defined by the plane normal, distance from origin and it's direction direction = -1 means it will clip anything above the plane, 1 otherwise.

    Parameters

    • clipPlane: object

      object containing the clipping plane

    • requireBroadcast: boolean

      if set to true, A callback to [[viewer]].clipBroadcast will be called after it is set.

    • Optional account: string

      name of teamspace

    • Optional model: string

      name of model

    Returns void

    Example

    UnityUtil.updateClippingPlanes([{normal : [0,-1,0], distance: 10, clipDirection: -1}], false)
    
  • Zoom to highlighted meshes

    Returns void

Navigations

  • Reset the viewpoint to the back of the model.

    Returns void

  • Reset the viewpoint to Bottom up view.

    Returns void

  • Move the pivot point to eh centre of the objects provided

    Parameters

    • meshIDs: [object]

      array of json objects each recording { model: <account.modelID>, meshID: [array of mesh IDs] }

    Returns void

  • Reset the viewpoint to the front of the model.

    Returns void

  • Decrease the speed of Helicopter navigation (by x0.75)

    Returns void

  • Reset the speed of Helicopter navigation

    Returns void

  • Increase the speed of Helicopter navigation (by x1.25)

    Returns void

  • Reset the viewpoint to the left side of the model.

    Returns void

  • Reset the viewpoint to ISO view.

    Returns void

  • Reset the viewpoint to the right side of the model.

    Returns void

  • Set navigation mode.

    Parameters

    • navMode: any

      This can be either "HELICOPTER" or "TURNTABLE"

    Returns void

  • Change the camera configuration teamspace and model is only needed if the viewpoint is relative to a model

    Parameters

    • pos: [number]

      3D point in space where the camera should be

    • up: [number]

      Up vector

    • forward: [number]

      forward vector

    • lookAt: [number]

      point in space the camera is looking at. (pivot point)

    • Optional projectionType: boolean
    • Optional orthographicSize: number
    • Optional account: string

      name of teamspace

    • Optional model: string

      name of model

    Returns void

  • Reset the viewpoint to Top down view.

    Returns void

Object Highlighting

  • Clear all highlighting on currently highlighted objects

    Returns void

  • Highlight objects

    Parameters

    • account: string

      name of teamspace

    • model: string

      name of model

    • idArr: string[]

      array of unique IDs associated with the objects to highlight

    • color: [number]

      RGB value of the highlighting colour

    • toggleMode: boolean

      If set to true, existing highlighted objects will stay highlighted. Also any objects that are already highlighted will be unhighlighted

    • forceReHighlight: boolean

      If set to true, existing highlighted objects will be forced to re-highlight itself. This is typically used for re-colouring a highlight ] or when you want a specific set of objects to stay highlighted when toggle mode is on

    Returns void

  • Override the colour of given object(s)

    Parameters

    • account: string

      teamspace the meshes resides in

    • model: string

      model ID the meshes resides in

    • meshIDs: [string]

      unique IDs of the meshes to operate on

    • color: [number]

      RGB value of the override color (note: alpha will be ignored)

    Returns void

  • Override the alpha value of given object(s) If you are setting opacity to 0, use toggleVisibility instead.

    Parameters

    • account: string

      teamspace the meshes resides in

    • model: string

      model ID the meshes resides in

    • meshIDs: [string]

      unique IDs of the meshes to operate on

    • opacity: number

      opacity (>0 - 1) value to override with

    Returns void

  • Restore the meshes to its original color values

    Parameters

    • account: string

      teamspace the meshes resides in

    • model: string

      model ID the meshes resides in

    • meshIDs: [string]

      unique IDs of the meshes to operate on

    Returns void

  • Reset override alpha value of given object(s)

    Parameters

    • account: string

      teamspace the meshes resides in

    • model: string

      model ID the meshes resides in

    • meshIDs: [string]

      unique IDs of the meshes to operate on

    Returns void

  • Start rectangular select

    Returns void

  • Stop rectangular select

    Returns void

  • Unhighlight objects

    Parameters

    • account: string

      name of teamspace

    • model: string

      name of model

    • idArr: string[]

      array of unique IDs associated with the objects to highlight

    Returns void

Other

unityBuildSubdirectory: any

A URL containing the subfolder under unityUrl where the Unity build and its associated dependencies can be found. This should usually be set to "/unity/Build"

unityOnUpdateActions: any[] = []

Contains a list of calls to make during the Unity Update method. One call is made per Unity frame.

usingBetaViewer: boolean = false
verbose: boolean = false
viewer: any

viewer can be assigned, containing any callback function the user wishes to hook onto. The following functions are supported:

viewer.clipBroadcast(object): Called when a clipping plane broadcast occurs with the new clipping plane information

viewer.numClipPlanesUpdated(int): Called when the number of clipping planes changed, with the latest number of clipping planes in place

viewer.objectSelected(object): Notify the user which object/pin is clicked after a mouse event

viewer.objectsSelected(object): Notify the user which objects is selected after a rectangular select event

viewer.pickPointEvent(object): Notify the user what position within the 3D world was clicked after a mouse event.

Example

UnityUtil.viewer = {
numClipPlanesUpdated = (nPlanes) => console.log(`Current no. planes: ${nPlanes}`}
  • Parameters

    • measurement: any

    Returns void

  • Removes the IndexedDb database /idbfs, which emulates a synchronous filesystem. The viewer should not store anything use the File API between runs.

    Returns Promise<void>

  • Remove a particular measurement.

    Parameters

    • uuid: any

      The measurement id of the measurement to be removed

    Returns void

  • Creates an IndexedDbCache object which provides access to cached web requests using IndexedDb.

    Parameters

    • gameObjectName: string

    Returns void

  • Parameters

    • id: string

    Returns void

  • Hide progress bar while model is loading

    Returns void

  • Returns a promise that lets you know when the model has finished loading.

    Returns Promise<object>

    returns a Promise that resolves when the model has finished loading. The Promise returns the bounding box of the model.

    Category

    State Queries

  • Returns a promise that lets you know when the model has started to load

    Returns Promise<void>

    returns a Promise that resolves when the model has started to load

    Category

    State Queries

  • Returns a promise that lets you know when the game is loaded.

    Returns Promise<void>

    returns a Promise that resolves when the game is loaded.

    Category

    State Queries

  • Called from within the viewer on each Unity frame.

    Returns void

  • Parameters

    • id: string

    Returns void

  • How many non-trivial jobs the viewer can complete per frame when the camera is moving

    Parameters

    • numJobs: number

    Returns void

  • How many non-trivial jobs the viewer can complete per frame when the camera isnt moving

    Parameters

    • numJobs: number

    Returns void

  • Parameters

    • value: number

    Returns void

  • Parameters

    • value: number

    Returns void

  • Set color of a particular measurement.

    Parameters

    • uuid: any

      The measurement id of the measurement that will change color

    • color: any

    Returns void

  • Set color of a particular measurement.

    Parameters

    • uuid: any

      The measurement id of the measurement that will change name

    • name: any

    Returns void

  • Parameters

    • weight: number

    Returns void

  • Parameters

    • factor: number

    Returns void

  • Parameters

    • modelNamespace: string
    • priority: number

    Returns void

  • Tells the viewer the maximum amount of memory it can expect to be able to allocate for its heap. 0 means the maximum amount that the browser can handle, determined by hueristics in this method.

    Parameters

    • maxMemoryInMb: number

    Returns void

  • Show progress bar while model is loading

    Returns void

  • Returns the relative path of the Unity Loader to the current domain

    Returns string

  • Use orthographic view

    Returns void

  • Use perspective view

    Returns void

  • Parameters

    • meshEntries: object[]

    Returns void

Pins

  • Change the colour of an existing pin

    Parameters

    • id: string

      ID of the pin

    • colour: number[]

      colour RGB value of the colour to change to. e.g. [1, 0, 0]

    Returns void

  • Add a bookmark pin

    Parameters

    • id: string

      Identifier for the pin

    • position: number[]

      point in space where the pin should generate

    • normal: number[]

      normal vector for the pin (note: this is no longer used)

    • colour: number[]

      RGB value for the colour of the pin

    Returns void

  • Add an issue pin

    Parameters

    • id: string

      Identifier for the pin

    • position: number[]

      point in space where the pin should generate

    • normal: number[]

      normal vector for the pin (note: this is no longer used)

    • colour: number[]

      RGB value for the colour of the pin

    Returns void

  • Add a Risk pin

    Parameters

    • id: string

      Identifier for the pin

    • position: number[]

      point in space where the pin should generate

    • normal: number[]

      normal vector for the pin (note: this is no longer used)

    • colour: number[]

      RGB value for the colour of the pin

    Returns void

  • Remove a pin from the viewer

    Parameters

    • id: string

      pin identifier

    Returns void

Streaming

  • Sets the colour of the bounding boxes representing yet-to-be-loaded Supermeshes

    Parameters

    • colour: number[]

    Returns void

    Code

    UnityUtil.setStreamingBundlesColor([0.2,0.8,0.2]);

  • Sets the transparency of the Supermesh Bounding Boxes faces/sides. Setting both this and the Lines Alpha to zero will disable the Supermesh Bounds.

    Parameters

    • alpha: number

    Returns void

  • Sets the three parameters that control the fade in and out of the Supermesh bounding boxes based on camera distance

    Parameters

    • distance: number

      how quickly the bounds fade-in with respect to the distance from the camera (to the far plane). (Does not have to be between 0 and 1 - making it larger will make the fade in more gradual.)

    • bias: number

      distance from the far plane that the bounds should start to fade out. When this is zero the bounds will not fade out. Should otherwise be above 1.

    • power: number

      how sharply the fade out occurs

    Returns void

    Code

    UnityUtil.SetStreamingBundlesFade(0.7,1.6,5);

  • Sets the transparency of the Supermesh Bounding Boxes edges/outlines. Setting both this and the Faces Alpha to zero will disable the Supermesh Bounds.

    Parameters

    • alpha: number

    Returns void

  • Sets the colour of the bounding boxes representing yet-to-be-loaded individual model elements

    Parameters

    • colour: number[]

    Returns void

    Code

    UnityUtil.setStreamingElementsColor([0.2,0.8,0.2]);

  • Sets the transparency of the Elements Bounding Boxes faces/sides. Setting both this and the Lines Alpha to zero will disable the Elements Bounds.

    Parameters

    • alpha: number

    Returns void

  • Sets the transparency of the Elements Bounding Boxes edges/outlines. Setting both this and the Faces Alpha to zero will disable the Elements Bounds.

    Parameters

    • alpha: number

    Returns void

  • Sets the radius - as fraction of the camera near/far plane - within which the bounding boxes of individual yet-to-be-loaded elemenets should be drawn.

    Parameters

    • radius: number

      the distance from the camera towards the far plane, between 0 and 1.

    Returns void

  • The amount of space the geometry streaming should leave in the unmanaged heap. The unmanaged heap is not measured directly, but considered to be the space between the top of the Unity heap (typically 2Gb) and the top of the managed heap. (The available space for geometry will shrink dynamically as the managed heap grows, always leaving thresholdInMb available to Unity for other uses).

    Parameters

    • thresholdInMb: number

    Returns void

Generated using TypeDoc