From 7adf4934aa2aac25d5f052f4034ca46bd3bf7016 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Wed, 15 Apr 2020 10:08:09 +1000 Subject: [PATCH] Add support for importing IFC groups --- .../blenderbim/bim/import_ifc.py | 14 + src/ifcblenderexport/blenderbim/bim/prop.py | 2 +- src/ifcblenderexport/blenderbim/bim/schema.py | 1 + .../blenderbim/bim/schema/IfcGroup_IFC4.json | 1034 +++++++++++++++++ src/ifcblenderexport/getIfcElements.py | 7 +- 5 files changed, 1055 insertions(+), 3 deletions(-) create mode 100644 src/ifcblenderexport/blenderbim/bim/schema/IfcGroup_IFC4.json diff --git a/src/ifcblenderexport/blenderbim/bim/import_ifc.py b/src/ifcblenderexport/blenderbim/bim/import_ifc.py index ad9f3c0cac..a989669884 100644 --- a/src/ifcblenderexport/blenderbim/bim/import_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/import_ifc.py @@ -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: diff --git a/src/ifcblenderexport/blenderbim/bim/prop.py b/src/ifcblenderexport/blenderbim/bim/prop.py index 1ec5301a3b..68aca6d678 100644 --- a/src/ifcblenderexport/blenderbim/bim/prop.py +++ b/src/ifcblenderexport/blenderbim/bim/prop.py @@ -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 diff --git a/src/ifcblenderexport/blenderbim/bim/schema.py b/src/ifcblenderexport/blenderbim/bim/schema.py index 7251b5f1c2..290aa1dfb5 100644 --- a/src/ifcblenderexport/blenderbim/bim/schema.py +++ b/src/ifcblenderexport/blenderbim/bim/schema.py @@ -13,6 +13,7 @@ class IfcSchema(): 'IfcContext', 'IfcElement', 'IfcSpatialElement', + 'IfcGroup', 'IfcStructural', 'IfcMaterialDefinition', 'IfcParameterizedProfileDef', diff --git a/src/ifcblenderexport/blenderbim/bim/schema/IfcGroup_IFC4.json b/src/ifcblenderexport/blenderbim/bim/schema/IfcGroup_IFC4.json new file mode 100644 index 0000000000..968b4fae6d --- /dev/null +++ b/src/ifcblenderexport/blenderbim/bim/schema/IfcGroup_IFC4.json @@ -0,0 +1,1034 @@ +{ + "IfcAsset": { + "is_abstract": false, + "parent": "IfcGroup", + "attributes": [ + { + "name": "GlobalId", + "type": "IfcGloballyUniqueId", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Description", + "type": "IfcText", + "is_enum": false, + "enum_values": [] + }, + { + "name": "ObjectType", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Identification", + "type": "IfcIdentifier", + "is_enum": false, + "enum_values": [] + }, + { + "name": "IncorporationDate", + "type": "IfcDate", + "is_enum": false, + "enum_values": [] + } + ], + "complex_attributes": [ + { + "name": "OwnerHistory", + "type": "IfcOwnerHistory", + "is_select": false, + "select_types": [] + }, + { + "name": "IsDeclaredBy", + "type": "IfcRelDefinesByObject", + "is_select": false, + "select_types": [] + }, + { + "name": "IsTypedBy", + "type": "IfcRelDefinesByType", + "is_select": false, + "select_types": [] + }, + { + "name": "OriginalValue", + "type": "IfcCostValue", + "is_select": false, + "select_types": [] + }, + { + "name": "CurrentValue", + "type": "IfcCostValue", + "is_select": false, + "select_types": [] + }, + { + "name": "TotalReplacementCost", + "type": "IfcCostValue", + "is_select": false, + "select_types": [] + }, + { + "name": "Owner", + "type": "IfcActorSelect", + "is_select": true, + "select_types": [ + "IfcOrganization", + "IfcPerson", + "IfcPersonAndOrganization" + ] + }, + { + "name": "User", + "type": "IfcActorSelect", + "is_select": true, + "select_types": [ + "IfcOrganization", + "IfcPerson", + "IfcPersonAndOrganization" + ] + }, + { + "name": "ResponsiblePerson", + "type": "IfcPerson", + "is_select": false, + "select_types": [] + }, + { + "name": "DepreciatedValue", + "type": "IfcCostValue", + "is_select": false, + "select_types": [] + } + ] + }, + "IfcBuildingSystem": { + "is_abstract": false, + "parent": "IfcSystem", + "attributes": [ + { + "name": "GlobalId", + "type": "IfcGloballyUniqueId", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Description", + "type": "IfcText", + "is_enum": false, + "enum_values": [] + }, + { + "name": "ObjectType", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "PredefinedType", + "type": "IfcBuildingSystemTypeEnum", + "is_enum": true, + "enum_values": [ + "FENESTRATION", + "FOUNDATION", + "LOADBEARING", + "OUTERSHELL", + "SHADING", + "TRANSPORT", + "USERDEFINED", + "NOTDEFINED" + ] + }, + { + "name": "LongName", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + } + ], + "complex_attributes": [ + { + "name": "OwnerHistory", + "type": "IfcOwnerHistory", + "is_select": false, + "select_types": [] + }, + { + "name": "IsDeclaredBy", + "type": "IfcRelDefinesByObject", + "is_select": false, + "select_types": [] + }, + { + "name": "IsTypedBy", + "type": "IfcRelDefinesByType", + "is_select": false, + "select_types": [] + } + ] + }, + "IfcDistributionCircuit": { + "is_abstract": false, + "parent": "IfcDistributionSystem", + "attributes": [ + { + "name": "GlobalId", + "type": "IfcGloballyUniqueId", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Description", + "type": "IfcText", + "is_enum": false, + "enum_values": [] + }, + { + "name": "ObjectType", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "LongName", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "PredefinedType", + "type": "IfcDistributionSystemEnum", + "is_enum": true, + "enum_values": [ + "AIRCONDITIONING", + "AUDIOVISUAL", + "CHEMICAL", + "CHILLEDWATER", + "COMMUNICATION", + "COMPRESSEDAIR", + "CONDENSERWATER", + "CONTROL", + "CONVEYING", + "DATA", + "DISPOSAL", + "DOMESTICCOLDWATER", + "DOMESTICHOTWATER", + "DRAINAGE", + "EARTHING", + "ELECTRICAL", + "ELECTROACOUSTIC", + "EXHAUST", + "FIREPROTECTION", + "FUEL", + "GAS", + "HAZARDOUS", + "HEATING", + "LIGHTING", + "LIGHTNINGPROTECTION", + "MUNICIPALSOLIDWASTE", + "OIL", + "OPERATIONAL", + "POWERGENERATION", + "RAINWATER", + "REFRIGERATION", + "SECURITY", + "SEWAGE", + "SIGNAL", + "STORMWATER", + "TELEPHONE", + "TV", + "VACUUM", + "VENT", + "VENTILATION", + "WASTEWATER", + "WATERSUPPLY", + "USERDEFINED", + "NOTDEFINED" + ] + } + ], + "complex_attributes": [ + { + "name": "OwnerHistory", + "type": "IfcOwnerHistory", + "is_select": false, + "select_types": [] + }, + { + "name": "IsDeclaredBy", + "type": "IfcRelDefinesByObject", + "is_select": false, + "select_types": [] + }, + { + "name": "IsTypedBy", + "type": "IfcRelDefinesByType", + "is_select": false, + "select_types": [] + } + ] + }, + "IfcDistributionSystem": { + "is_abstract": false, + "parent": "IfcSystem", + "attributes": [ + { + "name": "GlobalId", + "type": "IfcGloballyUniqueId", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Description", + "type": "IfcText", + "is_enum": false, + "enum_values": [] + }, + { + "name": "ObjectType", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "LongName", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "PredefinedType", + "type": "IfcDistributionSystemEnum", + "is_enum": true, + "enum_values": [ + "AIRCONDITIONING", + "AUDIOVISUAL", + "CHEMICAL", + "CHILLEDWATER", + "COMMUNICATION", + "COMPRESSEDAIR", + "CONDENSERWATER", + "CONTROL", + "CONVEYING", + "DATA", + "DISPOSAL", + "DOMESTICCOLDWATER", + "DOMESTICHOTWATER", + "DRAINAGE", + "EARTHING", + "ELECTRICAL", + "ELECTROACOUSTIC", + "EXHAUST", + "FIREPROTECTION", + "FUEL", + "GAS", + "HAZARDOUS", + "HEATING", + "LIGHTING", + "LIGHTNINGPROTECTION", + "MUNICIPALSOLIDWASTE", + "OIL", + "OPERATIONAL", + "POWERGENERATION", + "RAINWATER", + "REFRIGERATION", + "SECURITY", + "SEWAGE", + "SIGNAL", + "STORMWATER", + "TELEPHONE", + "TV", + "VACUUM", + "VENT", + "VENTILATION", + "WASTEWATER", + "WATERSUPPLY", + "USERDEFINED", + "NOTDEFINED" + ] + } + ], + "complex_attributes": [ + { + "name": "OwnerHistory", + "type": "IfcOwnerHistory", + "is_select": false, + "select_types": [] + }, + { + "name": "IsDeclaredBy", + "type": "IfcRelDefinesByObject", + "is_select": false, + "select_types": [] + }, + { + "name": "IsTypedBy", + "type": "IfcRelDefinesByType", + "is_select": false, + "select_types": [] + } + ] + }, + "IfcGroup": { + "is_abstract": false, + "parent": "IfcObject", + "attributes": [ + { + "name": "GlobalId", + "type": "IfcGloballyUniqueId", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Description", + "type": "IfcText", + "is_enum": false, + "enum_values": [] + }, + { + "name": "ObjectType", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + } + ], + "complex_attributes": [ + { + "name": "OwnerHistory", + "type": "IfcOwnerHistory", + "is_select": false, + "select_types": [] + }, + { + "name": "IsDeclaredBy", + "type": "IfcRelDefinesByObject", + "is_select": false, + "select_types": [] + }, + { + "name": "IsTypedBy", + "type": "IfcRelDefinesByType", + "is_select": false, + "select_types": [] + } + ] + }, + "IfcInventory": { + "is_abstract": false, + "parent": "IfcGroup", + "attributes": [ + { + "name": "GlobalId", + "type": "IfcGloballyUniqueId", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Description", + "type": "IfcText", + "is_enum": false, + "enum_values": [] + }, + { + "name": "ObjectType", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "PredefinedType", + "type": "IfcInventoryTypeEnum", + "is_enum": true, + "enum_values": [ + "ASSETINVENTORY", + "SPACEINVENTORY", + "FURNITUREINVENTORY", + "USERDEFINED", + "NOTDEFINED" + ] + }, + { + "name": "LastUpdateDate", + "type": "IfcDate", + "is_enum": false, + "enum_values": [] + } + ], + "complex_attributes": [ + { + "name": "OwnerHistory", + "type": "IfcOwnerHistory", + "is_select": false, + "select_types": [] + }, + { + "name": "IsDeclaredBy", + "type": "IfcRelDefinesByObject", + "is_select": false, + "select_types": [] + }, + { + "name": "IsTypedBy", + "type": "IfcRelDefinesByType", + "is_select": false, + "select_types": [] + }, + { + "name": "Jurisdiction", + "type": "IfcActorSelect", + "is_select": true, + "select_types": [ + "IfcOrganization", + "IfcPerson", + "IfcPersonAndOrganization" + ] + }, + { + "name": "CurrentValue", + "type": "IfcCostValue", + "is_select": false, + "select_types": [] + }, + { + "name": "OriginalValue", + "type": "IfcCostValue", + "is_select": false, + "select_types": [] + } + ] + }, + "IfcStructuralAnalysisModel": { + "is_abstract": false, + "parent": "IfcSystem", + "attributes": [ + { + "name": "GlobalId", + "type": "IfcGloballyUniqueId", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Description", + "type": "IfcText", + "is_enum": false, + "enum_values": [] + }, + { + "name": "ObjectType", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "PredefinedType", + "type": "IfcAnalysisModelTypeEnum", + "is_enum": true, + "enum_values": [ + "IN_PLANE_LOADING_2D", + "OUT_PLANE_LOADING_2D", + "LOADING_3D", + "USERDEFINED", + "NOTDEFINED" + ] + } + ], + "complex_attributes": [ + { + "name": "OwnerHistory", + "type": "IfcOwnerHistory", + "is_select": false, + "select_types": [] + }, + { + "name": "IsDeclaredBy", + "type": "IfcRelDefinesByObject", + "is_select": false, + "select_types": [] + }, + { + "name": "IsTypedBy", + "type": "IfcRelDefinesByType", + "is_select": false, + "select_types": [] + }, + { + "name": "OrientationOf2DPlane", + "type": "IfcAxis2Placement3D", + "is_select": false, + "select_types": [] + }, + { + "name": "SharedPlacement", + "type": "IfcObjectPlacement", + "is_select": false, + "select_types": [] + } + ] + }, + "IfcStructuralLoadCase": { + "is_abstract": false, + "parent": "IfcStructuralLoadGroup", + "attributes": [ + { + "name": "GlobalId", + "type": "IfcGloballyUniqueId", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Description", + "type": "IfcText", + "is_enum": false, + "enum_values": [] + }, + { + "name": "ObjectType", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "PredefinedType", + "type": "IfcLoadGroupTypeEnum", + "is_enum": true, + "enum_values": [ + "LOAD_GROUP", + "LOAD_CASE", + "LOAD_COMBINATION", + "USERDEFINED", + "NOTDEFINED" + ] + }, + { + "name": "ActionType", + "type": "IfcActionTypeEnum", + "is_enum": true, + "enum_values": [ + "PERMANENT_G", + "VARIABLE_Q", + "EXTRAORDINARY_A", + "USERDEFINED", + "NOTDEFINED" + ] + }, + { + "name": "ActionSource", + "type": "IfcActionSourceTypeEnum", + "is_enum": true, + "enum_values": [ + "DEAD_LOAD_G", + "COMPLETION_G1", + "LIVE_LOAD_Q", + "SNOW_S", + "WIND_W", + "PRESTRESSING_P", + "SETTLEMENT_U", + "TEMPERATURE_T", + "EARTHQUAKE_E", + "FIRE", + "IMPULSE", + "IMPACT", + "TRANSPORT", + "ERECTION", + "PROPPING", + "SYSTEM_IMPERFECTION", + "SHRINKAGE", + "CREEP", + "LACK_OF_FIT", + "BUOYANCY", + "ICE", + "CURRENT", + "WAVE", + "RAIN", + "BRAKES", + "USERDEFINED", + "NOTDEFINED" + ] + }, + { + "name": "Coefficient", + "type": "IfcRatioMeasure", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Purpose", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + } + ], + "complex_attributes": [ + { + "name": "OwnerHistory", + "type": "IfcOwnerHistory", + "is_select": false, + "select_types": [] + }, + { + "name": "IsDeclaredBy", + "type": "IfcRelDefinesByObject", + "is_select": false, + "select_types": [] + }, + { + "name": "IsTypedBy", + "type": "IfcRelDefinesByType", + "is_select": false, + "select_types": [] + } + ] + }, + "IfcStructuralLoadGroup": { + "is_abstract": false, + "parent": "IfcGroup", + "attributes": [ + { + "name": "GlobalId", + "type": "IfcGloballyUniqueId", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Description", + "type": "IfcText", + "is_enum": false, + "enum_values": [] + }, + { + "name": "ObjectType", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "PredefinedType", + "type": "IfcLoadGroupTypeEnum", + "is_enum": true, + "enum_values": [ + "LOAD_GROUP", + "LOAD_CASE", + "LOAD_COMBINATION", + "USERDEFINED", + "NOTDEFINED" + ] + }, + { + "name": "ActionType", + "type": "IfcActionTypeEnum", + "is_enum": true, + "enum_values": [ + "PERMANENT_G", + "VARIABLE_Q", + "EXTRAORDINARY_A", + "USERDEFINED", + "NOTDEFINED" + ] + }, + { + "name": "ActionSource", + "type": "IfcActionSourceTypeEnum", + "is_enum": true, + "enum_values": [ + "DEAD_LOAD_G", + "COMPLETION_G1", + "LIVE_LOAD_Q", + "SNOW_S", + "WIND_W", + "PRESTRESSING_P", + "SETTLEMENT_U", + "TEMPERATURE_T", + "EARTHQUAKE_E", + "FIRE", + "IMPULSE", + "IMPACT", + "TRANSPORT", + "ERECTION", + "PROPPING", + "SYSTEM_IMPERFECTION", + "SHRINKAGE", + "CREEP", + "LACK_OF_FIT", + "BUOYANCY", + "ICE", + "CURRENT", + "WAVE", + "RAIN", + "BRAKES", + "USERDEFINED", + "NOTDEFINED" + ] + }, + { + "name": "Coefficient", + "type": "IfcRatioMeasure", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Purpose", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + } + ], + "complex_attributes": [ + { + "name": "OwnerHistory", + "type": "IfcOwnerHistory", + "is_select": false, + "select_types": [] + }, + { + "name": "IsDeclaredBy", + "type": "IfcRelDefinesByObject", + "is_select": false, + "select_types": [] + }, + { + "name": "IsTypedBy", + "type": "IfcRelDefinesByType", + "is_select": false, + "select_types": [] + } + ] + }, + "IfcStructuralResultGroup": { + "is_abstract": false, + "parent": "IfcGroup", + "attributes": [ + { + "name": "GlobalId", + "type": "IfcGloballyUniqueId", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Description", + "type": "IfcText", + "is_enum": false, + "enum_values": [] + }, + { + "name": "ObjectType", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "TheoryType", + "type": "IfcAnalysisTheoryTypeEnum", + "is_enum": true, + "enum_values": [ + "FIRST_ORDER_THEORY", + "SECOND_ORDER_THEORY", + "THIRD_ORDER_THEORY", + "FULL_NONLINEAR_THEORY", + "USERDEFINED", + "NOTDEFINED" + ] + }, + { + "name": "IsLinear", + "type": "IfcBoolean", + "is_enum": false, + "enum_values": [] + } + ], + "complex_attributes": [ + { + "name": "OwnerHistory", + "type": "IfcOwnerHistory", + "is_select": false, + "select_types": [] + }, + { + "name": "IsDeclaredBy", + "type": "IfcRelDefinesByObject", + "is_select": false, + "select_types": [] + }, + { + "name": "IsTypedBy", + "type": "IfcRelDefinesByType", + "is_select": false, + "select_types": [] + }, + { + "name": "ResultForLoadGroup", + "type": "IfcStructuralLoadGroup", + "is_select": false, + "select_types": [] + } + ] + }, + "IfcSystem": { + "is_abstract": false, + "parent": "IfcGroup", + "attributes": [ + { + "name": "GlobalId", + "type": "IfcGloballyUniqueId", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Description", + "type": "IfcText", + "is_enum": false, + "enum_values": [] + }, + { + "name": "ObjectType", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + } + ], + "complex_attributes": [ + { + "name": "OwnerHistory", + "type": "IfcOwnerHistory", + "is_select": false, + "select_types": [] + }, + { + "name": "IsDeclaredBy", + "type": "IfcRelDefinesByObject", + "is_select": false, + "select_types": [] + }, + { + "name": "IsTypedBy", + "type": "IfcRelDefinesByType", + "is_select": false, + "select_types": [] + } + ] + }, + "IfcZone": { + "is_abstract": false, + "parent": "IfcSystem", + "attributes": [ + { + "name": "GlobalId", + "type": "IfcGloballyUniqueId", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Description", + "type": "IfcText", + "is_enum": false, + "enum_values": [] + }, + { + "name": "ObjectType", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "LongName", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + } + ], + "complex_attributes": [ + { + "name": "OwnerHistory", + "type": "IfcOwnerHistory", + "is_select": false, + "select_types": [] + }, + { + "name": "IsDeclaredBy", + "type": "IfcRelDefinesByObject", + "is_select": false, + "select_types": [] + }, + { + "name": "IsTypedBy", + "type": "IfcRelDefinesByType", + "is_select": false, + "select_types": [] + } + ] + } +} \ No newline at end of file diff --git a/src/ifcblenderexport/getIfcElements.py b/src/ifcblenderexport/getIfcElements.py index 487ed288ce..8faad58296 100644 --- a/src/ifcblenderexport/getIfcElements.py +++ b/src/ifcblenderexport/getIfcElements.py @@ -41,9 +41,11 @@ class IFC4Extractor: def is_descendant_from_class(self, element, class_name): if element is None \ - or "substitutionGroup" not in element.attrib: + or 'substitutionGroup' not in element.attrib \ + or 'type' not in element.attrib: return False - if element.attrib["substitutionGroup"] == 'ifc:{}'.format(class_name): + if element.attrib['substitutionGroup'] == 'ifc:{}'.format(class_name) \ + or element.attrib['type'] == 'ifc:{}'.format(class_name): return True return self.is_descendant_from_class(self.get_parent_element(element), class_name) @@ -149,6 +151,7 @@ filename_filters = { 'IfcContext_IFC4.json': ['IfcContext'], 'IfcElement_IFC4.json': ['IfcElement'], 'IfcSpatialElement_IFC4.json': ['IfcSpatialElement'], + 'IfcGroup_IFC4.json': ['IfcGroup'], 'IfcStructural_IFC4.json': ['IfcStructuralActivity', 'IfcStructuralItem'], 'IfcMaterialDefinition_IFC4.json': ['IfcMaterialDefinition'], 'IfcParameterizedProfileDef_IFC4.json': ['IfcParameterizedProfileDef'],