RES: [vtkusers] Re: Translating Ensight to VTK transient data...
Renato N. Elias
rnelias at nacad.ufrj.br
Tue Sep 26 21:57:45 EDT 2006
Hi Goodwin,
thanks a lot for your help.
In fact, I firstly tried to extract the number of time steps as you did
since it would be easier to perform a loop over the time steps instead of
the time values. My problem was that vtk returned me an error in
GetNumberOfItems method. With your script I got the same error message:
Object named: vtkTemp2, could not find requested method: GetNumberOfItems or
the method was called with incorrect arguments.
while executing
"$timeSteps GetNumberOfItems"
invoked from within
"set numTimeSteps [$timeSteps GetNumberOfItems]"
(file "ens2vtk.tcl" line 24)
do you know how to work out it?!
Regards
Renato.
-----Mensagem original-----
De: vtkusers-bounces+rnelias=nacad.ufrj.br at vtk.org
[mailto:vtkusers-bounces+rnelias=nacad.ufrj.br at vtk.org] Em nome de Goodwin
Lawlor
Enviada em: terça-feira, 26 de setembro de 2006 19:59
Para: vtkusers at public.kitware.com
Assunto: [vtkusers] Re: Translating Ensight to VTK transient data...
Renato N. Elias wrote:
> 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:
>
<snip>
Hi Renato,
Try this:
package require vtk
# loading command line arguments
set arch [lindex $argv 0]
# building the filename
set casefile $arch.case
puts " Reading Ensight casefile $casefile"
# defining the Ensight's reader and VTK writer vtkGenericEnSightReader
reader
reader SetCaseFileName $casefile
reader Update
# define the vtk file object
vtkXMLUnstructuredGridWriter vtkfile
vtkfile SetInput [ reader GetOutput ]
# find the time steps
set tSets [reader GetTimeSets]
$tSets InitTraversal
set timeSteps [$tSets GetNextItem]
set numTimeSteps [$timeSteps GetNumberOfItems]
# loop over time steps
for {set nfile 0} {$nfile < $numTimeSteps} {incr nfile} {
# building the vtk filename
set vtkfilename [format "%02d$arch.vtk" $nfile]
# set the time step
set timeStep [$timeSteps GetTuple1 $nfile]
reader SetTimeStep $timeStep
# write out the vtk file
vtkfile SetFileName $vtkfilename
vtkfile Write
puts " Writing VTK file $vtkfilename for time step $timeStep"
}
reader Delete
vtkfile Delete
wm withdraw .
exit
#--------------------------------------------------------------------------
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list