Using jQuery

Using jQuery is also supported when working with the 3D Viewer API.

For legacy reasons small differences exist in the way you interact with the 3D Viewer when using jQuery.

Installation

1. Add jQuery to your project

Include jQuery in your HTML file using a script tag.

HTML


2. Add the 3D Viewer to your project

Include the 3D Viewer in your HTML file using a script tag, this will add the global bimsync object to the window object.

HTML


3. Provide a container for the 3D Viewer

Create a div element for attaching a 3D Viewer instance to.

HTML


4. Initialize the 3D Viewer API

Set a callback function and then invoke the load method, the 3D Viewer is ready once callback invoked.

JS


5. Create a 3D Viewer instance

Initialize the 3D Viewer by invoking the viewer method on the jQuery object for the div where you want to attach the 3D Viewer.

JS


6. Interact with the 3D Viewer

Call methods on the 3D Viewer instance to interact with the 3D Viewer.

JS


Getting Started

Usage

HTML


Options

The options for the 3D Viewer are the same when using jQuery.

Methods

In general, the methods are the same when using jQuery but the way you call them is different.

JS


Some methods are also available under their deprecated names.

Method

Deprecated Names

captureScreenshot

screenshot

getBoundingBox

boundingBox, boundingbox

getClippingPlanes

clippingPlanes, clippingplanes

getModels

modelInfo

getObjectColors

color

getObjects

objectInfo, objectinfo

getRenderSettings

renderSettings

getViewpoint

viewpoint

loadModelsFromToken

loadUrl, loadurl

resetObjectColors

resetColors, resetcolors

setClippingPlanes

clippingPlanes, clippingplanes

setObjectColors

color

setPlaneWidgetViewport

clippingPlaneWidgetViewport, planeWidgetViewport

setPointBudget

pointBudget

setRenderSettings

renderSettings

setTransform

transformModel, transformmodel

setTransitionSettings

transitionSettings

setViewpoint

viewpoint

unloadModel

unloadmodel

It also possible to use most methods as both a getter or a setter.

Use a method as a getter by passing a callback as the last argument.

getClippingPlanes

Also available under the deprecated method names clippingPlanes and clippingplanes.

JS


getObjectColors

Also available under the deprecated method name color.

JS


getRenderSettings

Also available under the deprecated method name renderSettings.

JS


getViewpoint

Also available under the deprecated method name viewpoint.

JS


Events

Callbacks for 3D Viewer events may have different signatures when using jQuery. Each event documentation page details any differences.

Updated 07 Jun 2024
Did this page help you?