web-ui: enable assigning parametric quantities from queries #5369

This commit is contained in:
myoualid
2024-09-23 02:21:15 +01:00
parent 9f542c30b3
commit 193daff617
6 changed files with 357 additions and 58 deletions
@@ -1630,3 +1630,26 @@ def copy_deep(
else:
new[i] = attribute
return new
def has_property(product: ifcopenshell.entity_instance, property_name: str) -> bool:
"""
Check if a product has a property with a given name.
:param product: The IFC product
:type product: ifcopenshell.entity_instance
:param property_name: The property name
:type property_name: str
:return: True if the product has the property, False otherwise
:rtype: bool
Example:
.. code:: python
product = file.by_type("IfcWall")[0]
has_property = ifcopenshell.util.element.has_property(product, "NetArea")
"""
if not property_name:
return True
qtos = get_psets(product, qtos_only=True)
return any(property_name in quantities.keys() for quantities in qtos.values())