Record the source IFC file as metadata in preparation for partial writes

This commit is contained in:
Dion Moult
2020-01-29 11:42:43 +11:00
parent 1800ebc893
commit 9cf81d5c7b
5 changed files with 28 additions and 4 deletions
@@ -40,6 +40,7 @@ if bpy is not None:
operator.SelectDiffOldFile,
operator.SelectDataDir,
operator.SelectSchemaDir,
operator.SelectIfcFile,
operator.ExportIFC,
operator.ImportIFC,
operator.ColourByClass,
@@ -139,6 +139,7 @@ class IfcImporter():
def execute(self):
self.load_diff()
self.load_file()
self.set_ifc_file()
if self.ifc_import_settings.should_auto_set_workarounds:
self.auto_set_workarounds()
self.calculate_unit_scale()
@@ -296,6 +297,9 @@ class IfcImporter():
self.ifc_import_settings.logger.info('loading file {}'.format(self.ifc_import_settings.input_file))
self.file = ifcopenshell.open(self.ifc_import_settings.input_file)
def set_ifc_file(self):
bpy.context.scene.BIMProperties.ifc_file = self.ifc_import_settings.input_file
def calculate_unit_scale(self):
units = self.file.by_type('IfcUnitAssignment')[0]
for unit in units.Units:
@@ -699,6 +699,21 @@ class SelectFeaturesDir(bpy.types.Operator):
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}
class SelectIfcFile(bpy.types.Operator):
bl_idname = "bim.select_ifc_file"
bl_label = "Select IFC File"
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
bpy.context.scene.BIMProperties.ifc_file = self.filepath
return {'FINISHED'}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}
class SelectDataDir(bpy.types.Operator):
bl_idname = "bim.select_data_dir"
bl_label = "Select Data Directory"
@@ -712,6 +727,7 @@ class SelectDataDir(bpy.types.Operator):
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}
class SelectSchemaDir(bpy.types.Operator):
bl_idname = "bim.select_schema_dir"
bl_label = "Select Schema Directory"
+1
View File
@@ -359,6 +359,7 @@ class BIMCameraProperties(PropertyGroup):
class BIMProperties(PropertyGroup):
schema_dir: StringProperty(default=os.path.join(cwd ,'schema') + os.path.sep, name="Schema Directory")
data_dir: StringProperty(default=os.path.join(cwd, 'data') + os.path.sep, name="Data Directory")
ifc_file: StringProperty(name="IFC File")
audit_ifc_class: EnumProperty(items=getIfcClasses, name="Audit Class")
ifc_product: EnumProperty(items=getIfcProducts, name="Products", update=refreshClasses)
ifc_class: EnumProperty(items=getIfcClasses, name="Class", update=refreshPredefinedTypes)
+6 -4
View File
@@ -392,16 +392,18 @@ class BIM_PT_bim(Panel):
row = layout.row()
row.operator('bim.quick_project_setup')
col = layout.column()
row = col.row(align=True)
row = layout.row(align=True)
row.prop(bim_properties, "schema_dir")
row.operator("bim.select_schema_dir", icon="FILE_FOLDER", text="")
col = layout.column()
row = col.row(align=True)
row = layout.row(align=True)
row.prop(bim_properties, "data_dir")
row.operator("bim.select_data_dir", icon="FILE_FOLDER", text="")
row = layout.row(align=True)
row.prop(bim_properties, "ifc_file")
row.operator("bim.select_ifc_file", icon="FILE_FOLDER", text="")
layout.label(text="Software Identity:")
row = layout.row()