cost module web ui:

- add setting options to hide/show columns
- Cost classification column
- New Cost Classification Form to display active classification library, add/delete classification references
This commit is contained in:
myoualid
2024-09-22 20:00:09 +01:00
parent a053472558
commit 9f542c30b3
8 changed files with 760 additions and 217 deletions
+12 -1
View File
@@ -3,10 +3,11 @@ import ifcopenshell.util.unit
from typing import Any
import ifcopenshell.util.cost
import ifcopenshell.util.date
from ifcopenshell.util.classification import get_references
CostItem = dict[str, Any]
class ifc5D2json:
def __init__(self):
self.json: str = None
@@ -57,11 +58,21 @@ class ifc5D2json:
data["id"] = cost_item.id()
data["IsNestedBy"] = []
data["IsSum"] = self.check_if_cost_item_is_sum(cost_item)
data["Classification"] = self.get_cost_classifications(cost_item)
json_data.append(data)
for rel in cost_item.IsNestedBy or []:
for sub_cost in rel.RelatedObjects:
self.extract_cost_item_data(sub_cost, data["IsNestedBy"])
def get_cost_classifications(self, cost_item: ifcopenshell.entity_instance) -> list:
results = []
if cost_item:
for reference in get_references(cost_item):
data = reference.get_info()
del data["ReferencedSource"]
results.append(data)
return results
def check_if_cost_item_is_sum(self, cost_item: ifcopenshell.entity_instance) -> bool:
cost_values = []
if cost_item.is_a("IfcCostItem"):