Add support for importing IFC groups

This commit is contained in:
Dion Moult
2020-04-15 10:08:09 +10:00
parent 66afa9872d
commit 7adf4934aa
5 changed files with 1055 additions and 3 deletions
@@ -198,6 +198,7 @@ class IfcImporter():
self.unit_scale = 1
self.added_data = {}
self.native_data = {}
self.groups = {}
self.material_creator = MaterialCreator(ifc_import_settings)
@@ -218,6 +219,7 @@ class IfcImporter():
self.parse_native_products()
self.filter_ifc()
self.patch_ifc()
self.create_groups()
self.create_type_products()
self.create_grids()
# TODO: Deprecate after bug #682 is fixed and the new importer is stable
@@ -365,6 +367,18 @@ class IfcImporter():
if element.ObjectPlacement.RelativePlacement.RefDirection:
element.ObjectPlacement.RelativePlacement.RefDirection.DirectionRatios = (1., 0., 0.)
def create_groups(self):
collection = bpy.data.collections.new('Groups')
self.project['blender'].children.link(collection)
for element in self.file.by_type('IfcGroup'):
obj = bpy.data.objects.new(f'IfcGroup/{element.Name}', None)
self.add_element_attributes(element, obj)
collection.objects.link(obj)
self.groups[element.GlobalId] = {
'ifc': element,
'blender': obj
}
def create_grids(self):
grids = self.file.by_type('IfcGrid')
for grid in grids:
+1 -1
View File
@@ -122,7 +122,7 @@ def getIfcProducts(self, context):
global products_enum
if len(products_enum) < 1:
products_enum.extend([(e, e, '') for e in
['IfcElement', 'IfcElementType', 'IfcSpatialElement', 'IfcStructural', 'IfcContext']])
['IfcElement', 'IfcElementType', 'IfcSpatialElement', 'IfcGroup', 'IfcStructural', 'IfcContext']])
return products_enum
@@ -13,6 +13,7 @@ class IfcSchema():
'IfcContext',
'IfcElement',
'IfcSpatialElement',
'IfcGroup',
'IfcStructural',
'IfcMaterialDefinition',
'IfcParameterizedProfileDef',
File diff suppressed because it is too large Load Diff