Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort levels by height for exploding tool #93

Closed
5 tasks done
RASRC opened this issue Jul 26, 2023 · 8 comments
Closed
5 tasks done

Sort levels by height for exploding tool #93

RASRC opened this issue Jul 26, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@RASRC
Copy link

RASRC commented Jul 26, 2023

Describe the bug 📝

I'm having some problems with the explode tool.

It appears to don't work well with levels that have negative elevation (I mean that this levels are positioned below the IFC origin). The elements are displayed in an incorrect position above the origin when you explode the model like in the screen captures.
There is something I can do to fix it? Thanks!
Cap02
Cap03

Reproduction ▶️

https://github.com/RASRC/FrontEnd_Course.git

Steps to reproduce 🔢

Activating the explode tool in the bottom menu of the app

System Info 💻

openbim-components

Used Package Manager 📦

npm

Error Trace/Logs 📃

No response

Validations ✅

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Make sure this is a IFC.js components issue and not a framework-specific issue. For example, if it's a THREE.js related bug, it should likely be reported to mrdoob/threejs instead.
  • Check that this is a concrete bug. For Q&A join our Discord Chat Server.
  • The provided reproduction is a minimal reproducible example of the bug.
@RASRC RASRC added the bug Something isn't working label Jul 26, 2023
@agviegas agviegas changed the title Problems during exploding levels with negative elevation Sort levels by height for exploding tool Aug 4, 2023
@RASRC
Copy link
Author

RASRC commented Sep 3, 2023

Hi @agviegas

I write to ask you if there is a chance to solve this issue for the official release.

Thanks!

@agviegas
Copy link
Contributor

agviegas commented Sep 4, 2023

We'll try! Otherwise, we'll fix it after September 20. Cheers!

@agviegas agviegas added this to the 1.2.0 milestone Nov 2, 2023
@RASRC
Copy link
Author

RASRC commented Nov 5, 2023

Hi @agviegas.

I send you the IFC file. It could be useful if you want to do some tests.

Thanks!

25052023-896-WTC.zip

@agviegas agviegas removed this from the 1.2.0 milestone Nov 25, 2023
@HoyosJuan
Copy link
Member

Hi @RASRC! I'm just following up this issue. Are still experiencing the same problems when updating to openbim-components@1.1.5?

@RASRC
Copy link
Author

RASRC commented Dec 1, 2023

Hi @HoyosJuan! Yes I have that version running and the issue is still there. I left the ifc file in a previous message if you want to do some tests.
Thanks!

@RASRC
Copy link
Author

RASRC commented Jan 13, 2024

Hi @HoyosJuan! I'm using the 1.2.0 version of the library now and still have the same issue

@RASRC
Copy link
Author

RASRC commented Mar 25, 2024

Hi @HoyosJuan!
Did you can test the FragmentExploder with the model I attached to the issue?
Thanks.

@agviegas
Copy link
Contributor

Hey! After the big refactor of the library, this milestone we are checking and solving issues. We have also updated the exploder. Now, you can classify the model like this:

const classifier = components.get(OBC.Classifier);
await classifier.bySpatialStructure(model);

That won't sort the storeys by default because it's generic to any kind of relationship, but you can easily sort them by getting all the storeys and using its elevation information. Good thing about this approach is that even in those files where the elevation information is somewhere else, a custom sort method can be established for the exploder:

const storeys = await model.getAllPropertiesOfType(WEBIFC.IFCBUILDINGSTOREY);

if (storeys) {
  const storeyList = Object.values(storeys);
  storeyList.sort((a, b) => a.Elevation.value - b.Elevation.value);
  const sortedIds = storeyList.map((item) => item.Name.value);
  const newClassifiedStories: typeof classifier.list.spatialStructures = {};
  for (const id of sortedIds) {
    const classifiedStories = classifier.list.spatialStructures;
    newClassifiedStories[id] = classifiedStories[id];
  }
  classifier.list.spatialStructures = newClassifiedStories;
}

This should be possible from @thatopen/components@2.0.14, which I'm publishing right now. I'm also going to update the docs right away. Let me know if you face any issues with this. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants