From b7db3da017552a1cc2286696af7480a229d618e4 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 27 Nov 2024 16:13:22 +0500 Subject: [PATCH] ifctester - save results to temp directory the way it was intended to originally but absolute paths of ifc and ids got in the way Replaced TemporaryDirectory with mkdtemp as sometimes .html report doesn't open fast enough and directory gets deleted. Also need to keep the directory to make sure .ods is not removed. --- src/bonsai/bonsai/bim/module/tester/operator.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/tester/operator.py b/src/bonsai/bonsai/bim/module/tester/operator.py index 3b963d753d..c05d7ec6b1 100644 --- a/src/bonsai/bonsai/bim/module/tester/operator.py +++ b/src/bonsai/bonsai/bim/module/tester/operator.py @@ -70,9 +70,11 @@ class ExecuteIfcTester(bpy.types.Operator): def execute_tester(self, ifc_data: ifcopenshell.file, ifc_path: str, specs_path: str) -> Union[set[str], None]: props = bpy.context.scene.IfcTesterProperties - with tempfile.TemporaryDirectory() as dirpath: + # No need for if-statement, just postponing lots of diffs. + if True: + dirpath = tempfile.mkdtemp() start = time.time() - output = Path(os.path.join(dirpath, "{}_{}.html".format(ifc_path, os.path.basename(specs_path)))) + output = Path(os.path.join(dirpath, "{}_{}.html".format(Path(ifc_path).name, Path(specs_path).name))) try: specs = ifctester.ids.open(specs_path)