Linked models does not align correctly in term of position and scale in some cases
Hello I am trying to load these two models into my viewer I am using web-ifc-viewer version: 1.0.196, the reason I am posting this here because I think it is not related to web-ifc-viewer but with web-ifc since it is the one responsible to define positions and scales for the IFC models.
These 2 models are linked to each other coming from Autodesk Revit so they should match in positions and scale.
This is the result I get when using my viewer or when using the demo from this repo

but when we load the two models in the BIM Vision tool they are aligned in terms of position and scale.

Also it might be useful to know that I think this happens because the length unit in one of the models is foot while it is meter in the other.
I noticed that for imperial and metric units both considered as THREE.js unit, for example, this causes the models with feet as length unit to be larger than it's supposed scale, since feet will be consiered same length as meter where both are THREE.js unit
as in this picture, I uploaded two files of the same model in using IFC.js, one is metric and the other is imperial, both models are of different unit convension. Unit convention should be the same for all models.

::take
🟢🟢🟢
::take
Hi, @BSchafer01! Thanks for taking this bounty! The due date is November 15, 2022 UTC.
If you need to submit some pull requests (PR) to complete the tasks, make sure that the last and only the last PR has a title that either starts with the bounty ID or is exactly the same as the bounty name. After the PR is merged, this bounty’s status will automatically changed to done.
If you do not need to make a PR, tell the manager @agviegas to run ::done command after your tasks is confirmed to be done.
Good luck!
This issue should be resolved with the pull request merged recently #245
::done
::done
🟢🟢🟢
::done
Hi, @BSchafer01! Thanks for your contributions! Please submit an expense to IFC.js Open Collective. Then, tell us the invoice number via the ::expense::_____ command (replace the _____ with the invoice number).
This issue should be resolved with the pull request merged recently #245
Hello @BSchafer01 While trying to solve issue #247 i found a problem with unit conversion. This is not a big issue but i would like to comment it to you before making any change. Probably you know better about this issue.
Hi @QuimMoya
Can you describe the problem a bit? I downloaded the files and pulled the latest commits to my forked main branch. I noticed the "test_wrong" file was in millimeters and the "test" file was in meters, but even loading both files in they seem to be overlapping perfectly

::expense::104187
🔴🔴🔴
::expense::104187
Hi, @BSchafer01! We cannot find a new expense with that invoice number. Please re-check the invoice number and re-send the command using the correct one.
Hi @agviegas I've messed up the flow of the automation I believe. The expense has already been approved. I didn't use the "done" command until the expense was approved on Open Collective. Sorry about the confusion
No worries! :) Next time you can first use done and then we'll approve the expense. Only then the issue is closed. Cheers!
Hi @QuimMoya Can you describe the problem a bit? I downloaded the files and pulled the latest commits to my forked main branch. I noticed the "test_wrong" file was in millimeters and the "test" file was in meters, but even loading both files in they seem to be overlapping perfectly
Yes, now they match because I made some corrections, you can see them in the lines 363 to 387 inside web-ifc.h
I will try to explain:
In the picture above i loaded both models, the "test" and "test_wrong". The test.ifc shows fine, but the test_wrong.ifc is the background gray faces you are seeing. Essentially it is 1000 bigger than it should be.
In test_wrong.ifc file you have the line #16 indicating that the model is in millimeters, but this line #16 is not referenced by the IFCPROJECT, it is only referenced by line #5185 (IFCMEASUREWITHUNIT)
Notice that the IFCUNITASSIGNMENT is only making reference to #2 and #3, but omits #16, #17, etc...
What is happening is that in the scale correction (web-ifc.h lines 327 to 349) this line #16 is omitted because it is not referenced in the project, but it is referenced in IFCMEASUREWITHUNIT. When you read this IFCMEASUREWITHUNIT there is no scale transformation, so the model does not convert from millimeters to meters... This is why i added these lines from 363 to 387.
But I'm not sure about this solution...
Ah I see, I made the incorrect assumption that the IFCUNITSASSIGNMENT referenced by the project would also include the base units. I had anticipated a conversion from something like millimeters to inches and changed the linear scale factor to be multiplied to the prefix units in the IFCSIUNIT case, but didn't realize it was only referenced by the IFCMEASUREWITHUNIT line.
With all that said, I think your solution you've implemented is the correct one in this case.
But, if line #16 had been also referenced in the project, then unit conversion will take place twice... this is why i'm not sure about my solution.