web-ifc-three icon indicating copy to clipboard operation
web-ifc-three copied to clipboard

Very simple code with react fiber

Open amapic opened this issue 1 year ago • 1 comments

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

amapic avatar Apr 14 '24 10:04 amapic

Maybe on this link(https://github.com/magjac/d3-graphviz/issues/152 ), you can find the solution. Hope your success.

technestme avatar Apr 18 '24 07:04 technestme