From 9571d4a67bf11bf67290304f949be4e6c988d3dd Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 31 Jan 2020 12:52:44 +1100 Subject: [PATCH] Allow users to toggle import of opening elements. --- src/ifcblenderexport/blenderbim/import_ifc.py | 8 +++++++- src/ifcblenderexport/blenderbim/operator.py | 1 + src/ifcblenderexport/blenderbim/prop.py | 1 + src/ifcblenderexport/blenderbim/ui.py | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ifcblenderexport/blenderbim/import_ifc.py b/src/ifcblenderexport/blenderbim/import_ifc.py index 918c8b0c48..8374d0657b 100644 --- a/src/ifcblenderexport/blenderbim/import_ifc.py +++ b/src/ifcblenderexport/blenderbim/import_ifc.py @@ -147,7 +147,8 @@ class IfcImporter(): self.create_project() self.create_spatial_hierarchy() self.create_aggregates() - self.create_openings_collection() + if self.ifc_import_settings.should_import_opening_elements: + self.create_openings_collection() self.purge_diff() self.patch_ifc() self.create_type_products() @@ -276,6 +277,10 @@ class IfcImporter(): element = self.file.by_id(shape.guid) + if not self.ifc_import_settings.should_import_opening_elements \ + and element.is_a('IfcOpeningElement'): + return + self.ifc_import_settings.logger.info('Creating object {}'.format(element)) # TODO: make names more meaningful @@ -595,6 +600,7 @@ class IfcImportSettings: self.should_ignore_building_coordinates = False self.should_reset_absolute_coordinates = False self.should_import_curves = False + self.should_import_opening_elements = False self.should_treat_styled_item_as_material = False self.should_use_cpu_multiprocessing = False self.should_use_legacy = False diff --git a/src/ifcblenderexport/blenderbim/operator.py b/src/ifcblenderexport/blenderbim/operator.py index 6b2aafe1d1..2899e36ca6 100644 --- a/src/ifcblenderexport/blenderbim/operator.py +++ b/src/ifcblenderexport/blenderbim/operator.py @@ -81,6 +81,7 @@ class ImportIFC(bpy.types.Operator, ImportHelper): ifc_import_settings.should_ignore_site_coordinates = bpy.context.scene.BIMProperties.import_should_ignore_site_coordinates ifc_import_settings.should_ignore_building_coordinates = bpy.context.scene.BIMProperties.import_should_ignore_building_coordinates ifc_import_settings.should_import_curves = bpy.context.scene.BIMProperties.import_should_import_curves + ifc_import_settings.should_import_opening_elements = bpy.context.scene.BIMProperties.import_should_import_opening_elements ifc_import_settings.should_auto_set_workarounds = bpy.context.scene.BIMProperties.import_should_auto_set_workarounds ifc_import_settings.should_treat_styled_item_as_material = bpy.context.scene.BIMProperties.import_should_treat_styled_item_as_material ifc_import_settings.should_use_cpu_multiprocessing = bpy.context.scene.BIMProperties.import_should_use_cpu_multiprocessing diff --git a/src/ifcblenderexport/blenderbim/prop.py b/src/ifcblenderexport/blenderbim/prop.py index 5e767dc7d2..0748356a88 100644 --- a/src/ifcblenderexport/blenderbim/prop.py +++ b/src/ifcblenderexport/blenderbim/prop.py @@ -376,6 +376,7 @@ class BIMProperties(PropertyGroup): import_should_ignore_building_coordinates: BoolProperty(name="Import Ignoring Building Coordinates", default=False) import_should_reset_absolute_coordinates: BoolProperty(name="Import Resetting Absolute Coordinates", default=False) import_should_import_curves: BoolProperty(name="Import Curves", default=False) + import_should_import_opening_elements: BoolProperty(name="Import Opening Elements", default=False) import_should_auto_set_workarounds: BoolProperty(name="Automatically Set Vendor Workarounds", default=True) import_should_treat_styled_item_as_material: BoolProperty(name="Import Treating Styled Item as Material", default=False) import_should_use_legacy: BoolProperty(name="Import with Legacy Importer", default=False) diff --git a/src/ifcblenderexport/blenderbim/ui.py b/src/ifcblenderexport/blenderbim/ui.py index ecf77430d1..e84082e23f 100644 --- a/src/ifcblenderexport/blenderbim/ui.py +++ b/src/ifcblenderexport/blenderbim/ui.py @@ -589,6 +589,8 @@ class BIM_PT_mvd(Panel): row.prop(bim_properties, 'export_has_representations') row = layout.row() row.prop(bim_properties, 'import_should_import_curves') + row = layout.row() + row.prop(bim_properties, 'import_should_import_opening_elements') layout.label(text='Experimental Modes:')