-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunSofa.py
46 lines (33 loc) · 1.09 KB
/
runSofa.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
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
runSofa.py
Launch the BeamSofa Environment in a Sofa GUI.
"""
# Python related imports
import os
# Sofa related imports
import Sofa.Gui
# DeepPhysX related imports
from DeepPhysX.Sofa.Environment.SofaEnvironmentConfig import SofaEnvironmentConfig
# Working session imports
from Environment.SquidSofa import SquidSofa
def create_environment():
# Create SofaEnvironment configuration
env_config = SofaEnvironmentConfig(environment_class=SquidSofa)
# Create Armadillo Environment
env = env_config.create_environment()
env.create()
env.init()
return env
if __name__ == '__main__':
# Create Environment
environment = create_environment()
# Launch Sofa GUI
Sofa.Gui.GUIManager.Init(program_name="main", gui_name="qglviewer")
Sofa.Gui.GUIManager.createGUI(environment.root, __file__)
Sofa.Gui.GUIManager.SetDimension(1080, 1080)
Sofa.Gui.GUIManager.MainLoop(environment.root)
Sofa.Gui.GUIManager.closeGUI()
# Delete log files
for file in os.listdir(os.getcwd()):
if '.ini' in file or '.log' in file:
os.remove(file)