From 375deaad1e965236fb1e0a193acba18bdfe6a1c8 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 1 Jul 2024 12:24:47 +0500 Subject: [PATCH] Add description to "Upgrade to IFC4/IFC4X3)" operator To emphasize that it won't overwrite the current file. Example - https://i.imgur.com/CKIQJwn.png --- .../blenderbim/bim/module/patch/operator.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/patch/operator.py b/src/blenderbim/blenderbim/bim/module/patch/operator.py index 6f5e2f7e3c..9397b52f33 100644 --- a/src/blenderbim/blenderbim/bim/module/patch/operator.py +++ b/src/blenderbim/blenderbim/bim/module/patch/operator.py @@ -23,6 +23,7 @@ import ifcopenshell import blenderbim.tool as tool import blenderbim.core.patch as core import blenderbim.bim.handler +from pathlib import Path try: import ifcpatch @@ -139,9 +140,18 @@ class UpdateIfcPatchArguments(bpy.types.Operator): class RunMigratePatch(bpy.types.Operator): bl_idname = "bim.run_migrate_patch" bl_label = "Run Migrate Patch" - infile: bpy.props.StringProperty() - outfile: bpy.props.StringProperty() - schema: bpy.props.StringProperty() + infile: bpy.props.StringProperty(name="Input IFC filepath") + outfile: bpy.props.StringProperty(name="Output IFC filepath") + schema: bpy.props.StringProperty(name="Target IFC schema") + + @classmethod + def description(cls, context, properties): + if not all((properties.infile, properties.outfile, properties.schema)): + return "" + return ( + f"Migrate file '{Path(properties.infile).name}' to IFC schema " + f"{properties.schema} and save as '{Path(properties.outfile).name}'" + ) def execute(self, context): core.run_migrate_patch(tool.Patch, infile=self.infile, outfile=self.outfile, schema=self.schema)