maintain verbosity getting complex property subproperties

This commit is contained in:
Andrej730
2024-04-10 12:24:45 +05:00
parent e69597f72b
commit 13c6fdd3c6
@@ -163,7 +163,9 @@ def get_psets(
if should_inherit: if should_inherit:
element_type = ifcopenshell.util.element.get_type(element) element_type = ifcopenshell.util.element.get_type(element)
if element_type: if element_type:
psets = get_psets(element_type, psets_only=psets_only, qtos_only=qtos_only, should_inherit=False) psets = get_psets(
element_type, psets_only=psets_only, qtos_only=qtos_only, should_inherit=False, verbose=verbose
)
for relationship in is_defined_by: for relationship in is_defined_by:
if relationship.is_a("IfcRelDefinesByProperties"): if relationship.is_a("IfcRelDefinesByProperties"):
definition = relationship.RelatingPropertyDefinition definition = relationship.RelatingPropertyDefinition
@@ -243,7 +245,7 @@ def get_quantity(
result = quantity[3] result = quantity[3]
elif quantity.is_a("IfcPhysicalComplexQuantity"): elif quantity.is_a("IfcPhysicalComplexQuantity"):
data = {k: v for k, v in quantity.get_info().items() if v is not None and k != "Name"} data = {k: v for k, v in quantity.get_info().items() if v is not None and k != "Name"}
data["properties"] = get_quantities(quantity.HasQuantities) data["properties"] = get_quantities(quantity.HasQuantities, verbose=verbose)
del data["HasQuantities"] del data["HasQuantities"]
result = data result = data
if verbose: if verbose:
@@ -274,7 +276,7 @@ def get_quantities(
} }
elif quantity.is_a("IfcPhysicalComplexQuantity"): elif quantity.is_a("IfcPhysicalComplexQuantity"):
data = {k: v for k, v in quantity.get_info().items() if v is not None and k != "Name"} data = {k: v for k, v in quantity.get_info().items() if v is not None and k != "Name"}
data["properties"] = get_quantities(quantity.HasQuantities) data["properties"] = get_quantities(quantity.HasQuantities, verbose=verbose)
del data["HasQuantities"] del data["HasQuantities"]
results[quantity[0]] = data results[quantity[0]] = data
if verbose: if verbose:
@@ -312,7 +314,7 @@ def get_property(
result = prop.get_info() result = prop.get_info()
elif prop.is_a("IfcComplexProperty"): elif prop.is_a("IfcComplexProperty"):
data = {k: v for k, v in prop.get_info().items() if v is not None and k != "Name"} data = {k: v for k, v in prop.get_info().items() if v is not None and k != "Name"}
data["properties"] = get_properties(prop.HasProperties) data["properties"] = get_properties(prop.HasProperties, verbose=verbose)
del data["HasProperties"] del data["HasProperties"]
result = data result = data
if verbose: if verbose:
@@ -358,7 +360,7 @@ def get_properties(
results[prop[0]] = {"id": prop.id(), "class": prop.is_a(), "value": results[prop[0]]} results[prop[0]] = {"id": prop.id(), "class": prop.is_a(), "value": results[prop[0]]}
elif ifc_class == "IfcComplexProperty": elif ifc_class == "IfcComplexProperty":
data = {k: v for k, v in prop.get_info().items() if v is not None and k != "Name"} data = {k: v for k, v in prop.get_info().items() if v is not None and k != "Name"}
data["properties"] = get_properties(prop.HasProperties) data["properties"] = get_properties(prop.HasProperties, verbose=verbose)
del data["HasProperties"] del data["HasProperties"]
results[prop[0]] = data results[prop[0]] = data
if verbose: if verbose: