Add import support for IfcGrid itself, not just the grid axes

This commit is contained in:
Dion Moult
2020-08-14 16:54:47 +10:00
parent 43186e4e59
commit 9062d9720b
@@ -679,8 +679,8 @@ class IfcImporter():
def create_grids(self): def create_grids(self):
grids = self.file.by_type('IfcGrid') grids = self.file.by_type('IfcGrid')
for grid in grids: for grid in grids:
grid_obj = self.create_product(grid, ifcopenshell.geom.create_shape(self.settings_2d, grid))
collection = bpy.data.collections.new(self.get_name(grid)) collection = bpy.data.collections.new(self.get_name(grid))
self.project['blender'].children.link(collection)
element_matrix = self.get_local_placement(grid.ObjectPlacement) element_matrix = self.get_local_placement(grid.ObjectPlacement)
element_matrix[0][3] *= self.unit_scale element_matrix[0][3] *= self.unit_scale
element_matrix[1][3] *= self.unit_scale element_matrix[1][3] *= self.unit_scale
@@ -1645,6 +1645,11 @@ class IfcImporter():
if self.ifc_import_settings.should_import_spaces and container.GlobalId in self.added_data: if self.ifc_import_settings.should_import_spaces and container.GlobalId in self.added_data:
obj.BIMObjectProperties.relating_structure = self.added_data[container.GlobalId] obj.BIMObjectProperties.relating_structure = self.added_data[container.GlobalId]
return self.place_object_in_spatial_tree(container, obj) return self.place_object_in_spatial_tree(container, obj)
elif element.is_a('IfcGrid'):
grid_collection = bpy.data.collections.get(self.get_name(element))
self.spatial_structure_elements[container.GlobalId]['blender'].children.link(grid_collection)
grid_collection.objects.link(obj)
else:
self.spatial_structure_elements[container.GlobalId]['blender'].objects.link(obj) self.spatial_structure_elements[container.GlobalId]['blender'].objects.link(obj)
elif hasattr(element, 'Decomposes') \ elif hasattr(element, 'Decomposes') \
and element.Decomposes: and element.Decomposes: