ThatOpen / engine_web-ifc

Reading and writing IFC files with Javascript, at native speeds.
https://thatopen.github.io/engine_web-ifc/demo
Mozilla Public License 2.0
573 stars 170 forks source link

[Bug]: IFC Alignment issue with revit model #864

Closed fwestling-ark closed 2 weeks ago

fwestling-ark commented 2 weeks ago

What happened?

I have IFC files exported from Revit; when I load them with web-ifc-three, they load correctly, and in the web-ifc demo it also loads fine, but when I load it with web-ifc 0.0.54 using a fragments loader, the components are incorrectly aligned. Not an IFC expert, so I don't know if it's something wrong with my file (though again, it loads fine in the demo)

  const components = new OBC.Components();

  const worlds = components.get(OBC.Worlds);

  const world = worlds.create<
    OBC.SimpleScene,
    OBC.SimpleCamera,
    OBC.SimpleRenderer
  >();

  world.scene = new OBC.SimpleScene(components);
  world.renderer = new OBC.SimpleRenderer(components, container);
  world.camera = new OBC.SimpleCamera(components);

  components.init();

  world.camera.controls.setLookAt(12, 6, 8, 0, 0, -10);

  world.scene.setup();

  const grids = components.get(OBC.Grids);
  grids.create(world);

  const fragments = components.get(OBC.FragmentsManager);
  const fragmentIfcLoader = components.get(OBC.IfcLoader);

  await fragmentIfcLoader.setup();
  const excludedCats = [
    WEBIFC.IFCTENDONANCHOR,
    WEBIFC.IFCREINFORCINGBAR,
    WEBIFC.IFCREINFORCINGELEMENT,
  ];

  for (const cat of excludedCats) {
    fragmentIfcLoader.settings.excludedCategories.add(cat);
  }
  fragmentIfcLoader.settings.coordinate = false;
  fragmentIfcLoader.settings.webIfc.COORDINATE_TO_ORIGIN = true;

  async function loadIfc() {
    const file = await fetch(
     // url
    );
    const data = await file.arrayBuffer();
    const buffer = new Uint8Array(data);
    const model = await fragmentIfcLoader.load(buffer);
    // model.name = "example";
    world.scene.three.add(model);
  }

  fragments.onFragmentsLoaded.add((model) => {
    console.log(model);
  });

  await loadIfc();

Version

0.0.54

What browsers are you seeing the problem on?

Chrome, Microsoft Edge

Relevant log output

No response

Anything else?

Screenshot; left is https://thatopen.github.io/engine_web-ifc/demo/, right is my code as copied directly from https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader:

image

IFC file: wall_type1a.txt

beachtom commented 2 weeks ago

So this is fixed in the current version of web-ifc. We await an update of fragments to update their web ifc version