Parse the IFC
This is where the fun begins!
We are going to modify the orignal source code. Take a look at IFC.js
.
function loadIfc(ifcData) {
const loaded = loadIfcFileItems(ifcData);
const structured = constructProject(loaded);
return buildGeometry(structured);
}
As we discuessed earlier, we cannot build the entire gemoetry inside the Web Worker
.
onmessage = (e) => {
const ifcData = e.data;
const loaded = IFCjs.loadIfcFileItems(ifcData);
const structured = IFCjs.constructProject(loaded);
postMessage(structured);
};
If we run this code, it won't work. The Web Worker has no idea what IFC.js
is. We must import the scripts.
importScripts('../../build/IFC.js');
onmessage = (e) => {
const ifcData = e.data;
const loaded = IFCjs.loadIfcFileItems(ifcData);
const structured = IFCjs.constructProject(loaded);
postMessage(structured);
};
Again, please note that this will not work! The Web Worker
will complain that Three and Chevrotain is missing.
Again, to clarify - WE CANNOT USE THREE INSIDE THE WEB WORKER.
Last updated