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

Added property helper that gets all items of type including subtypes

Open MadsHolten opened this issue 2 years ago • 4 comments

The method getAllItemsOfType only returns items that explicitly belong to a certain IFC Class, but often you would like to query for a higher level class (for example IfcElement) and get all items that belong to this class or any of its sub-classes. This functionality is now supported in the new getAllItemsOfTypeOrSubtype method that I added.

It's my first contribution to any open source process so sorry if I'm breaking some guidelines here. I did not include tests and I only tested it in my own implementation where all subclasses are retrieved in ~30ms.

MadsHolten avatar Dec 16 '21 10:12 MadsHolten

Might be a good opprtunity to add a correspending test to confirm this will continue to work?

It would just be a matter of adding another case like these, which already use getAllItemsOfType. https://github.com/tomvandig/web-ifc/blob/6b6a5cabbea4b39d3a3a1d686039c182beff9fe0/tests/functional/Properties.spec.ts#L23

awmartin avatar Dec 16 '21 15:12 awmartin

Might be a good opprtunity to add a correspending test to confirm this will continue to work?

It would just be a matter of adding another case like these, which already use getAllItemsOfType.

https://github.com/tomvandig/web-ifc/blob/6b6a5cabbea4b39d3a3a1d686039c182beff9fe0/tests/functional/Properties.spec.ts#L23

Good suggestion. Will add that right away

MadsHolten avatar Dec 16 '21 19:12 MadsHolten

@MadsHolten How is the types-tree.ts file generated? To make it work for other schema types it would have to be generated from https://github.com/tomvandig/web-ifc/blob/main/src/schema/gen_functional_types.ts

tomvandig avatar Dec 20 '21 19:12 tomvandig

I used the OWL version of the schema as explained here: https://docs.google.com/document/d/1xBXJMJHwraqVbjJYFE1sUZnplU4B-Mp9MHIpWd0PeEQ/edit?usp=drivesdk did a bit of post processing with JavaScript to clean it up.

MadsHolten avatar Dec 20 '21 21:12 MadsHolten