<div dir="ltr">The <span style="font-family:Tahoma;font-size:13px">vtkUnstructuredGridReader has a lot of legacy behavior associated with it. It was developed 20 years ago when the VTK API was significantly different. Some of that behavior stayed to preserve compatibility over time. The XML readers don't have that problem. Note that they have an API to control which variables to read all. But it is the newer API which is array name based and the default is to read all arrays.</span><div>
<span style="font-family:Tahoma;font-size:13px"><br></span></div><div><span style="font-family:Tahoma;font-size:13px">Best,</span></div><div><span style="font-family:Tahoma;font-size:13px">-berk</span></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, May 9, 2013 at 8:04 PM, Justin Pogacnik <span dir="ltr"><<a href="mailto:j.pogacnik@auckland.ac.nz" target="_blank">j.pogacnik@auckland.ac.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Works like a charm Berk!
<div><br>
</div>
<div>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?</div>
<div><br>
</div>
<div>Thanks for your help!</div>
<div><br>
</div>
<div>Justin<br>
<div style="font-size:16px;font-family:Times New Roman">
<hr>
<div style="direction:ltr"><font face="Tahoma" color="#000000"><b>From:</b> Berk Geveci [<a href="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a>]<br>
<b>Sent:</b> Friday, May 10, 2013 11:42 AM<br>
<b>To:</b> Justin Pogacnik<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Subject:</b> Re: [vtkusers] Point data with vtkUnstructuredGridReader<br>
</font><br>
</div><div><div class="h5">
<div></div>
<div>
<div dir="ltr">You need something like:
<div><br>
</div>
<div>
<div> reader->ReadAllScalarsOn();</div>
<div> reader->ReadAllVectorsOn();</div>
<div> reader->ReadAllNormalsOn();</div>
<div> reader->ReadAllTensorsOn();</div>
<div> reader->ReadAllColorScalarsOn();</div>
<div> reader->ReadAllTCoordsOn();</div>
<div> reader->ReadAllFieldsOn();</div>
<div><br>
</div>
<div>Translate to Python and adjust to taste.</div>
<div> </div>
</div>
<div>-berk</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Wed, May 8, 2013 at 9:37 PM, Justin Pogacnik <span dir="ltr">
<<a href="mailto:j.pogacnik@auckland.ac.nz" target="_blank">j.pogacnik@auckland.ac.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Hi all,
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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). </div>
<div><br>
</div>
<div>Here is the essential part of my python script:</div>
<div>
<div>from vtk import *</div>
<div><br>
</div>
<div>filename = 'VTKoutput/FEHM_mesh4_2.vtk'</div>
<div><br>
</div>
<div>vtkgrid = vtkUnstructuredGridReader()</div>
<div>name = vtkgrid.SetFileName(filename)</div>
<div>vtkgrid.Update()</div>
<div><br>
</div>
<div>print vtkgrid.GetOutput().GetPointData()</div>
</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Thanks in advance,</div>
<div><br>
</div>
<div>Justin</div>
</div>
</div>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div></div></div>
</div>
</div>
</div>
</blockquote></div><br></div>