Add a callback progress
Description
Add a progress callback to the loading process. The final objective is to provide a constant feedback to a user who is loading a model with web-ifc-three.
A super nice feature from a UX perspective :-)
Origin

This issue is now a bounty. Whoever solves this will get $100. More information here.
I'll like to take this bounty. Please let me know the process.
Does this issue need a Progress Bar something like this with proper details? If yes please let me know @agviegas
@aka-blackboots no! You just need to:
- Find out where the ifc elements geometry are generated
- Allow the user to give a callback function to web-ifc. That callback function should look like this:
(progress, total) => void - Call that callback function each time a new ifc item is generated, passing the index of the current item and the total
If you have any questions on the way, let me know!
This bounty is free again!
@agviegas unfortunately, your little 3-step plan will not work. As is, web-if-three's LoadAllGeometry function calls ifcAPI.StreamAllMeshes with a callback to receive each geometry data which is executed inside this very function - corresponding c++ code in web-ifc-api.cpp is
for (auto& type : types)
{
auto elements = loader->GetExpressIDsWithType(type);
StreamMeshes(modelID, elements, callback);
}
if you want js to be able to reflect the progress, you would need to change API to "stream" these expressIDs instead of meshes, and then request meshes one by one in small numbers.
(for some context, on my laptop 169MB tower file from another issue is loaded and parsed in 2 seconds, and then 10 seconds are spent in StreamAllMeshes - this whole time the script is blocking the browser)
@makc I see 🤔 And would it be possible to know in advance the number of meshes to be streamed? If there was an additional method to do that, at least the user would now how many iterations of the callback of StreamAllMeshes would be called. I would consider that a possible solution to this!
@agviegas I totally forgot about this, sorry. Please check the above #186 - this kind of follows our discord discussion. There are a coupe of points to note:
- loading time increases (since we now give a browser extra idle time to reflect the progress), in case of 169MB file this means 15 seconds instead of 10;
- we have to wait until the progress is 100% before closing the model (so the code that used to close it immediately is likely going to break).
just to make sure - those points actually apply to web-if-three, changes to web-ifc (1st 2 commits) are not breaking
so @agviegas - if you make another LoadAllGeometryAsync (with progress callback, and maybe returning a Promise) in web-ifc-three instead, and leave LoadAllGeometry as-is, then none of this will be breaking. what do you think?
Hey @makc I'm a bit concerned about the time increase. Wouldn't it be possible to do something like this?

Hey @makc how is this going? Did you manage to solve it? Cheers!
sorry @agviegas I forgot. give me until monday
::take
🟢🟢🟢
::take
Hi, @agviegas! Thanks for taking this bounty! The due date is September 3, 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!
::drop
🟢🟢🟢
::drop
Hi, @agviegas! Thanks for giving it a try! It’s now once again available for anyone to take.
@makc no worries! Can you please use the ::take command like I did? We have just automated the managing of bounties :)
::take
🟢🟢🟢
::take
Hi, @makc! Thanks for taking this bounty! The due date is September 3, 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!
@agviegas,
make sure that the last and only the last PR has a title that either starts with the bounty ID
what's bounty id?
🔴🔴🔴
Hi, @makc! The date is past due, your assignment has been revoked. It’s now available for anyone to take.
::take
🟢🟢🟢
::take
Hi, @beachtom! Thanks for taking this bounty! The due date is December 29, 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!