mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
ifc5d csv export - rename Description column to Name #5492
Because actually it is a name and this is the column name that csv2ifc expects.
This commit is contained in:
@@ -107,6 +107,16 @@ class Csv2Ifc:
|
||||
mandatory_fields.update(non_sor_fields)
|
||||
available_fields = set(self.headers.keys())
|
||||
missing_fields = mandatory_fields - available_fields
|
||||
|
||||
# TODO: 25-04-17 Deprecated 'Description' argument, should fully remove later.
|
||||
if missing_fields and "Name" in missing_fields and "Description" in available_fields:
|
||||
print(
|
||||
"WARNING. 'Description' column is deprecated and should be renamed to 'Name'. It will be deprecated soon completely."
|
||||
)
|
||||
self.headers["Name"] = self.headers["Description"]
|
||||
del self.headers["Description"]
|
||||
missing_fields.remove("Name")
|
||||
|
||||
if missing_fields:
|
||||
if missing_fields == non_sor_fields and not self.is_schedule_of_rates:
|
||||
self.is_schedule_of_rates = True
|
||||
|
||||
@@ -35,7 +35,7 @@ class CostItem(TypedDict):
|
||||
Hierarchy: str
|
||||
Id: int
|
||||
Identification: Union[str, None]
|
||||
Description: Union[str, None]
|
||||
Name: Union[str, None]
|
||||
Unit: str
|
||||
Quantity: int
|
||||
ChildrenData: list["CostItem"]
|
||||
@@ -131,7 +131,7 @@ class IfcDataGetter:
|
||||
"Hierarchy": hierarchy,
|
||||
"Id": cost_item.id(),
|
||||
"Identification": cost_item.Identification,
|
||||
"Description": cost_item.Name,
|
||||
"Name": cost_item.Name,
|
||||
"Unit": cost_values_data[0]["unit"] if cost_values_data else "",
|
||||
"Quantity": quantity_data["quantity"]["total_quantity"],
|
||||
"ChildrenData": [],
|
||||
@@ -290,7 +290,7 @@ class Ifc5Dwriter:
|
||||
"Hierarchy",
|
||||
"Index",
|
||||
"Identification",
|
||||
"Description",
|
||||
"Name",
|
||||
"Quantity",
|
||||
"Unit",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user