Client.js
Client.js
is a JavaScript library for implementing cross-browser BIM Project management applications. Client.js
provides the following benefits:
- easy access to the server resources like Projects, Files, Issues etc
- integration of the VisualizeJS library with the Open Cloud Server
- convenient API to open BIM files from the server for rendering and data management
- optimizations and improvements of the quality of rendering BIM files
Table of contents
Installation
npm
Install viaOpen a terminal in your project folder and run:
npm install open-cloud-cllient
The Client.js
package will be downloaded and installed. Then you're ready to import it in your code, see example below.
CDN or static hosting
Declare your script, and then use ODA
object as shown below.
<script src="https://opencloud.azureedge.net/libs/clientjs/24.12/client.min.js"></script>
<script>
const client = new ODA.Client();
// place your code here (see example below)
</script>
Example
Download and render a drawing file from the Open Cloud Server
:
// create instance of the Client class for working with server
const client = new ODA.Client({ serverUrl: "https://cloud.opendesign.com/api" });
// create instance of Viewer class for rendering drawing files
const viewer = new ODA.Viewer(client);
// initialize Viewer it with the specified <canvas> element
await viewer.initialize(canvas);
// login to the server
await client.signInWithEmail("email", "password");
// get file list from the server
const files = await client.getFiles();
// open the first file in the list
await viewer.open(files.result[0]);
To learn more, see First application guide.
Copyright and license
Code and documentation copyright 2002-2023 the Open Design Alliance. Code is distributed under a proprietary license, see LICENSE
for more information.