mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
csv2ifc - add header validation
This commit is contained in:
@@ -86,12 +86,23 @@ class Csv2Ifc:
|
||||
if not row[0]:
|
||||
continue
|
||||
if row[0] == "HIERARCHY":
|
||||
missing_columns = set(self.SUPPORTED_COLUMNS) - set(row)
|
||||
if missing_columns:
|
||||
raise Exception(
|
||||
f"Header is missing some of the required columns: {', '.join(missing_columns)}."
|
||||
)
|
||||
|
||||
for i, col in enumerate(row):
|
||||
if not col:
|
||||
continue
|
||||
self.headers[col] = i
|
||||
continue
|
||||
|
||||
if not self.headers:
|
||||
raise Exception(
|
||||
f"No header found in CSV file before data row: '{row}'. Note that header should start with 'HIERARCHY' column."
|
||||
)
|
||||
|
||||
resource_data = self.get_row_resource_data(row)
|
||||
hierarchy_key = int(row[0])
|
||||
if hierarchy_key == 1:
|
||||
|
||||
Reference in New Issue
Block a user