3

At the moment I need to convert all my IFC files into Collada format to visualise them in Three.js. Is there any IFC Loader in three.js? I could not find anything. Is there any plan to develop an IFCLoader in the near future?

How difficult it would be to write that?

Vertexwahn
  • 7,709
  • 6
  • 64
  • 90
mbehnaam
  • 401
  • 10
  • 24

3 Answers3

3

I haven't encountered a native Javascript parser that can directly read IFC files, however there is a product from Apstex available. It's a Java tool that outputs three.js geometry. We're using that as a self running web service, so the client sends an IFC file and receives the JSON Three.js geometry (which is then loaded in the viewer).

GeorgDangl
  • 2,146
  • 1
  • 29
  • 37
3

May be a late answer for this question. Have you seen the BIMserver plugin to get a three.js export of your IFC file? Check it out from here

ylcnky
  • 775
  • 1
  • 10
  • 26
3

It might be a bit late, but we have recently released the official IFC Loader for Three.js. It's relatively young and we still have work to do, but it's able to open a lot of IFC files already. Assuming you have an HTML input element in your scene:

 import { IFCLoader } from "three/examples/jsm/loaders/IFCLoader";

//Sets up the IFC loading
const ifcLoader = new IFCLoader();
ifcLoader.setWasmPath("wasm/");

const input = document.getElementById("file-input");
input.addEventListener(
  "change",
  (changed) => {
    var ifcURL = URL.createObjectURL(changed.target.files[0]);
    console.log(ifcURL);
    ifcLoader.load(ifcURL, (ifcModel) => scene.add(ifcModel.mesh));
  },
  false
);

You can visit the docs to see the full tutorial, see the official example or let us know if you have any question / feedback / want to contribute in the Discord channel.