Implement cost identification numbers and big cleanup to cost schedule UI

This commit is contained in:
Dion Moult
2021-08-13 18:01:23 +10:00
parent 26f800331e
commit 2f3c79a0e6
5 changed files with 87 additions and 47 deletions
+4 -1
View File
@@ -60,18 +60,20 @@ class Csv2Ifc:
def get_row_cost_data(self, row):
name = row[self.headers["Name"]]
identification = row[self.headers["Identification"]] if "Identification" in self.headers else None
cost_quantities = row[self.headers["Quantity"]]
cost_quantities_unit = row[self.headers["Unit"]]
if self.has_categories:
cost_values = {
k: float(row[v])
for k, v in self.headers.items()
if k not in ["Hierarchy", "Name", "Quantity", "Unit", "Subtotal"] and row[v]
if k not in ["Hierarchy", "Identification", "Name", "Quantity", "Unit", "Subtotal"] and row[v]
}
else:
cost_values = row[self.headers["Value"]]
cost_values = float(cost_values) if cost_values else None
return {
"Identification": str(identification) if identification else None,
"Name": str(name) if name else None,
"CostQuantities": float(cost_quantities) if cost_quantities else None,
"CostQuantitiesUnit": str(cost_quantities_unit) if cost_quantities_unit else None,
@@ -99,6 +101,7 @@ class Csv2Ifc:
cost_item["ifc"] = ifcopenshell.api.run("cost.add_cost_item", self.file, cost_item=parent)
cost_item["ifc"].Name = cost_item["Name"]
cost_item["ifc"].Identification = cost_item["Identification"]
if not cost_item["CostValues"]:
cost_value = ifcopenshell.api.run("cost.add_cost_value", self.file, parent=cost_item["ifc"])
+14 -14
View File
@@ -1,14 +1,14 @@
"Hierarchy","Name","Quantity","Unit","Foo","Bar","Baz","Subtotal"
1,"Demolition",,,,,,301
,,,,,,,
2,"Building A",,,,,,96
,,,,,,,
3,"Soft strip",1,"m",5,4,3,12
3,"Hard Strip",2,"m2",6,5,4,30
3,"Hazmat",3,"m3",7,6,5,54
,,,,,,,
2,"Building B",,,,,,205
,,,,,,,
3,"Soft strip",4,"hr",8,7,,60
3,"Hard Strip",5,,9,,8,85
3,"Hazmat",6,"kg",10,,,60
"Hierarchy","Identification","Name","Quantity","Unit","Foo","Bar","Baz","Subtotal"
1,1,"Demolition",,,,,,301
,,,,,,,,
2,1.1,"Building A",,,,,,96
,,,,,,,,
3,"1.1.1","Soft strip",1,"m",5,4,3,12
3,"1.1.2","Hard Strip",2,"m2",6,5,4,30
3,"1.1.3","Hazmat",3,"m3",7,6,5,54
,,,,,,,,
2,1.2,"Building B",,,,,,205
,,,,,,,,
3,"1.2.1","Soft strip",4,"hr",8,7,,60
3,"1.2.2","Hard Strip",5,,9,,8,85
3,"1.2.3","Hazmat",6,"kg",10,,,60
1 Hierarchy Identification Name Quantity Unit Foo Bar Baz Subtotal
2 1 1 Demolition 301
3
4 2 1.1 Building A 96
5
6 3 1.1.1 Soft strip 1 m 5 4 3 12
7 3 1.1.2 Hard Strip 2 m2 6 5 4 30
8 3 1.1.3 Hazmat 3 m3 7 6 5 54
9
10 2 1.2 Building B 205
11
12 3 1.2.1 Soft strip 4 hr 8 7 60
13 3 1.2.2 Hard Strip 5 9 8 85
14 3 1.2.3 Hazmat 6 kg 10 60