From: mkr Date: Wed, 1 Nov 2006 08:51:33 +0000 (+0000) Subject: Fix for bug PAL11537 : Create an animation given several med files (add consecutive... X-Git-Tag: V3_2_3pre1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cbcd1e1ff484cb0e81e34c032c7a1fc5fb57a3ab;p=modules%2Fvisu.git Fix for bug PAL11537 : Create an animation given several med files (add consecutive animation mode) : renaming "consecutive" -> "succcessive". Add python script for testing. --- diff --git a/src/VISU_SWIG/visu_succcessive_animation.py b/src/VISU_SWIG/visu_succcessive_animation.py new file mode 100644 index 00000000..19b51004 --- /dev/null +++ b/src/VISU_SWIG/visu_succcessive_animation.py @@ -0,0 +1,95 @@ +# VISU VISU_SWIG : binding of C++ implementation and Python +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# File : visu_view3d.py +# Module : VISU + +import os +import time +import math +import VISU +import SALOMEDS +from visu_gui import * + +aDelay = 0 + +myViewManager = myVisu.GetViewManager(); + +myView = myViewManager.Create3DView(); +myView.SetTitle("The viewer for Animation") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +medFile = "TimeStamps.med" +myFieldName = "temperature" + +medFile = os.getenv('DATA_DIR') + medFile +myResult = myVisu.ImportFile(medFile) + +anAnim = myVisu.CreateAnimation(myView); +anAnim.setAnimationMode(VISU.Animation.SUCCCESSIVE); + +aSObj = myStudy.FindObjectIOR(myResult.GetID()) +aSObj = aSObj.FindSubObject(1)[1] +aSObj = aSObj.FindSubObject(3)[1] +aSObj = aSObj.FindSubObject(1)[1] +print "addField 1 : ", anAnim.addField(aSObj) + +medFile1 = "TimeStamps_import22.med" +myFieldName1 = "pression" + +medFile1 = os.getenv('DATA_DIR') + medFile1 +myResult1 = myVisu.ImportFile(medFile1) + +aSObj1 = myStudy.FindObjectIOR(myResult1.GetID()) +aSObj1 = aSObj1.FindSubObject(1)[1] +aSObj1 = aSObj1.FindSubObject(3)[1] +aSObj1 = aSObj1.FindSubObject(3)[1] +print "addField 2 : ", anAnim.addField(aSObj1) + +print "Generate presentations for ", anAnim.getNbFields(), " fields" +for i in range(0,anAnim.getNbFields()): + anAnim.setPresentationType(i,VISU.TPLOT3D) + anAnim.generatePresentations(i) + +print "Generate frames" +anAnim.generateFrames() + +print "Start Animation" +anAnim.setSpeed(22) +anAnim.startAnimation() +myView.FitAll() + +while 1: + time.sleep(1+aDelay) + if not anAnim.isRunning(): + anAnim.stopAnimation() + break + +anAnim.publishInStudy() +anAnim.saveAnimation() + +if anAnim.getAnimationMode() == VISU.Animation.SUCCCESSIVE: + print "End of succcessive animation for 2 fields with presentation type VISU.Animation.SUCCCESSIVE" + +anAnim.clearFields() +print "The number of fields in animation after clearFields method is", anAnim.getNbFields() + diff --git a/src/VISU_SWIG/visu_view3d.py b/src/VISU_SWIG/visu_view3d.py index 369cacd6..8d1c94a0 100644 --- a/src/VISU_SWIG/visu_view3d.py +++ b/src/VISU_SWIG/visu_view3d.py @@ -34,7 +34,7 @@ aDelay = 0 #mySession = batchmode_visu.mySession myViewManager = myVisu.GetViewManager(); -""" + myView = myViewManager.Create3DView(); myView.SetTitle("The window will be soon destroyed!") print "myViewManager.Create3DView()" @@ -251,45 +251,33 @@ print "myViewManager.CreateXYPlot()" time.sleep(aDelay) myView.Display(aContainer) -""" + + myView = myViewManager.Create3DView(); myView.SetTitle("The viewer for Animation") print "myViewManager.Create3DView()" time.sleep(aDelay) -medFile = "carre_en_quad4.med" #"TimeStamps.med" -myFieldName = "fieldnodedouble" #"vitesse"; +medFile = "TimeStamps.med" +myFieldName = "vitesse"; -medFile = os.getenv('DATA_DIR') + medFile +medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile myResult = myVisu.ImportFile(medFile) anAnim = myVisu.CreateAnimation(myView); aSObj = myStudy.FindObjectIOR(myResult.GetID()) aSObj = aSObj.FindSubObject(1)[1] aSObj = aSObj.FindSubObject(3)[1] -aSObj = aSObj.FindSubObject(1)[1] #(2)[1] -#anAnim.addField(aSObj) - -medFile1 = "pointe.med" #"hexa_28320_ELEM.med" -myFieldName1 = "fieldnodedouble" #"vitesse_elem_dom_pb1"; - -medFile1 = os.getenv('DATA_DIR') + medFile1 -myResult1 = myVisu.ImportFile(medFile1) - -aSObj1 = myStudy.FindObjectIOR(myResult1.GetID()) -aSObj1 = aSObj1.FindSubObject(1)[1] -aSObj1 = aSObj1.FindSubObject(3)[1] -aSObj1 = aSObj1.FindSubObject(1)[1] #(2)[1] -anAnim.addField(aSObj1) - +aSObj = aSObj.FindSubObject(2)[1] +anAnim.addField(aSObj) anAnim.setPresentationType(0,VISU.TISOSURFACE) print "Generate presentations" anAnim.generatePresentations(0) print "Generate frames" anAnim.generateFrames() print "Start Animation" -anAnim.setSpeed(1) +anAnim.setSpeed(99) #anAnim.setCycling(1) anAnim.startAnimation() myView.FitAll()