[Paraview] using kw(vtktemp??) in scripts

Berk Geveci berk.geveci at kitware.com
Wed Mar 14 14:34:04 EST 2007


Completely ignore kw(vtkTempXXX) stuff (crap). That is just a
convenient way of referring to objects when writing state. The
commands that open a file or create a filter return a reference to the
object you can use.

For example:

# assign the main window to a variable for convenience
set mainWindow [$Application GetMainWindow]

# apply the elevation filter to the current object
# myElevationFilter will point to the filter afterwards
set myElevationFilter [$mainWindow CreatePVSource ElevationFilter]
$myElevationFilter AcceptCallback

....

# make the elevation filter current
$mainWindow SetCurrentPVSourceCallback $myElevationFilter

Properties are obtained in a similar way:
set imageSource [$mainWindow CreatePVSource ImageMandelbrotSource]
set extent [$imageSource GetPVWidget {Extent}]
$extent SetValue 0 25 0 25 0 25
$imageSource AcceptCallback

Scripting in 3.0 will be a walk in the park compared to this stuff :-)

-berk

On 3/12/07, Renato N. Elias <rnelias at nacad.ufrj.br> wrote:
> Hi folks,
>
> Doesn anyone could tell me how those kw(vtktemp) variables are created in PV
> scripts? I'd like to use it to create a script but I have no clue how to do
> it. Basically the script must do something like:
>
> - Open some datasets;
> - Apply a filter;
> - Save the output dataset created by the filter.
>
> I can already open the datasets and save them (including the transient
> data), but I don't know how to select and pass them to the filter since I
> don't know which kw(vtktemp) I have to refer.
>
> I've been doing like the following pseudo-code
>
> #
> # Loading files
> #
> for {set i 0} {$i < $NumberOfProcesses } {incr i} {
>     set mytmp <--- point to the file to be read
>     ...
>     ...
> }
>
> #
> # Applying the filter
> #
> $kw(vtkTemp1078) SetSelectState $mytmp 1  <--- HERE IS MY PROBLEM SINCE I
> CAN ONLY SELECT THE LAST $mytmp
>
>
> #
> # Saving the resulting file
> #
> for {set i 1} {$i < NumberOfTimeSteps} {incr i} {
>     $kw(vtkTemp2) WriteVTKFile $FullPath 0
>     ...
>     ...
> }
>
> Thanks for any help.
>
>
>
> Renato N. Elias
> ==========================================
> PhD student, http://www.nacad.ufrj.br/~rnelias
> High Performance Computing Center (NACAD)
> Federal University of Rio de Janeiro
> Rio de Janeiro, Brazil
>
>
>
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>


-- 
 Berk Geveci
 Kitware Inc.
 28 Corporate Drive
 Clifton Park, NY, 12065


More information about the ParaView mailing list