mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-29 16:22:53 +00:00
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:
@@ -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"):
|
||||
|
||||
Reference in New Issue
Block a user