From 76af85264f461b4c5b0d9d3b4b00fb15a78617b0 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Mon, 26 Oct 2020 14:25:39 +1100 Subject: [PATCH] Fix bug where attributes wouldn't import for some IFC classes --- .../blenderbim/bim/import_ifc.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/ifcblenderexport/blenderbim/bim/import_ifc.py b/src/ifcblenderexport/blenderbim/bim/import_ifc.py index e0fed685bd..42e056ac77 100644 --- a/src/ifcblenderexport/blenderbim/bim/import_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/import_ifc.py @@ -1782,16 +1782,14 @@ class IfcImporter(): def add_element_attributes(self, element, obj): attributes = element.get_info() - if element.is_a() in schema.ifc.elements: - applicable_attributes = [a['name'] for a in schema.ifc.elements[element.is_a()]['attributes']] - for key, value in attributes.items(): - if key not in applicable_attributes \ - or value is None: - continue - attribute = obj.BIMObjectProperties.attributes.add() - attribute.name = key - attribute.data_type = 'string' - attribute.string_value = str(self.cast_edge_case_attribute(element.is_a(), key, value)) + for key, value in attributes.items(): + if value is None or isinstance(value, ifcopenshell.entity_instance) \ + or key == 'id' or key == 'type': + continue + attribute = obj.BIMObjectProperties.attributes.add() + attribute.name = key + attribute.data_type = 'string' + attribute.string_value = str(self.cast_edge_case_attribute(element.is_a(), key, value)) def cast_edge_case_attribute(self, ifc_class, key, value): if key == 'RefLatitude' or key == 'RefLongitude':