From 0445110778c921a9680f21199956deac6b2fe928 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Fri, 23 Aug 2024 16:05:59 +0200 Subject: [PATCH] For the love of god, add support for selected enumerations --- .../fixtures/validate/pass-complex-number-ifc4.ifc | 10 ++++++++++ src/ifcparse/IfcFile.cpp | 4 ++++ 2 files changed, 14 insertions(+) create mode 100644 src/ifcopenshell-python/test/fixtures/validate/pass-complex-number-ifc4.ifc diff --git a/src/ifcopenshell-python/test/fixtures/validate/pass-complex-number-ifc4.ifc b/src/ifcopenshell-python/test/fixtures/validate/pass-complex-number-ifc4.ifc new file mode 100644 index 0000000000..a6cf5660d0 --- /dev/null +++ b/src/ifcopenshell-python/test/fixtures/validate/pass-complex-number-ifc4.ifc @@ -0,0 +1,10 @@ +ISO-10303-21; +HEADER; +FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); +FILE_NAME('','2023-04-13T10:27:43',(),(),'IfcOpenShell v0.7.0-198fa67cc','IfcOpenShell v0.7.0-198fa67cc',''); +FILE_SCHEMA(('IFC4')); +ENDSEC; +DATA; +#1=IFCPROPERTYSINGLEVALUE('Test',$,IFCCOMPLEXNUMBER((0.,0.)),$); +ENDSEC; +END-ISO-10303-21; diff --git a/src/ifcparse/IfcFile.cpp b/src/ifcparse/IfcFile.cpp index 699644b7c9..1cf65b33a3 100644 --- a/src/ifcparse/IfcFile.cpp +++ b/src/ifcparse/IfcFile.cpp @@ -182,9 +182,13 @@ namespace { IfcEntityInstanceData IfcParse::parse_context::construct(int name, unresolved_references& references_to_resolve, const IfcParse::declaration* decl, boost::optional expected_size) { std::vector parameter_types; + std::unique_ptr transient_named_type; if ((decl != nullptr) && (decl->as_type_declaration() != nullptr)) { parameter_types = { decl->as_type_declaration()->declared_type() }; + } else if ((decl != nullptr) && (decl->as_enumeration_type() != nullptr)) { + transient_named_type.reset(new IfcParse::named_type(const_cast(decl))); + parameter_types = { &*transient_named_type }; } else if ((decl != nullptr) && (decl->as_entity() != nullptr)) { auto entity_attrs = decl->as_entity()->all_attributes(); std::transform(