ifc5d: fix two csv2ifc bugs found by round-trip test

ItemIsASum and Quantities are exporter columns that were missing from
MAIN_CSV_HEADER_COLUMNS, causing them to be misidentified as numeric cost
value categories on re-import. Also initialise rate_cost_schedule to None
before the search loop to avoid UnboundLocalError when no match is found.

Generated with the assistance of an AI coding tool.
This commit is contained in:
Bruno Postle
2026-07-04 16:08:43 +01:00
parent eafa158ca0
commit a0ce930994
+3
View File
@@ -68,6 +68,8 @@ MAIN_CSV_HEADER_COLUMNS.extend(
# Not sure what this for but it's present in sample .csv.
"Subtotal",
# Columns from exporter.
"ItemIsASum",
"Quantities",
"RateSubtotal",
"TotalPrice",
# Deprecated columns from exporter, shouldn't be exported any longer.
@@ -335,6 +337,7 @@ class Csv2Ifc:
if cost_rate.get("Schedule") and cost_rate.get("RateID"):
# if cost_rate["Schedule"] is not "":
rate_cost_schedule = None
schedules = self.file.by_type("IfcCostSchedule")
for schedule in schedules:
if schedule.Name == cost_rate["Schedule"]: