web-ifc-three
web-ifc-three copied to clipboard
Very simple code with react fiber
Hi,
Thanks for this package. As a beginner with BIM and IFC, I wanted to convert the page below into fibber. I would like to latter insert a model in a react website.
https://github.com/mrdoob/three.js/blob/dev/examples/webgl_loader_ifc.html https://threejs.org/examples/webgl_loader_ifc.html
The code below doesn't work. I got this error :
RuntimeError: Aborted(LinkError: WebAssembly.instantiate(): Import #49 module="a" function="X": function import requires a callable). Build with -sASSERTIONS for more info.
What is the problem ? Is the wasm path ok ?
Thanks for your help
import {useLoader} from '@react-three/fiber';
import { IFCLoader } from 'web-ifc-three';
import { IFCSPACE } from 'web-ifc';
import {useEffect,Suspense} from "react"
const Model = () => {
useEffect( ()=>{
async function Kaka(){
const ifcLoader = new IFCLoader();
await ifcLoader.ifcManager.setWasmPath( 'https://cdn.jsdelivr.net/npm/[email protected]/', true );
await ifcLoader.ifcManager.parser.setupOptionalCategories( {
[ IFCSPACE ]: false,
} );
await ifcLoader.ifcManager.applyWebIfcConfig( {
USE_FAST_BOOLS: true
} );
ifcLoader.load( './src/assets/rac_advanced_sample_project.ifc', function ( ) {
// scene.add( model.mesh );
// render();
} );
}
Kaka()
},[])
return (
<Suspense fallback={null}>
<div>AA</div>
</Suspense>
);
};
export default Model
Maybe on this link(https://github.com/magjac/d3-graphviz/issues/152 ), you can find the solution. Hope your success.