mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
Create UI to run IFCDiff tool from Blender
This commit is contained in:
@@ -36,6 +36,8 @@ if bpy is not None:
|
||||
operator.SelectType,
|
||||
operator.SelectFeaturesDir,
|
||||
operator.SelectDiffJsonFile,
|
||||
operator.SelectDiffNewFile,
|
||||
operator.SelectDiffOldFile,
|
||||
operator.SelectDataDir,
|
||||
operator.SelectSchemaDir,
|
||||
operator.ExportIFC,
|
||||
@@ -82,6 +84,7 @@ if bpy is not None:
|
||||
operator.GenerateDigitalTwin,
|
||||
operator.CreateView,
|
||||
operator.ActivateView,
|
||||
operator.ExecuteIfcDiff,
|
||||
prop.Subcontext,
|
||||
prop.BIMProperties,
|
||||
prop.DocProperties,
|
||||
|
||||
@@ -519,6 +519,51 @@ class SelectDiffJsonFile(bpy.types.Operator):
|
||||
context.window_manager.fileselect_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
|
||||
class SelectDiffOldFile(bpy.types.Operator):
|
||||
bl_idname = "bim.select_diff_old_file"
|
||||
bl_label = "Select Diff Old File"
|
||||
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||
|
||||
def execute(self, context):
|
||||
bpy.context.scene.BIMProperties.diff_old_file = self.filepath
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
context.window_manager.fileselect_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
|
||||
class SelectDiffNewFile(bpy.types.Operator):
|
||||
bl_idname = "bim.select_diff_new_file"
|
||||
bl_label = "Select Diff New File"
|
||||
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||
|
||||
def execute(self, context):
|
||||
bpy.context.scene.BIMProperties.diff_new_file = self.filepath
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
context.window_manager.fileselect_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
|
||||
class ExecuteIfcDiff(bpy.types.Operator):
|
||||
bl_idname = 'bim.execute_ifc_diff'
|
||||
bl_label = 'Execute IFC Diff'
|
||||
|
||||
def execute(self, context):
|
||||
import ifcdiff
|
||||
ifc_diff = ifcdiff.IfcDiff(
|
||||
bpy.context.scene.BIMProperties.diff_old_file,
|
||||
bpy.context.scene.BIMProperties.diff_new_file,
|
||||
bpy.context.scene.BIMProperties.diff_json_file
|
||||
)
|
||||
ifc_diff.diff()
|
||||
ifc_diff.export()
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class SelectFeaturesDir(bpy.types.Operator):
|
||||
bl_idname = "bim.select_features_dir"
|
||||
bl_label = "Select Features Directory"
|
||||
|
||||
@@ -266,6 +266,8 @@ class BIMProperties(PropertyGroup):
|
||||
global_id: StringProperty(name="GlobalId")
|
||||
features_dir: StringProperty(default='', name="Features Directory")
|
||||
diff_json_file: StringProperty(default='', name="Diff JSON File")
|
||||
diff_old_file: StringProperty(default='', name="Diff Old IFC File")
|
||||
diff_new_file: StringProperty(default='', name="Diff New IFC File")
|
||||
aggregate_class: EnumProperty(items=getIfcClasses, name="Aggregate Class")
|
||||
aggregate_name: StringProperty(name="Aggregate Name")
|
||||
classification: EnumProperty(items=getClassifications, name="Classification", update=refreshReferences)
|
||||
|
||||
@@ -456,6 +456,17 @@ class BIM_PT_diff(Panel):
|
||||
row.prop(bim_properties, "diff_json_file")
|
||||
row.operator("bim.select_diff_json_file", icon="FILE_FOLDER", text="")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(bim_properties, "diff_old_file")
|
||||
row.operator("bim.select_diff_old_file", icon="FILE_FOLDER", text="")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(bim_properties, "diff_new_file")
|
||||
row.operator("bim.select_diff_new_file", icon="FILE_FOLDER", text="")
|
||||
|
||||
row = layout.row()
|
||||
row.operator('bim.execute_ifc_diff')
|
||||
|
||||
|
||||
class BIM_PT_mvd(Panel):
|
||||
bl_label = "Model View Definitions"
|
||||
|
||||
Reference in New Issue
Block a user