[Paraview] tips on batch animation & EnSight Case files

Jean M. Favre jfavre at cscs.ch
Fri May 28 10:36:51 EDT 2004


ParaView users

I just wanted to share some simple tricks to work-around some 
limitations of paraview v1.4.2 with EnSight (or other) time-dependent 
datasets.

The animation interface cannot handle time-values with varying time 
increments (it assumes constant time increments throughout the 
animation), and it has round-off troubles in some cases.

There is a simple workaround. Save the batch script and edit the Tcl 
code. It's trivial and will produce the correct answer.

example: I have an Ensight case file with a timeset of:

TIME
time set:                  1
number of steps:           20
filename start number:     1
filename increment:        1
time values:
0.00 0.025 0.05 0.075 0.10 0.125 0.15 0.175 0.2 0.225
0.25 0.3 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70

ParaView unrolls the loop and writes the following stuff:

[$pvTemp109 GetProperty SetTimeValue] SetElement 0 [expr round(0)]
$pvTemp109 UpdateVTKObjects
$Ren1 UpdateVTKObjects
$Ren1 WriteImage {/tmp/b00000.jpg} vtkJPEGWriter

[$pvTemp109 GetProperty SetTimeValue] SetElement 0 [expr round(0.0368421)]
$pvTemp109 UpdateVTKObjects
$Ren1 UpdateVTKObjects
$Ren1 WriteImage {/tmp/b00001.jpg} vtkJPEGWriter

etc...

you can simply replace this with a Tcl loop

set i 0
foreach t {0.00 0.025 0.05 0.075 0.10 0.125 0.15 0.175} {
   [$pvTemp111 GetProperty SetTimeValue] SetElement 0 $t
   $pvTemp111 UpdateVTKObjects
   $Ren1 UpdateVTKObjects
   set fname [format "batch%03d.jpg" $i]
   $Ren1 WriteImage $fname vtkJPEGWriter
   incr i
}

Now, the last thing I have not been able to figure out is how to write a 
CornerAnnotation with the correct time step.

my trick is to add the following line in the foreach loop above

puts [format "convert -fill white -draw \'text 550,500 \"t = %6.3f\"' %s 
%s" $t $fname new$fname]

I run paraview like this:

paraview --batch batch.pvd > annotate_script.tcl

and then execute annotate_script.tcl

Hope this can be useful to some users.

Cheers.

Jean



More information about the ParaView mailing list