[vtkusers] Point data with vtkUnstructuredGridReader

Berk Geveci berk.geveci at kitware.com
Thu May 9 19:42:01 EDT 2013


You need something like:

    reader->ReadAllScalarsOn();
    reader->ReadAllVectorsOn();
    reader->ReadAllNormalsOn();
    reader->ReadAllTensorsOn();
    reader->ReadAllColorScalarsOn();
    reader->ReadAllTCoordsOn();
    reader->ReadAllFieldsOn();

Translate to Python and adjust to taste.

-berk


On Wed, May 8, 2013 at 9:37 PM, Justin Pogacnik
<j.pogacnik at auckland.ac.nz>wrote:

>  Hi all,
>
>  I'm trying to use Python to read an unstructured grid file (vtk format)
> that I wrote for output from a research code. The vtk file loads fine in
> Paraview, so it should be in order.
>
>  The vtk file has 7 scalar arrays of point data and one vector array of
> point data. However, when I print the point data, only 2 arrays are found
> -- the first scalar array (elementID) and the last (only) vector array
> (permeability).
>
>  Here is the essential part of my python script:
>  from vtk import *
>
>  filename = 'VTKoutput/FEHM_mesh4_2.vtk'
>
>  vtkgrid = vtkUnstructuredGridReader()
> name = vtkgrid.SetFileName(filename)
> vtkgrid.Update()
>
>  print vtkgrid.GetOutput().GetPointData()
>
>  I'm happy to pass along the small test vtk file too if it'd be helpful.
> Also, I'm running vtk-5.10 on Mac OSX 10.7.5.
>
>  Thanks in advance,
>
>  Justin
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130509/599fea4a/attachment.htm>


More information about the vtkusers mailing list