[vtkusers] TCL script to open several files...

Renato N. Elias rnelias at oi.com.br
Sun Jan 15 07:43:26 EST 2006



Dear friends,

I'd like to write a VTK/TCL script to read several Ensight Case files, apply
the "append dataset" and "clean to grid" filters and export the result to an
unique VTK file, but my problem is: how can I read several files in a TCL
scrip without having to write a reader block for each case file? I'm trying
to do something like this:


...

# radical is used to build the file names
set radical [lindex $argv 0]      

# number of files to be read
set nprocs  [lindex $argv 1]
append radical "_"  

# example radical = foo, nprocs=2
# will produce the following filenames: foo_00.case and foo_01.case
# foo_00.case + foo_01.case = foo.vtk

for {set i 0} {$i < $nprocs} {incr i} {

    set casefile(i) $radical
    if {$i < 10} { append casefile(i) "0" }
    append casefile(i) $i
    append casefile(i) ".case"
    puts " Reading Ensight casefile $casefile(i)"

    vtkGenericEnSightReader reader
       reader SetCaseFileName $casefile(i)
       reader Update
...
...

}

as everybody can see, it'll never work.... 

I understood that the "reader" is an object and I should create one object
to each casefile, so, how could I do that?

I guess it's a very basic question, but I just started to learn TCL and VTK
and I have not found any similar example in the VTK books.

thanks a lot for any help


Renato N. Elias
===================================================
PhD Student
High Performance Computing Center - NACAD/COPPE
Federal University of Rio de Janeiro, RJ -Brazil
http://www.nacad.ufrj.br/~rnelias
 




More information about the vtkusers mailing list