engine_web-ifc
engine_web-ifc copied to clipboard
Added property helper that gets all items of type including subtypes
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.
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
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 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
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.