engine_web-ifc icon indicating copy to clipboard operation
engine_web-ifc copied to clipboard

Add a callback progress

Open favreau84 opened this issue 4 years ago • 23 comments

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

image

favreau84 avatar Nov 08 '21 20:11 favreau84

This issue is now a bounty. Whoever solves this will get $100. More information here.

agviegas avatar May 15 '22 23:05 agviegas

I'll like to take this bounty. Please let me know the process.

aka-blackboots avatar May 16 '22 18:05 aka-blackboots

Does this issue need a Progress Bar something like this with proper details? If yes please let me know @agviegas

aka-blackboots avatar May 19 '22 04:05 aka-blackboots

@aka-blackboots no! You just need to:

  1. Find out where the ifc elements geometry are generated
  2. Allow the user to give a callback function to web-ifc. That callback function should look like this: (progress, total) => void
  3. 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!

agviegas avatar May 21 '22 16:05 agviegas

This bounty is free again!

agviegas avatar Jun 17 '22 17:06 agviegas

@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.

makc avatar Jun 18 '22 04:06 makc

(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 avatar Jun 18 '22 05:06 makc

@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 avatar Jun 22 '22 15:06 agviegas

@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).

makc avatar Jun 24 '22 02:06 makc

just to make sure - those points actually apply to web-if-three, changes to web-ifc (1st 2 commits) are not breaking

makc avatar Jun 24 '22 02:06 makc

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?

makc avatar Jun 24 '22 15:06 makc

Hey @makc I'm a bit concerned about the time increase. Wouldn't it be possible to do something like this?

image

agviegas avatar Jun 27 '22 11:06 agviegas

Hey @makc how is this going? Did you manage to solve it? Cheers!

agviegas avatar Aug 08 '22 22:08 agviegas

sorry @agviegas I forgot. give me until monday

makc avatar Aug 12 '22 23:08 makc

::take

agviegas avatar Aug 13 '22 18:08 agviegas

🟢🟢🟢

::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!

agviegas avatar Aug 13 '22 18:08 agviegas

::drop

agviegas avatar Aug 13 '22 18:08 agviegas

🟢🟢🟢

::drop

Hi, @agviegas! Thanks for giving it a try! It’s now once again available for anyone to take.

agviegas avatar Aug 13 '22 18:08 agviegas

@makc no worries! Can you please use the ::take command like I did? We have just automated the managing of bounties :)

agviegas avatar Aug 13 '22 18:08 agviegas

::take

makc avatar Aug 13 '22 18:08 makc

🟢🟢🟢

::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 avatar Aug 13 '22 18:08 agviegas

@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?

makc avatar Aug 13 '22 18:08 makc

🔴🔴🔴

Hi, @makc! The date is past due, your assignment has been revoked. It’s now available for anyone to take.

agviegas avatar Sep 04 '22 00:09 agviegas

::take

beachtom avatar Dec 08 '22 08:12 beachtom

🟢🟢🟢

::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!

agviegas avatar Dec 08 '22 08:12 agviegas