mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 22:42:23 +00:00
Fix bug where attributes wouldn't import for some IFC classes
This commit is contained in:
@@ -1782,16 +1782,14 @@ class IfcImporter():
|
|||||||
|
|
||||||
def add_element_attributes(self, element, obj):
|
def add_element_attributes(self, element, obj):
|
||||||
attributes = element.get_info()
|
attributes = element.get_info()
|
||||||
if element.is_a() in schema.ifc.elements:
|
for key, value in attributes.items():
|
||||||
applicable_attributes = [a['name'] for a in schema.ifc.elements[element.is_a()]['attributes']]
|
if value is None or isinstance(value, ifcopenshell.entity_instance) \
|
||||||
for key, value in attributes.items():
|
or key == 'id' or key == 'type':
|
||||||
if key not in applicable_attributes \
|
continue
|
||||||
or value is None:
|
attribute = obj.BIMObjectProperties.attributes.add()
|
||||||
continue
|
attribute.name = key
|
||||||
attribute = obj.BIMObjectProperties.attributes.add()
|
attribute.data_type = 'string'
|
||||||
attribute.name = key
|
attribute.string_value = str(self.cast_edge_case_attribute(element.is_a(), key, value))
|
||||||
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):
|
def cast_edge_case_attribute(self, ifc_class, key, value):
|
||||||
if key == 'RefLatitude' or key == 'RefLongitude':
|
if key == 'RefLatitude' or key == 'RefLongitude':
|
||||||
|
|||||||
Reference in New Issue
Block a user