-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch.py
33 lines (25 loc) · 1.19 KB
/
launch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
Created by Marc Engelmann
Date: 08.07.2019
© Bauhaus Luftfahrt e.V.
(c) 2014 - 2021 Bauhaus Luftfahrt e.V.. All rights reserved. This program and the accompanying
materials are made available under the terms of the GNU General Public License v3.0 which accompanies
this distribution, and is available at https://www.gnu.org/licenses/gpl-3.0.html.en
"""
import subprocess
import os
if __name__ == "__main__":
"""
This method launches Blender in the background and feeds the Python script as a launch argument.
This skips the manual import and automatically processes the Blender file.
Tested with Blender 2.92
"""
home_path: str = os.path.expanduser('~')
blender_installation_path: str = os.path.join(home_path, 'Blender\\blender.exe')
python_script_path: str = os.path.join(home_path, 'git\\blender-cpacs-interface\\blender_cpacs_importer.py')
cpacs_file_path: str = os.path.join(home_path, 'Desktop\\aircraft.xml')
# Generate the launch arguments
args: [str] = [blender_installation_path, "--background", '--python', python_script_path, '--', cpacs_file_path]
print(args)
# Run the process
subprocess.call(args, shell=False)