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.
Include jQuery in your HTML file using a script tag.
Include the 3D Viewer in your HTML file using a script tag, this will add the global bimsync object to the window object.
Create a div element for attaching a 3D Viewer instance to.
Set a callback function and then invoke the load method, the 3D Viewer is ready once callback invoked.
Initialize the 3D Viewer by invoking the viewer method on the jQuery object for the div where you want to attach the 3D Viewer.
Call methods on the 3D Viewer instance to interact with the 3D Viewer.
Usage
The options for the 3D Viewer are the same when using jQuery.
In general, the methods are the same when using jQuery but the way you call them is different.
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.
Also available under the deprecated method names clippingPlanes and clippingplanes.
Also available under the deprecated method name color.
Also available under the deprecated method name renderSettings.
Also available under the deprecated method name viewpoint.
Callbacks for 3D Viewer events may have different signatures when using jQuery. Each event documentation page details any differences.