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
604 stars 180 forks source link

Possible Bug - IFC model not loading correctly. #967

Open usmanhussainESP opened 1 month ago

usmanhussainESP commented 1 month ago

Describe the bug 📝

Hey,

After loading this particular model (ifc file), I see that not all the items are loaded correctly. Some elements may be missing. I am testing directly with the latest version of the official template.

In the following screenshot you can see the original model loaded correctly using usBIM. image (1) And this is the result of having loaded it using the official template: image (2)

As you can see, most of the roof has not been loaded. Some parts are loaded but the geometry is not correct.

image

I am aware that you need the IFC file to replicate the problem. But in this case, the IFC I am using is a corporate one, which I cannot publish. Is there a way to send you the IFC without it being public?

Thank you very much.

Reproduction ▶️

No response

Steps to reproduce 🔢

No response

System Info 💻

System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-13700H
    Memory: 2.64 GB / 15.64 GB
  Binaries:
    Node: 20.11.1 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (126.0.2592.113)
    Internet Explorer: 11.0.22621.3527

Used Package Manager 📦

npm

Error Trace/Logs 📃

No response

Validations ✅

agviegas commented 1 month ago

Hi, yes! You can send it to antonio@thatopen.com. Can you try to load the IFC here and see if the issue persists? Thanks!

usmanhussainESP commented 1 month ago

Hello, thanks for your quick response. I Have tried to upload the model, the its the same result.

I have sent you the email with the IFC model. Thank you.

agviegas commented 1 month ago

File privately available here.

usmanhussainESP commented 1 month ago

Hello @agviegas,

To give you more context on this problem, I confirm that using the "web-ifc" version: "0.0.51" this same IFC was loaded correctly. Because previously I was working with the openbim-components@1.4.14 version which internally uses the 0.0.51 version of the web-ifc. The origin of the observed problem has been the migration of the components from 1.4.14 to 2.1.13.

Therefore, keeping this in mind, and from what I see the solution to the problem may take a considerable time, I am thinking of using version 0.0.51 in the latest versions of @thatopen/components. Is this possible?

I have tried to do the following:

this.fragmentIfcLoader = this.components.get(OBC.IfcLoader);
  this.fragmentIfcLoader.settings.autoSetWasm = false;
  this.fragmentIfcLoader.settings.wasm = {
      path: 'https://unpkg.com/web-ifc@0.0.51/',
      absolute : true,
  }
  this.fragmentIfcLoader.settings.webIfc.COORDINATE_TO_ORIGIN = true;
  await this.fragmentIfcLoader.setup();

But I get the error:

Missing field: "OPTIMIZE_PROFILES".

Can you give me any suggestions to bypass this problem temporarily?

Or is it not possible to use this old version of webfic with the new components? Thank you very much.

agviegas commented 1 month ago

@usmanhussainESP can you try adding the field OPTIMIZE_PROFILES: false to this.fragmentIfcLoader.settings.webIfc?

usmanhussainESP commented 1 month ago

@agviegas I have tried what you suggested. But I got the following error:

TypeError: this.wasmModule.GetAllCrossSections is not a function.

When I start loading the model, I get a lot of GetMesh() type errors and finally the undefined function error.

image

It seems that the version I need is not supported.

Is there anything I can do to achieve this compatibility or is it worth waiting for the bug to be fixed?

Thank you.

agviegas commented 1 month ago

Hm, I see. Then I guess the only solution left is either to stick with the old version, or to stick to the latest and wait for the fix in the future 🙏🏻 sorry for this!

maidi29 commented 1 month ago

Hi @agviegas, do you have a rough estimation on how long it will take to fix the issue with the missing faces? As already said, we see the issue in almost all of our models, and sometimes many faces are affected. I also tested one of the models with lots of issues in your link but no improvement:

image

How it should look like and also did with an old version:

image

Rollback to version 1 of the engine_components is not really an option for us since we started the project with version 2

agviegas commented 1 month ago

@maidi29 right now we don't know. The person in charge of the geometry engine is out on vacations until the end of August. In addition, geometry problems are uncertain: some take hours, other takes weeks.

If you are in a hurry and just want to use a previous version of web-ifc, my suggestion in the meantime is that you fork the components repo, install the version of web-ifc you need and solve the errors that come up (there shouldn't be many). Happy to guide you in the process if you decide to go down this route!

atheler commented 1 month ago

Salut

I also stumbled across the artifacts and it seems the issues started with the update on the ray-triangle intersection https://github.com/QuimMoya/fuzzy-bools/commit/2cf2885065dcf5359dc42b9934cd7d0acb62f431. Here is a before and after comparison:

subtraction comparisson

@QuimMoya what were the goals of this update? Could the use of GLM's glm::intersectRayTriangle implementation be an alternative?

@agviegas who is in charge of the geometry engine?

It would be cool if we could solve this

Cheers

agviegas commented 1 month ago

@atheler right now it's @QuimMoya. Right now he's out in vacations, but feel free to shoot him a message for when he's back!

QuimMoya commented 3 weeks ago

@atheler

Is it possible to obtain the IFC model you are using the last tests?

atheler commented 3 weeks ago

Hi @QuimMoya

I did not use an IFC model but instead generated 3D data manually and stored it in text files:

These are simple text files with the vertex data on the first and the triangle face indices on the second line.

Here is the C++ wrapper program for the subtracting the geometries (as a .txt file to make GitHub happy): main.cpp.txt. I compiled against the version in your repo https://github.com/QuimMoya/fuzzy-bools and swapped some files.

clang++ main.cpp -std=c++17 -Ideps/glm -Ideps/cdt  # Compile
./a.out wall.txt opening.txt result.txt  # Usage

The geometries are rotated slightly by some degrees to trigger floating-point errors. Also found that changing toleranceVectorEquality can bring back some of the missing faces.

I can also share some Python code for the geometry generation and plotting if you would like to?

Best

usmanhussainESP commented 1 week ago

Hi @QuimMoya ,

Is there any news regarding this bug? Can we have an approximate forecast of when it might be fixed? Thank you so much in advance. Best regards.

QuimMoya commented 1 week ago

I have identified the root cause of the last issue. The whole process works fine, but it fails to correctly identify which triangles to retain and which to discard.

QuimMoya commented 1 week ago

image

Just changed that

image

usmanhussainESP commented 6 days ago

Hey @QuimMoya

Thanks for the update. Will there be a new version with these changes that I can try with my IFC model? Have you tried with my IFC file and see if the problem has been solved?

Thank you very much.