33 lines
1,010 B
Python
33 lines
1,010 B
Python
# launcher.py
|
|
# This runs outside Blender using regular Python to import multiple IFCs one by one
|
|
|
|
import subprocess
|
|
import os
|
|
import sys
|
|
|
|
# === USER SETTINGS ===
|
|
blend_launcher = r"C:\Program Files\Blender Foundation\Blender 4.2\blender.exe"
|
|
script_path = r"D:\Dropbox\Gitea_OD\Bonsai_Tutorials\_Model\import_single_ifc.py"
|
|
ifc_folder = r"D:\Dropbox\Gitea_OD\Bonsai_Tutorials\_Model"
|
|
output_folder = r"D:\Dropbox\Gitea_OD\Bonsai_Tutorials\_Model"
|
|
skip_names = {"House.ifc"}
|
|
|
|
|
|
ifc_files = sorted(
|
|
f for f in os.listdir(ifc_folder)
|
|
if f.lower().endswith(".ifc") and f.lower() not in {name.lower() for name in skip_names}
|
|
)
|
|
|
|
for i, ifc_file in enumerate(ifc_files, start=1):
|
|
filepath = os.path.join(ifc_folder, ifc_file)
|
|
output_blend = os.path.join(output_folder, f"Stage_{i:03}.blend")
|
|
|
|
print(f"\n=== Importing: {ifc_file} ===")
|
|
subprocess.run([
|
|
blend_launcher,
|
|
"--background",
|
|
"--python", script_path,
|
|
"--",
|
|
filepath,
|
|
output_blend
|
|
])
|