mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-01 09:26:26 +00:00
fix error exporting schedule of rates #4723
Issue occurred when cost item would have no quantities but had controlled objects with quantities. 1) just added a check to ensure that cost_item.CostQuantities are present 2) removed possible None return value in get_cost_item_quantity as it actually will break process_cost_data and it's never used anywhere else 3) has_changed_name was unused 4) fix possible similar issue in cost.data (though _get_object_quantities method is unused)
This commit is contained in:
@@ -202,6 +202,9 @@ class CostSchedulesData:
|
||||
def _get_object_quantities(cls, cost_item, element):
|
||||
if not element.is_a("IfcObject"):
|
||||
return []
|
||||
cost_quantities = cost_item.CostQuantities
|
||||
if not cost_quantities:
|
||||
return []
|
||||
results = []
|
||||
for relationship in element.IsDefinedBy:
|
||||
if not relationship.is_a("IfcRelDefinesByProperties"):
|
||||
@@ -210,7 +213,7 @@ class CostSchedulesData:
|
||||
if not qto.is_a("IfcElementQuantity"):
|
||||
continue
|
||||
for prop in qto.Quantities:
|
||||
if prop in cost_item.CostQuantities or []:
|
||||
if prop in cost_quantities:
|
||||
results.append(prop.id())
|
||||
return results
|
||||
|
||||
|
||||
Reference in New Issue
Block a user