[vtkusers] Loading Point Data using Python

Dan Barker dbpvusrlist at hotmail.co.uk
Fri Apr 20 07:05:10 EDT 2012


Dear All,
I have some data files which are written by our simulation they are .vtp format with point data. Each point has several properties such as "Density" or "Pressure" associated with it. I wish to load these files using a python script which I can then use to look at their properties and extract the results I'm interested in. I have successfully loaded the files and I can read the points positions' but I have no idea how to access the accompanying properties, could anybody suggest how to do this?
Currently to load the file I am doing the following;
reader = vtk.vtkXMLPolyDataReader()reader.SetFileName(file)reader.Update()data = reader.GetOutput()data.Update()
print(str(type(data)))  #outputs <type 'vtkobject'>
 for i in range(data.GetNumberOfPoints()):  p = data.GetPoints().GetPoint(i) #p is a tuple with the x,y & z coordinates.

Thanks,
Dan 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120420/3aed46ea/attachment.htm>


More information about the vtkusers mailing list