New UI in Blender to run IFCPatch

This commit is contained in:
Dion Moult
2020-08-05 17:18:10 +10:00
parent 277786771c
commit b60438b51c
5 changed files with 113 additions and 0 deletions
@@ -1338,6 +1338,23 @@ class ExecuteIfcCobie(bpy.types.Operator):
return {'FINISHED'}
class ExecuteIfcPatch(bpy.types.Operator):
bl_idname = 'bim.execute_ifc_patch'
bl_label = 'Execute IFCPatch'
file_format: bpy.props.StringProperty()
def execute(self, context):
import ifcpatch
ifcpatch.execute({
'input': bpy.context.scene.BIMProperties.ifc_patch_input,
'output': bpy.context.scene.BIMProperties.ifc_patch_output,
'recipe': bpy.context.scene.BIMProperties.ifc_patch_recipes,
'arguments': json.loads('[' + bpy.context.scene.BIMProperties.ifc_patch_args + ']'),
'log': bpy.context.scene.BIMProperties.data_dir + 'process.log'
})
return {'FINISHED'}
class SelectDiffJsonFile(bpy.types.Operator):
bl_idname = "bim.select_diff_json_file"
bl_label = "Select Diff JSON File"
@@ -3267,3 +3284,33 @@ class BIMTesterPurge(bpy.types.Operator):
bimtester.TestPurger().purge()
os.chdir(cwd)
return {'FINISHED'}
class SelectIfcPatchInput(bpy.types.Operator):
bl_idname = "bim.select_ifc_patch_input"
bl_label = "Select IFC Patch Input"
filter_glob: bpy.props.StringProperty(default="*.ifc", options={'HIDDEN'})
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
bpy.context.scene.BIMProperties.ifc_patch_input = self.filepath
return {'FINISHED'}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}
class SelectIfcPatchOutput(bpy.types.Operator):
bl_idname = "bim.select_ifc_patch_output"
bl_label = "Select IFC Patch Output"
filename_ext = '.ifc'
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
bpy.context.scene.BIMProperties.ifc_patch_output = self.filepath
return {'FINISHED'}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}