See #3951. IfcCSV now supports list concatenation.

This commit is contained in:
Dion Moult
2023-11-01 22:47:16 +11:00
parent c9dcd70cdb
commit e2b132ba51
5 changed files with 12 additions and 2 deletions
@@ -207,6 +207,7 @@ class ExportIfcCsv(bpy.types.Operator):
empty=props.empty_value,
bool_true=props.true_value,
bool_false=props.false_value,
concat=props.concat_value,
sort=sort,
groups=groups,
summaries=summaries,
@@ -72,6 +72,7 @@ class CsvProperties(PropertyGroup):
empty_value: StringProperty(default="-", name="Empty String Value")
true_value: StringProperty(default="YES", name="True Value")
false_value: StringProperty(default="NO", name="False Value")
concat_value: StringProperty(default=", ", name="Concat Value")
csv_delimiter: EnumProperty(
items=[
(";", ";", ""),
@@ -79,6 +79,8 @@ class BIM_PT_ifccsv(Panel):
row.prop(props, "true_value")
row = layout.row()
row.prop(props, "false_value")
row = layout.row()
row.prop(props, "concat_value")
layout.use_property_split = False
blenderbim.bim.helper.draw_filter(self.layout, props, SearchData, "csv")
+5
View File
@@ -73,6 +73,7 @@ class IfcCsv:
empty="",
bool_true="YES",
bool_false="NO",
concat=", ",
sort=None,
groups=None,
summaries=None,
@@ -103,6 +104,8 @@ class IfcCsv:
value = bool_true
elif value is False:
value = bool_false
elif isinstance(value, (list, tuple)) and concat is not None:
value = concat.join(map(str, value))
result.append(value)
self.results.append(result)
@@ -453,6 +456,7 @@ if __name__ == "__main__":
)
parser.add_argument("--bool_true", type=str, default="YES", help="How to represent true values. Defaults to YES.")
parser.add_argument("--bool_false", type=str, default="NO", help="How to represent false values. Defaults to NO.")
parser.add_argument("--concat", type=str, default=", ", help="How to concatenate lists. Defaults to ', '.")
parser.add_argument("-q", "--query", type=str, default="", help='Specify a IFC query selector, such as "IfcWall"')
parser.add_argument(
"-a",
@@ -486,6 +490,7 @@ if __name__ == "__main__":
empty=args.empty,
bool_true=args.bool_true,
bool_false=args.bool_false,
concat=args.concat,
sort=sort,
)
elif getattr(args, "import"):
+3 -2
View File
@@ -66,8 +66,8 @@ utility:
::
$ python -m ifccsv -h
usage: ifccsv.py [-h] -i IFC [-s SPREADSHEET] [-f FORMAT] [-d DELIMITER] [-n NULL] [-e EMPTY] [--bool_true BOOL_TRUE] [--bool_false BOOL_FALSE] [-q QUERY] [-a ATTRIBUTES [ATTRIBUTES ...]] [--headers HEADERS [HEADERS ...]]
[--sort SORT [SORT ...]] [--order ORDER [ORDER ...]] [--export] [--import]
usage: ifccsv.py [-h] -i IFC [-s SPREADSHEET] [-f FORMAT] [-d DELIMITER] [-n NULL] [-e EMPTY] [--bool_true BOOL_TRUE] [--bool_false BOOL_FALSE] [--concat CONCAT] [-q QUERY] [-a ATTRIBUTES [ATTRIBUTES ...]]
[--headers HEADERS [HEADERS ...]] [--sort SORT [SORT ...]] [--order ORDER [ORDER ...]] [--export] [--import]
Exports IFC data to and from CSV
@@ -87,6 +87,7 @@ utility:
How to represent true values. Defaults to YES.
--bool_false BOOL_FALSE
How to represent false values. Defaults to NO.
--concat CONCAT How to concatenate lists. Defaults to ', '.
-q QUERY, --query QUERY
Specify a IFC query selector, such as "IfcWall"
-a ATTRIBUTES [ATTRIBUTES ...], --attributes ATTRIBUTES [ATTRIBUTES ...]