[vtkusers] Point data with vtkUnstructuredGridReader

Justin Pogacnik j.pogacnik at auckland.ac.nz
Thu May 9 20:04:50 EDT 2013


Works like a charm Berk!

Since yesterday, I've changed my original output to be xmlunstructured. Can you tell me why I don't need the reader.ReadAllScalarsOn() to catch all the arrays when the input file is xml, but I do need it in ascii?

Thanks for your help!

Justin
________________________________
From: Berk Geveci [berk.geveci at kitware.com]
Sent: Friday, May 10, 2013 11:42 AM
To: Justin Pogacnik
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] Point data with vtkUnstructuredGridReader

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<mailto: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<http://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/20130510/6c7c526b/attachment.htm>


More information about the vtkusers mailing list