Support invalid IfcGrid elements coming from Revit. See #1133.

This commit is contained in:
Dion Moult
2020-11-27 09:31:00 +11:00
parent 6ebb69f62e
commit fddea742b8
@@ -787,8 +787,10 @@ class IfcImporter:
collection.children.link(u_axes)
v_axes = bpy.data.collections.new("VAxes")
collection.children.link(v_axes)
self.create_grid_axes(grid.UAxes, u_axes, element_matrix)
self.create_grid_axes(grid.VAxes, v_axes, element_matrix)
if grid.UAxes: # Revit is known to create invalid grids
self.create_grid_axes(grid.UAxes, u_axes, element_matrix)
if grid.VAxes: # Revit is known to create invalid grids
self.create_grid_axes(grid.VAxes, v_axes, element_matrix)
if grid.WAxes:
w_axes = bpy.data.collections.new("WAxes")
collection.children.link(w_axes)
@@ -1903,8 +1905,11 @@ class IfcImporter:
return self.place_object_in_spatial_tree(container, obj)
elif element.is_a("IfcGrid"):
grid_collection = bpy.data.collections.get(obj.name)
self.spatial_structure_elements[container.GlobalId]["blender"].children.link(grid_collection)
grid_collection.objects.link(obj)
if grid_collection:
self.spatial_structure_elements[container.GlobalId]["blender"].children.link(grid_collection)
grid_collection.objects.link(obj)
else: # Revit can create invalid grid objects
self.spatial_structure_elements[container.GlobalId]["blender"].objects.link(obj)
else:
self.spatial_structure_elements[container.GlobalId]["blender"].objects.link(obj)
elif hasattr(element, "Decomposes") and element.Decomposes: