mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 10:57:49 +00:00
black .
This commit is contained in:
@@ -1631,10 +1631,11 @@ def copy_deep(
|
||||
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
|
||||
@@ -1645,11 +1646,11 @@ def has_property(product: ifcopenshell.entity_instance, property_name: str) -> b
|
||||
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())
|
||||
return any(property_name in quantities.keys() for quantities in qtos.values())
|
||||
|
||||
Reference in New Issue
Block a user