From c5e5f4ab6a8a0045232237b3b997b74bb3cdd41a Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 20 Oct 2023 13:38:17 +1100 Subject: [PATCH] Fix #3901. Add configurable list concatenation support in IfcFM. --- src/ifcfm/ifcfm/__init__.py | 7 ++++++- src/ifcfm/ifcfm/cobie24.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ifcfm/ifcfm/__init__.py b/src/ifcfm/ifcfm/__init__.py index 70f31c8ef6..20210a2d1a 100644 --- a/src/ifcfm/ifcfm/__init__.py +++ b/src/ifcfm/ifcfm/__init__.py @@ -125,7 +125,7 @@ class Writer: else: self.config = getattr(self.parser.preset, "config") - def write(self, null="N/A", empty="-", bool_true="YES", bool_false="NO"): + def write(self, null="N/A", empty="-", bool_true="YES", bool_false="NO", list_separator=", "): self.categories = {} null = self.config.get("null", null) empty = self.config.get("empty", empty) @@ -155,6 +155,8 @@ class Writer: value = bool_true elif value is False: value = bool_false + elif isinstance(value, (list, tuple)): + value = list_separator.join([str(v) for v in value]) processed_row.append(value) rows.append(processed_row) @@ -261,6 +263,9 @@ class Writer: c += 1 r += 1 + if "Sheet" in workbook.sheetnames and len(workbook.sheetnames) > 1: + workbook.remove(workbook["Sheet"]) + workbook.save(output) def write_pd(self): diff --git a/src/ifcfm/ifcfm/cobie24.py b/src/ifcfm/ifcfm/cobie24.py index c3f8b372a3..d45f8fbbd2 100644 --- a/src/ifcfm/ifcfm/cobie24.py +++ b/src/ifcfm/ifcfm/cobie24.py @@ -248,7 +248,7 @@ def get_attributes(ifc_file): def get_contact_data(ifc_file, element): - the_actor = element.Theactor + the_actor = element.TheActor if the_actor.is_a("IfcPerson"): pao = None