From cc49b0efdce466ad79e183245e06872faff71a02 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 10 Apr 2023 20:17:26 +0200 Subject: [PATCH] Don't fail on unmapped attribute types (IFC4.4) --- src/ifcopenshell-python/ifcopenshell/entity_instance.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ifcopenshell-python/ifcopenshell/entity_instance.py b/src/ifcopenshell-python/ifcopenshell/entity_instance.py index 82b5dcbff2..cc8d0adbc4 100644 --- a/src/ifcopenshell-python/ifcopenshell/entity_instance.py +++ b/src/ifcopenshell-python/ifcopenshell/entity_instance.py @@ -40,6 +40,10 @@ except ImportError as e: def set_derived_attribute(*args): raise TypeError("Unable to set derived attribute") + +def set_unsupported_attribute(*args): + raise TypeError("This is an unsupported attribute type") + # For every schema and its entities populate a list # of functions for every entity attribute (including @@ -79,6 +83,9 @@ def register_schema_attributes(schema): functions = [ set_derived_attribute if mname == "setArgumentAsDerived" + else + set_unsupported_attribute + if mname == "setArgumentAsUnknown" else getattr(ifcopenshell_wrapper.entity_instance, mname) for mname in fn_names ]