[Paraview] Translating Ensight to VTK transient data...

Renato N. Elias rnelias at nacad.ufrj.br
Tue Sep 26 17:01:49 EDT 2006


Hi everybody,

here it's me again struggling with my Ensight files ;o)

I'm still trying to write a script to load an Ensight case file and export
the corresponding VTK file for each time step. My problem is that I can't
realize how to sweep the time steps loaded from the casefile. I found the
SetTimeValue method but I don't know how to select the next time step yet.
Does anybody more experienced with VTK+TCL could give me a hand? The script
is the following:

#--------------------------------------------------------------------------

package require vtk

# loading command line arguments
set arch  [lindex $argv 0]      

# building the filename
set    casefile $arch
append casefile ".case"
puts " Reading Ensight casefile $casefile"

# defining the Ensight's reader
vtkGenericEnSightReader reader
   reader SetCaseFileName $casefile
   reader Update

# getting the minimum and maximum time values for debug purposes
   set tmin [ reader GetMinimumTimeValue ]
   puts " minimum time $tmin"   
   
   set tmax [ reader GetMaximumTimeValue ]
   puts " maximum time $tmax"   

# defining some counters
set tnow $tmin
set nfile 0

# loop over time steps
while { $tnow < $tmax } {

      # building the vtk filename
      set vtkfilename $arch
      append vtkfilename ".vtk"
      set prefix ""      
      if {$nfile < 100} { append prefix "0" }
      if {$nfile < 10 } { append prefix "0" }
      append prefix $nfile
      append vtkfilename $prefix      
      incr nfile
      
      # define the vtk file object
      vtkXMLUnstructuredGridWriter vtkfile
          vtkfile SetInput [ reader GetOutput ]
          vtkfile SetFileName $vtkfilename
          vtkfile Write
          puts " Writing VTK file $vtkfilename for time $tnow"  
          vtkfile Delete

      # MY PROBLEM IS HERE !!!!
      reader SetTimeValue [ [reader GetTimeSets] GetNextItem ]
      reader Update
      set tnow [ reader GetTimeValue ]      

}

reader  Delete    
wm withdraw .
exit

#--------------------------------------------------------------------------

thanks for any help

Renato N. Elias
===============================================
PhD student - http://www.nacad.ufrj.br/~rnelias
High Performance Computing Center
Federal University of Rio de Janeiro
Rio de Janeiro, Brazil
+55(21) 2562-8080 




More information about the ParaView mailing list