mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 02:58:02 +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)
|
mandatory_fields.update(non_sor_fields)
|
||||||
available_fields = set(self.headers.keys())
|
available_fields = set(self.headers.keys())
|
||||||
missing_fields = mandatory_fields - available_fields
|
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:
|
||||||
if missing_fields == non_sor_fields and not self.is_schedule_of_rates:
|
if missing_fields == non_sor_fields and not self.is_schedule_of_rates:
|
||||||
self.is_schedule_of_rates = True
|
self.is_schedule_of_rates = True
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class CostItem(TypedDict):
|
|||||||
Hierarchy: str
|
Hierarchy: str
|
||||||
Id: int
|
Id: int
|
||||||
Identification: Union[str, None]
|
Identification: Union[str, None]
|
||||||
Description: Union[str, None]
|
Name: Union[str, None]
|
||||||
Unit: str
|
Unit: str
|
||||||
Quantity: int
|
Quantity: int
|
||||||
ChildrenData: list["CostItem"]
|
ChildrenData: list["CostItem"]
|
||||||
@@ -131,7 +131,7 @@ class IfcDataGetter:
|
|||||||
"Hierarchy": hierarchy,
|
"Hierarchy": hierarchy,
|
||||||
"Id": cost_item.id(),
|
"Id": cost_item.id(),
|
||||||
"Identification": cost_item.Identification,
|
"Identification": cost_item.Identification,
|
||||||
"Description": cost_item.Name,
|
"Name": cost_item.Name,
|
||||||
"Unit": cost_values_data[0]["unit"] if cost_values_data else "",
|
"Unit": cost_values_data[0]["unit"] if cost_values_data else "",
|
||||||
"Quantity": quantity_data["quantity"]["total_quantity"],
|
"Quantity": quantity_data["quantity"]["total_quantity"],
|
||||||
"ChildrenData": [],
|
"ChildrenData": [],
|
||||||
@@ -290,7 +290,7 @@ class Ifc5Dwriter:
|
|||||||
"Hierarchy",
|
"Hierarchy",
|
||||||
"Index",
|
"Index",
|
||||||
"Identification",
|
"Identification",
|
||||||
"Description",
|
"Name",
|
||||||
"Quantity",
|
"Quantity",
|
||||||
"Unit",
|
"Unit",
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user