diff --git a/src/ifcblenderexport/io_export_ifc/import_ifc.py b/src/ifcblenderexport/io_export_ifc/import_ifc.py index df4eaecf19..6c05b2d53c 100644 --- a/src/ifcblenderexport/io_export_ifc/import_ifc.py +++ b/src/ifcblenderexport/io_export_ifc/import_ifc.py @@ -99,7 +99,8 @@ class IfcImporter(): self.ifc_import_settings = ifc_import_settings self.file = None self.settings = ifcopenshell.geom.settings() - self.settings.set(self.settings.INCLUDE_CURVES, True) + if self.ifc_import_settings.should_import_curves: + self.settings.set(self.settings.INCLUDE_CURVES, True) self.project = None self.spatial_structure_elements = {} self.elements = {} @@ -149,6 +150,9 @@ class IfcImporter(): name = self.get_name(element) if name in self.spatial_structure_elements: continue + # Occurs when some naughty programs export IFC site objects + if not element.Decomposes: + continue parent = element.Decomposes[0].RelatingObject parent_name = self.get_name(parent) if parent.is_a('IfcProject'): @@ -298,3 +302,4 @@ class IfcImportSettings: def __init__(self): self.logger = None self.input_file = None + self.should_import_curves = False diff --git a/src/ifcblenderexport/io_export_ifc/operator.py b/src/ifcblenderexport/io_export_ifc/operator.py index 2b8f9c3c59..d175fe89e5 100644 --- a/src/ifcblenderexport/io_export_ifc/operator.py +++ b/src/ifcblenderexport/io_export_ifc/operator.py @@ -58,6 +58,7 @@ class ImportIFC(bpy.types.Operator, ImportHelper): ifc_import_settings.logger = logging.getLogger('ImportIFC') ifc_import_settings.logger.info('Starting import') ifc_import_settings.input_file = self.filepath + ifc_import_settings.should_import_curves = bpy.context.scene.BIMProperties.import_should_import_curves ifc_importer = import_ifc.IfcImporter(ifc_import_settings) ifc_importer.execute() ifc_import_settings.logger.info('Import finished in {:.2f} seconds'.format(time.time() - start)) diff --git a/src/ifcblenderexport/io_export_ifc/ui.py b/src/ifcblenderexport/io_export_ifc/ui.py index 8fd8d2104e..d67f6b3574 100644 --- a/src/ifcblenderexport/io_export_ifc/ui.py +++ b/src/ifcblenderexport/io_export_ifc/ui.py @@ -63,6 +63,7 @@ class BIMProperties(bpy.types.PropertyGroup): export_has_representations: bpy.props.BoolProperty(name="Export Representations", default=True) export_should_export_all_materials_as_styled_items: bpy.props.BoolProperty(name="Export All Materials as Styled Items", default=False) export_should_use_presentation_style_assignment: bpy.props.BoolProperty(name="Export with Presentation Style Assignment", default=False) + import_should_import_curves: bpy.props.BoolProperty(name="Import Curves", default=False) qa_reject_element_reason: bpy.props.StringProperty(name="Element Rejection Reason") pset_name: bpy.props.EnumProperty(items=getPsetNames, name="Pset Name") pset_file: bpy.props.EnumProperty(items=getPsetFiles, name="Pset File") @@ -446,3 +447,6 @@ class MVDPanel(bpy.types.Panel): row.prop(bim_properties, "export_should_export_all_materials_as_styled_items") row = layout.row() row.prop(bim_properties, "export_should_use_presentation_style_assignment") + + row = layout.row() + row.prop(bim_properties, "import_should_import_curves")