Closed qyc010702 closed 1 year ago
Possibly wrong path to wasm. You can try changing it like this:
let occtimportjs = require("occt-import-js.js");
occt: any = undefined;
/*If you are using a local server, for example five-server, you should specify the path to wasm through it:
http://localhost:5050/myPath/occt-import-js/occt-import-js.wasm*/
wasmUrl = 'https://cdn.jsdelivr.net/npm/occt-import-js@0.0.15/dist/occt-import-js.wasm';
async InitOCCT() {
console.log(this.occt);
if (this.occt == undefined)
this.occt = await occtimportjs({
locateFile: (name: any) => {
return this.wasmUrl;
}
})
}
After that you can load the model as in the example
await this.InitOCCT();
let response = await fetch(url);
let buffer = await response.arrayBuffer();
let fileBuffer = new Uint8Array(buffer);
let result = this.occt.ReadIgesFile(fileBuffer, null);
LinkError: WebAssembly.instantiate(): Import #390 module="a" function="ng" error: function import requires a callable When I use occt-import-js to import an igs file, I met this error, could you please give me some help?