Skip to content

Project Setup

Dependencies Viewer API is based on Three.js. So the both libraries must be included in your project. Additionally, Three.js must be loaded in global scope and exposed as a global variable called THREE.

If you use vanilla HTML, CSS, JavaScript or a front-end framework that doesn't require compilation, such as Bootstrap, Semantic UI, etc., both Three.js and Viewer API are exported as Universal Modules that can be included before your project's closing </body> tag. For example, the both libraries are available over a CDN:

<script src="" crossorigin="anonymous"></script>
<script src="" crossorigin="anonymous"></script>

You can also use a JavaScript package manager to install the both libraries. Since Three.js is specified as a dependency of Viewer API, below is an NPM command that will save them to your project folder at the same time.

npm install --save

If you use a front-end framework that requires a module loader or a compilation step, such as React, Angular, Vue, etc., please make sure Three.js is loaded first and accessible by a global variable called THREE before importing's ES6 module. The type definitions are included in the package, so you can also benefit from the IntelliSense in Visual Studio Code.

// ThreeImporter.js
import * as THREE from 'three/build/three';
// Assign THREE to global variable
window.THREE = THREE;
// ViewerComponent.js
import ThreeImporter from './ThreeImporter';
import * as bimU from '';


All available Viewer API functions are exposed as methods of the Viewer object. It would be easier to explore and inspect in browser console if a viewer variable is also exposed in global scope.

let viewer = new bimU.Viewer(viewerConfigs);
window.viewer = viewer;

Sample Projects

We've created a couple of Hello World boilerplates: