]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_SWIG/visu_succcessive_animation.py
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / VISU_SWIG / visu_succcessive_animation.py
1 #  VISU VISU_SWIG : binding of C++ implementation and Python
2 #
3 #  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5
6 #  This library is free software; you can redistribute it and/or 
7 #  modify it under the terms of the GNU Lesser General Public 
8 #  License as published by the Free Software Foundation; either 
9 #  version 2.1 of the License. 
10
11 #  This library is distributed in the hope that it will be useful, 
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 #  Lesser General Public License for more details. 
15
16 #  You should have received a copy of the GNU Lesser General Public 
17 #  License along with this library; if not, write to the Free Software 
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19
20 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 #  File   : visu_view3d.py
23 #  Module : VISU
24
25 import os
26 import time
27 import math
28 import VISU
29 import SALOMEDS
30 from visu_gui import *
31
32 aDelay = 0
33
34 myViewManager = myVisu.GetViewManager();
35
36 myView = myViewManager.Create3DView();
37 myView.SetTitle("The viewer for Animation")
38 print "myViewManager.Create3DView()"
39 time.sleep(aDelay)
40
41 medFile = "TimeStamps.med"
42 myFieldName = "temperature"
43
44 medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile
45 myResult = myVisu.ImportFile(medFile)
46
47 anAnim = myVisu.CreateAnimation(myView);
48 anAnim.setAnimationMode(VISU.Animation.SUCCESSIVE);
49
50 aSObj = myStudy.FindObjectIOR(myResult.GetID())
51 aSObj = aSObj.FindSubObject(1)[1]
52 aSObj = aSObj.FindSubObject(3)[1]
53 aSObj = aSObj.FindSubObject(1)[1]
54 print "addField 1 : ", anAnim.addField(aSObj)
55
56 medFile1 = "TimeStamps_import22.med"
57 myFieldName1 = "pression"
58
59 medFile1 = os.getenv('DATA_DIR') + '/MedFiles/' + medFile1
60 myResult1 = myVisu.ImportFile(medFile1)
61
62 aSObj1 = myStudy.FindObjectIOR(myResult1.GetID())
63 aSObj1 = aSObj1.FindSubObject(1)[1]
64 aSObj1 = aSObj1.FindSubObject(3)[1]
65 aSObj1 = aSObj1.FindSubObject(3)[1]
66 print "addField 2 : ", anAnim.addField(aSObj1)
67
68 print "Generate presentations for ", anAnim.getNbFields(), " fields"
69 for i in range(0,anAnim.getNbFields()):
70     anAnim.setPresentationType(i,VISU.TPLOT3D)
71     anAnim.generatePresentations(i)
72
73 print "Generate frames"
74 anAnim.generateFrames()
75
76 print "Start Animation"
77 anAnim.setSpeed(22)
78 anAnim.startAnimation()
79 myView.FitAll()
80
81 while 1:
82     time.sleep(1+aDelay)
83     if not anAnim.isRunning():
84         anAnim.stopAnimation()
85         break
86
87 anAnim.publishInStudy()
88 anAnim.saveAnimation()
89
90 if anAnim.getAnimationMode() == VISU.Animation.SUCCESSIVE:
91    print "End of succcessive animation for 2 fields with presentation type VISU.Animation.SUCCESSIVE"
92    
93 anAnim.clearFields()
94 print "The number of fields in animation after clearFields method is", anAnim.getNbFields()
95