From 262b55630c5f240e2e8e3b6a34e7b217ce681a2c Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 25 Jun 2026 13:35:08 +0200 Subject: [PATCH] Allow to compare simple type instance to underlying type --- src/ifcopenshell-python/ifcopenshell/entity_instance.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/entity_instance.py b/src/ifcopenshell-python/ifcopenshell/entity_instance.py index 1dea67b793..d32df115af 100644 --- a/src/ifcopenshell-python/ifcopenshell/entity_instance.py +++ b/src/ifcopenshell-python/ifcopenshell/entity_instance.py @@ -443,7 +443,10 @@ class entity_instance: def __eq__(self, other: entity_instance) -> bool: if not isinstance(self, type(other)): - return False + if not self.is_entity(): + return self[0] == other + else: + return False elif None in (self.wrapped_data.file, other.wrapped_data.file): # when not added to a file, we can only compare attribute values # and we need this for where rule evaluation