mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
Add support for importing IFC groups
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
Reference in New Issue
Block a user