1 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # VISU VISU_SWIG : binding of C++ implementation and Python
23 # File : visu_view3d.py
31 from visu_gui import *
35 myViewManager = myVisu.GetViewManager();
37 myView = myViewManager.Create3DView();
38 myView.SetTitle("The viewer for Animation")
39 print "myViewManager.Create3DView()"
42 medFile = "TimeStamps.med"
43 myFieldName = "temperature"
45 medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile
46 myResult = myVisu.ImportFile(medFile)
48 anAnim = myVisu.CreateAnimation(myView);
49 anAnim.setAnimationMode(VISU.Animation.SUCCESSIVE);
51 aSObj = myStudy.FindObjectIOR(myResult.GetID())
52 aSObj = aSObj.FindSubObject(1)[1]
53 aSObj = aSObj.FindSubObject(3)[1]
54 aSObj = aSObj.FindSubObject(1)[1]
55 print "addField 1 : ", anAnim.addField(aSObj)
57 medFile1 = "TimeStamps_import22.med"
58 myFieldName1 = "pression"
60 medFile1 = os.getenv('DATA_DIR') + '/MedFiles/' + medFile1
61 myResult1 = myVisu.ImportFile(medFile1)
63 aSObj1 = myStudy.FindObjectIOR(myResult1.GetID())
64 aSObj1 = aSObj1.FindSubObject(1)[1]
65 aSObj1 = aSObj1.FindSubObject(3)[1]
66 aSObj1 = aSObj1.FindSubObject(3)[1]
67 print "addField 2 : ", anAnim.addField(aSObj1)
69 print "Generate presentations for ", anAnim.getNbFields(), " fields"
70 for i in range(0,anAnim.getNbFields()):
71 anAnim.setPresentationType(i,VISU.TPLOT3D)
72 anAnim.generatePresentations(i)
74 print "Generate frames"
75 anAnim.generateFrames()
77 print "Start Animation"
79 anAnim.startAnimation()
84 if not anAnim.isRunning():
85 anAnim.stopAnimation()
88 anAnim.publishInStudy()
89 anAnim.saveAnimation()
91 if anAnim.getAnimationMode() == VISU.Animation.SUCCESSIVE:
92 print "End of succcessive animation for 2 fields with presentation type VISU.Animation.SUCCESSIVE"
95 print "The number of fields in animation after clearFields method is", anAnim.getNbFields()