[Paraview] Doubts in paraview scripting.

Berk Geveci berk.geveci at kitware.com
Mon Jun 18 09:03:36 EDT 2007


> 1. Can we get the normal VTK pipeline working in paraview.
>
>   If we just want to have the conventional VTK pipeline in paraview script
> the script does not seem to work
>
>       import paraview
>
>       paraview.ActiveConnection = paraview.Connect()
>
>       reader = paraview.CreateProxy("sources",
> "XMLUnstructuredGridReader", "sources")
>
>       pyproxy = paraview.pyProxy(reader)
>       pyproxy.SetFileName("fire_ug.vtu")
>       pyproxy.UpdateVTKObjects()
>

This script is wrong. CreateProxy() already returns a pyProxy. Wrapping it
around another one would lead to errors. Use the reader object directly.

2. How to get the scaler range of a given dataset.
>
>   The normal vtk script that I have written for the velocity glyph for a
> particular data-set is :
>
>       import vtk
>
>       reader = vtk.vtkXMLUnstructuredGridReader()
>       reader.SetFileName("fire_ug.vtu")
>       reader.Update()
>
>       range = reader.GetOutput().GetScalarRange()
>
>   .................... the usual VTK pipeline
>
>   How do we get the scaler range in paraview
>

>From a proxy, you have to get the data information.
reader.UpdateVTKPipeline()
di = reader.GetDataInformation()

>From the data information, you can get the range. The API of data
information is described here:
http://www.paraview.org/ParaView3/Doc/Nightly/html/classvtkPVDataInformation.html

> 4. SetFactor not working with the Velocity glyph, and how to use the other
> parameters ?
>
>   The normal vtk script that I have written for the velocity glyph for a
> particular data-set is :
>
>       import vtk
>
>       reader = vtk.vtkXMLUnstructuredGridReader()
>       reader.SetFileName("fire_ug.vtu")
>       reader.Update()
>
>       arrow = vtk.vtkArrowSource()
>
>       glyph = vtk.vtkGlyph3D()
>       glyph.SetInput(reader.GetOutput())
>       glyph.SetSource(arrow.GetOutput())
>       glyph.SetVectorModeToUseVector()
>       glyph.SetScaleModeToScaleByVector()
>       glyph.SetScaleFactor(0.1)
>

This seems to be a typo/bug in the configuration file. Someone called the
property SetScaleFactor instead of ScaleFactor. Try SetSetScaleFactor().

-berk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/paraview/attachments/20070618/7816184f/attachment-0001.html


More information about the ParaView mailing list