From c58c8269af906745906887138d9e10f578609d9b Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 26 Feb 2025 09:34:02 +0100 Subject: [PATCH] Fix codegen --- .../ifcopenshell/express/schema_class.py | 8 ++++---- src/ifcparse/Header_section_schema-schema.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/express/schema_class.py b/src/ifcopenshell-python/ifcopenshell/express/schema_class.py index 6a6f97ea1c..89db02b4a9 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/schema_class.py +++ b/src/ifcopenshell-python/ifcopenshell/express/schema_class.py @@ -384,10 +384,10 @@ class SchemaClass(codegen.Base): else: match = re.search(r'\((\w+?_[\w+]+?_\w+?)\)', declared_type) if match: - 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()) + old_decl = match.group(1) + name = old_decl.lower().replace(schema_name.lower() + '_', '').replace('_type', '') + idx = [n.lower() for n in x.names].index(name) + declared_type = declared_type.replace(old_decl, '%(schema_name)s_types[%(idx)d]' % locals()) return declared_type return wrapper if code == EarlyBoundCodeWriter else fn diff --git a/src/ifcparse/Header_section_schema-schema.cpp b/src/ifcparse/Header_section_schema-schema.cpp index 3ecc83473f..09af82ddd4 100644 --- a/src/ifcparse/Header_section_schema-schema.cpp +++ b/src/ifcparse/Header_section_schema-schema.cpp @@ -32,8 +32,8 @@ IfcParse::schema_definition* header_section_schema_populate_schema() { header_section_schema_types[1] = new entity(strings[3], false, 1, (entity*) 0); header_section_schema_types[2] = new entity(strings[4], false, 2, (entity*) 0); ((entity*)header_section_schema_types[0])->set_attributes({new attribute(strings[5], new aggregation_type(aggregation_type::list_type, 1, -1, new simple_type(simple_type::string_type)), false),new attribute(strings[6], new simple_type(simple_type::string_type), false)}, {false,false}); - ((entity*)header_section_schema_types[1])->set_attributes({new attribute(strings[7], new simple_type(simple_type::string_type), false),new attribute(strings[8], new named_type(header_section_schema_HEADER_SECTION_SCHEMA_types[4]_type), false),new attribute(strings[9], new aggregation_type(aggregation_type::list_type, 1, -1, new simple_type(simple_type::string_type)), false),new attribute(strings[10], new aggregation_type(aggregation_type::list_type, 1, -1, new simple_type(simple_type::string_type)), false),new attribute(strings[11], new simple_type(simple_type::string_type), false),new attribute(strings[12], new simple_type(simple_type::string_type), false),new attribute(strings[13], new simple_type(simple_type::string_type), false)}, {false,false,false,false,false,false,false}); - ((entity*)header_section_schema_types[2])->set_attributes({new attribute(strings[14], new aggregation_type(aggregation_type::list_type, 1, -1, new named_type(header_section_schema_HEADER_SECTION_SCHEMA_types[3]_type)), false)}, {false}); + ((entity*)header_section_schema_types[1])->set_attributes({new attribute(strings[7], new simple_type(simple_type::string_type), false),new attribute(strings[8], new named_type(header_section_schema_types[4]), false),new attribute(strings[9], new aggregation_type(aggregation_type::list_type, 1, -1, new simple_type(simple_type::string_type)), false),new attribute(strings[10], new aggregation_type(aggregation_type::list_type, 1, -1, new simple_type(simple_type::string_type)), false),new attribute(strings[11], new simple_type(simple_type::string_type), false),new attribute(strings[12], new simple_type(simple_type::string_type), false),new attribute(strings[13], new simple_type(simple_type::string_type), false)}, {false,false,false,false,false,false,false}); + ((entity*)header_section_schema_types[2])->set_attributes({new attribute(strings[14], new aggregation_type(aggregation_type::list_type, 1, -1, new named_type(header_section_schema_types[3])), false)}, {false}); return new schema_definition(strings[15], {header_section_schema_types[0],header_section_schema_types[1],header_section_schema_types[2],header_section_schema_types[3],header_section_schema_types[4]}, new header_section_schema_instance_factory()); } static std::unique_ptr schema;