diff --git a/src/ifcopenshell-python/ifcopenshell/express/header_schema.exp b/src/ifcopenshell-python/ifcopenshell/express/header_schema.exp new file mode 100644 index 0000000000..0dba8dba60 --- /dev/null +++ b/src/ifcopenshell-python/ifcopenshell/express/header_schema.exp @@ -0,0 +1,28 @@ +SCHEMA header_section_schema; + +TYPE time_stamp_text = STRING(256); +END_TYPE; + +TYPE schema_name = STRING(1024); +END_TYPE; + +ENTITY file_name; + name : STRING (256); + time_stamp : time_stamp_text; + author : LIST [1:?] OF STRING (256); + organization : LIST [1:?] OF STRING (256); + preprocessor_version : STRING (256); + originating_system : STRING (256); + authorisation : STRING (256); +END_ENTITY; + +ENTITY file_description; + description : LIST [1:?] OF STRING (256); + implementation_level : STRING (256); +END_ENTITY; + +ENTITY file_schema; + schema_identifiers : LIST [1:?] OF UNIQUE schema_name; +END_ENTITY; + +END_SCHEMA; diff --git a/src/ifcopenshell-python/ifcopenshell/express/schema_class.py b/src/ifcopenshell-python/ifcopenshell/express/schema_class.py index cd1fc93dfa..6a6f97ea1c 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/schema_class.py +++ b/src/ifcopenshell-python/ifcopenshell/express/schema_class.py @@ -384,9 +384,8 @@ class SchemaClass(codegen.Base): else: match = re.search(r'\((\w+?_[\w+]+?_\w+?)\)', declared_type) if match: - old_decl = match.group(1) - tn = old_decl.rsplit('_', 2)[1] - idx = x.names.index(tn) + old_decl = match.group(1).lower().replace(schema_name.lower() + '_', '').replace('_type', '') + idx = [n.lower() for n in x.names].index(old_decl) snu = schema_name.upper() declared_type = declared_type.replace(old_decl, '%(snu)s_types[%(idx)d]' % locals()) return declared_type