Couple of minor fixes to make importing more robust

This commit is contained in:
Dion Moult
2019-10-17 18:47:01 +11:00
parent 240b642d6d
commit 791be5006b
@@ -110,7 +110,11 @@ class IfcImporter():
if element.is_a('IfcOpeningElement'):
return
shape = ifcopenshell.geom.create_shape(self.settings, element)
try:
shape = ifcopenshell.geom.create_shape(self.settings, element)
except:
print('Failed to generate shape for {}'.format(element))
return
mesh_name = 'mesh-{}'.format(shape.geometry.id)
mesh = self.meshes.get(mesh_name)
@@ -135,7 +139,8 @@ class IfcImporter():
matrix.transpose()
object.matrix_world = matrix
if element.ContainedInStructure \
if hasattr(element, 'ContainedInStructure') \
and element.ContainedInStructure \
and element.ContainedInStructure[0].RelatingStructure:
structure_name = self.get_name(element.ContainedInStructure[0].RelatingStructure)
if structure_name in self.spatial_structure_elements: