Hide menu
No Matches
Loading a 3D file into memory

Once the input 3D file has been prepared in the form of CDXWEB files, their contents can be loaded into the application as follows:

// Create model
const aModel = new cadex.ModelData_Model();
// Model loads external data asynchronously on demand, so requires data provider for it.
const dataLoader = async (theModelPath, theObjId) => {
const aRes = await fetch(theModelPath + '/' + theObjId);
if (aRes.status === 200) {
return aRes.arrayBuffer();
throw new Error(aRes.statusText);
// Load model by URL.
const aLoadResult = await aModel.loadFile(theModelPath, dataLoader, false /*append roots*/);


  • theModelPath is a url to the top CDXWEB directory (e.g. output/conrod.cdxweb),
  • theObjId is a file in the CDXWEB directory (e.g. scenegraph.cdxweb)

cadex.ModelData_Model is essentially an object which encapsulates 3D model in memory. This class corresponds to a C++ counterpart cadex::ModelData_Model class described in details in the CAD Exchanger SDK User’s Guide. So you might want to read that guide if you have not done so yet.

Refer to Model explorer example for a self-contained demonstration of the model loading and exploring with the help of Web Toolkit.