How to load 3D CAD data into three.js. Part 2.

1. Using GLTF as an interim format

ExchangerConv.exe -i conrod.jt -e conrod.obj conrod.glb

cadex::ModelData_Model aModel;

cadex::JT_Reader aJTReader;
aJTReader.ReadFile (“conrod.jt”) && aJTReader.Transfer (aModel);

cadex::GLTF_Writer aGLTFWriter;
aGLTFWriter.Transfer (aModel) && aGLTFWriter.WriteFile (“conrod.glb”);

2. More details on the .cdxfb format used in CAD Exchanger Cloud

3. Detailed example of CAD Exchanger Web Toolkit

const aScene = new THREE.Scene();

// Create model
const aModel = new cadex.ModelData_Model();
// Model uses multiple external data, so requires provider for it.
const dataLoader = async (theModelUrl, theObjId) => fetchFile(theModelUrl + ‘/’ + theObjId);

// Load model by URL.
await aModel.loadFile(theModelPath, dataLoader, false /*append roots*/);

// Convert model into three.js entities
const aConverterParameters = new cadex.ModelAlgo_ThreejsConverterParameters();
const aThreejsConverter = new cadex.ModelAlgo_ThreejsConverter(aConverterParameters);
aScene.add(await aThreejsConverter.convertModel(aModel));



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store