@Andrej730 said:
- You can use get_decomposition() to get elements in the
IfcBuildingStorey
or in other spatial elements. Using api calls usually simpler as it doesn't require to remember the IFC schema attributes exactly and ignore some caveats there might be along the way.
Yes, I use the api calls too. In this case I am intentionally using the vanilla IFC code as a way to understand more of the concepts of the IFC Schema especially wrt to ‘relationships’.
- To debug this kind of error
AttributeError: entity instance of type 'IFC4.IfcPropertySet' has no attribute 'Quantities'.
you can printelement.IsDefinedBy[0].RelatingPropertyDefinition
- it won't beIfcElementQuantity
as you expected butIfcPropertySet
element that doesn't haveQuantities
attribute. To workaround you can skip all elements that are not IfcElementQuantity.
But then you'll also need to handle different type of quantities that can appear in qset - e.g.
IfcQuantityLength
won't haveVolumeValue
and accessing it will result in the similar error as above. Then you can either skip them too or do some other logic.
You’re right it wasn’t ‘ IfcElementQuantity’ and just like @Massimo confirmed but it’s okay now.
- Alternatively, you can use another api method get_psets() that has argument to get only quantity sets and will return a dictionary with quantities names and their values which might make them easier to process.
Noted. Btw is it possible to add the ‘Qto_BaseQuantities’ by code without adding it through BBIM UI setting (eg. SHIFT+Q).
Pardon the delay some internet problems for the past days.