forked from sofa-framework/SofaPython3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemptyDataEngine.py
More file actions
51 lines (35 loc) · 1.18 KB
/
emptyDataEngine.py
File metadata and controls
51 lines (35 loc) · 1.18 KB
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
47
48
49
50
51
import Sofa
from Sofa.Helper import msg_info
# This python script shows the functions to be implemented
# in order to create your DataEngine in python
class EmptyDataEngine(Sofa.Core.DataEngine):
def __init__(self, *args, **kwargs):
Sofa.Core.DataEngine.__init__(self, *args, **kwargs)
pass
def init(self):
pass
def update():
# Function called anytime an output is accessed while the component
# is dirty (input has changed)
msg_info('Not implemented yet')
pass
def createScene(root):
root.dt = 0.01
root.bbox = [[-1, -1, -1],[1,1,1]]
root.addObject('DefaultAnimationLoop')
# Add our python forcefield in the scene
root.addObject( EmptyDataEngine(name="MyEmptyDataEngine") )
def main():
import SofaImGui
import Sofa.Gui
root=Sofa.Core.Node("root")
createScene(root)
Sofa.Simulation.initRoot(root)
Sofa.Gui.GUIManager.Init("myscene", "imgui")
Sofa.Gui.GUIManager.createGUI(root, __file__)
Sofa.Gui.GUIManager.SetDimension(1080, 1080)
Sofa.Gui.GUIManager.MainLoop(root)
Sofa.Gui.GUIManager.closeGUI()
print("End of simulation.")
if __name__ == '__main__':
main()