From a0ce930994a9bef129e188f0154324886638d7a7 Mon Sep 17 00:00:00 2001 From: Bruno Postle Date: Sat, 4 Jul 2026 16:08:43 +0100 Subject: [PATCH] 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. --- src/ifc5d/ifc5d/csv2ifc.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ifc5d/ifc5d/csv2ifc.py b/src/ifc5d/ifc5d/csv2ifc.py index 3a876f1098..9f39547d43 100644 --- a/src/ifc5d/ifc5d/csv2ifc.py +++ b/src/ifc5d/ifc5d/csv2ifc.py @@ -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"]: