Fix #3589. Users can now configure how the null values are represented in IfcCSV.

This commit is contained in:
Dion Moult
2023-08-18 08:50:39 +10:00
parent a8422717fd
commit ff9903b6a2
5 changed files with 45 additions and 13 deletions
@@ -153,7 +153,15 @@ class ExportIfcCsv(bpy.types.Operator):
ifc_csv = ifccsv.IfcCsv()
attributes = [a.name for a in props.csv_attributes]
sep = props.csv_custom_delimiter if props.csv_delimiter == "CUSTOM" else props.csv_delimiter
ifc_csv.export(ifc_file, results, attributes, output=self.filepath, format=props.format, delimiter=sep)
ifc_csv.export(
ifc_file,
results,
attributes,
output=self.filepath,
format=props.format,
delimiter=sep,
null=props.null_value,
)
return {"FINISHED"}
@@ -179,7 +187,7 @@ class ImportIfcCsv(bpy.types.Operator):
ifc_file = ifcopenshell.open(props.csv_ifc_file)
ifc_csv = ifccsv.IfcCsv()
sep = props.csv_custom_delimiter if props.csv_delimiter == "CUSTOM" else props.csv_delimiter
ifc_csv.Import(ifc_file, self.filepath, delimiter=sep)
ifc_csv.Import(ifc_file, self.filepath, delimiter=sep, null=props.null_value)
if not props.should_load_from_memory:
ifc_file.write(props.csv_ifc_file)
purge_module_data()
@@ -35,6 +35,7 @@ class CsvProperties(PropertyGroup):
csv_ifc_file: StringProperty(default="", name="IFC File")
ifc_selector: StringProperty(default="", name="IFC Selector")
csv_attributes: CollectionProperty(name="CSV Attributes", type=StrProperty)
null_value: StringProperty(default="N/A", name="Null Value")
csv_delimiter: EnumProperty(
items=[
(";", ";", ""),
@@ -72,6 +72,9 @@ class BIM_PT_ifccsv(Panel):
row = layout.row(align=True)
row.prop(props, "csv_custom_delimiter")
row = layout.row(align=True)
row.prop(props, "null_value")
row = layout.row()
split = row.split(factor=0.5)
c = split.column()