This commit is contained in:
Andrej730
2025-12-22 18:59:58 +05:00
parent 3a697e3062
commit a3fda66dec
2 changed files with 9 additions and 8 deletions
+2 -1
View File
@@ -260,7 +260,6 @@ class SaveBlendMetadataFile(bpy.types.Operator):
self.report({"WARNING"}, "No IFC file path set.") self.report({"WARNING"}, "No IFC file path set.")
return {"CANCELLED"} return {"CANCELLED"}
blendmetadata_path = ifc_file + ".metadata.blend" blendmetadata_path = ifc_file + ".metadata.blend"
ifc_dir = os.path.dirname(ifc_file) ifc_dir = os.path.dirname(ifc_file)
@@ -332,12 +331,14 @@ except Exception:
bpy.ops.wm.save_as_mainfile(filepath=r'{blendmetadata_path}') bpy.ops.wm.save_as_mainfile(filepath=r'{blendmetadata_path}')
""" """
import tempfile import tempfile
with tempfile.NamedTemporaryFile("w", suffix=".py", delete=False) as script_file: with tempfile.NamedTemporaryFile("w", suffix=".py", delete=False) as script_file:
script_file.write(cleanup_script) script_file.write(cleanup_script)
script_path = script_file.name script_path = script_file.name
blender_exe = bpy.app.binary_path blender_exe = bpy.app.binary_path
import subprocess import subprocess
result = subprocess.run( result = subprocess.run(
[blender_exe, temp_path, "--background", "--python", script_path], capture_output=True, text=True [blender_exe, temp_path, "--background", "--python", script_path], capture_output=True, text=True
) )