Fix #3607. IfcCSV now supports omitting the GlobalId column. This is great for presentation schedules, but the tradeoff is that you can't use it for imports.

This commit is contained in:
Dion Moult
2023-08-20 14:41:34 +10:00
parent a9ea54a146
commit 312b2aecf0
4 changed files with 54 additions and 10 deletions
@@ -155,7 +155,10 @@ class ExportIfcCsv(bpy.types.Operator):
output=self.filepath,
format=props.format,
delimiter=sep,
include_global_id=props.include_global_id,
null=props.null_value,
bool_true=props.true_value,
bool_false=props.false_value,
)
return {"FINISHED"}
@@ -183,7 +186,15 @@ class ImportIfcCsv(bpy.types.Operator):
ifc_csv = ifccsv.IfcCsv()
sep = props.csv_custom_delimiter if props.csv_delimiter == "CUSTOM" else props.csv_delimiter
attributes = [a.name for a in props.csv_attributes]
ifc_csv.Import(ifc_file, self.filepath, attributes=attributes, delimiter=sep, null=props.null_value)
ifc_csv.Import(
ifc_file,
self.filepath,
attributes=attributes,
delimiter=sep,
null=props.null_value,
bool_true=props.true_value,
bool_false=props.false_value,
)
if not props.should_load_from_memory:
ifc_file.write(props.csv_ifc_file)
purge_module_data()
@@ -54,7 +54,10 @@ class CsvProperties(PropertyGroup):
],
)
csv_attributes: CollectionProperty(name="CSV Attributes", type=CsvAttribute)
include_global_id: BoolProperty(default=True, name="Include GlobalId")
null_value: StringProperty(default="N/A", name="Null Value")
true_value: StringProperty(default="YES", name="True Value")
false_value: StringProperty(default="NO", name="False Value")
csv_delimiter: EnumProperty(
items=[
(";", ";", ""),
@@ -67,8 +67,14 @@ class BIM_PT_ifccsv(Panel):
row = layout.row(align=True)
row.prop(props, "csv_custom_delimiter")
row = layout.row(align=True)
row = layout.row()
row.prop(props, "include_global_id")
row = layout.row()
row.prop(props, "null_value")
row = layout.row()
row.prop(props, "true_value")
row = layout.row()
row.prop(props, "false_value")
blenderbim.bim.helper.draw_filter(self.layout, props, SearchData, "csv")