From 99bde93af5ee4fd23589f846a6c00d3c362d0676 Mon Sep 17 00:00:00 2001 From: aahoo Date: Sun, 1 Jan 2017 16:19:39 +0100 Subject: [PATCH] adds get_info method for class #resolves #175 --- .../ifcopenshell/entity_instance.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ifcopenshell-python/ifcopenshell/entity_instance.py b/src/ifcopenshell-python/ifcopenshell/entity_instance.py index 8bdc0e2e27..1d9cca2411 100644 --- a/src/ifcopenshell-python/ifcopenshell/entity_instance.py +++ b/src/ifcopenshell-python/ifcopenshell/entity_instance.py @@ -85,3 +85,17 @@ class entity_instance(object): self.wrapped_data.get_attribute_names(), self.wrapped_data.get_inverse_attribute_names() ))) + def get_info(self): + _info = {} + try: + _info["id"] = self.id() + _info["type"] = self.is_a() + except: + pass + for i in range(len(self)): + try: + _info[self.attribute_name(i)] = self[i] + except: + pass + return _info + __dict__ = property(get_info) \ No newline at end of file