Add UI option to import curves and tolerate invalid IfcSite objects

This commit is contained in:
Dion Moult
2019-11-08 16:02:57 +11:00
parent 60b3daf686
commit af16e64fd9
3 changed files with 11 additions and 1 deletions
@@ -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
@@ -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))
+4
View File
@@ -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")