Web Toolkit can be installed with npm and modern build tools, or get started quickly with just static hosting or a CDN. For most users, installing from npm is the best choice.
To install the Web Toolkit npm module, open your project folder in a terminal and run:
The package will be downloaded and installed. Including Web Toolkit will usually look like this:
The Web Toolkit library can be used by loading from existing CDN (skypack.dev, unpkg.com, jsdelivr.com, etc.). The Web Toolkit depends on three.js (r146) library, which should be included before.
CAD Exchanger Web Toolkit loads models data from external files, due to browsers' same origin policy security restrictions, loading from a file system will fail with a security exception.
There are two ways to solve this:
This allows you to access your page as:
In this case, be aware that you may open yourself to some vulnerabilities if using the same browser for a regular web surfing. You may want to create a separate browser profile / shortcut used just for local development to be safe.
This allows you to access your page as:
There are many simple HTTP servers available which have enough functionality to run examples and tutorial.
Node.js server
Node.js has a simple HTTP server package. To run (from your local directory):
Python server
Python has a built-in http server module. To run (from your local directory):
PHP server
PHP also has a built-in web server. To run (from your local directory):
For more complex cases, the server part should provide model data as a stream of bytes, such that it can be accepted on client as ArrayBuffer object. For more details please refer to the Web API documentation.
The examples will use CAD Exchanger SDK in order to prepare original 3D files for Web Toolkit.
Follow instructions in the SDK documentation to download and install SDK. Make sure to copy the evaluation license key to the examples directory for your programming language. To check that installation was successful, build and run the CDXWEB Converter Example.