[vtkusers] Accessing vtkPolyData scalars with Python

Forrest Sheng Bao forrest.bao at gmail.com
Wed Feb 15 11:45:32 EST 2012


I used python-vtk a while ago. So I am trying to help you using my dim
memory.

What's the data type of distanceArray?  I think it should be a python List.
If that's the case, you don't need GetTuple.

If you simple need to access data in VTK files, you can use pyvtk, which is
simpler. http://code.google.com/p/pyvtk/

Cheers, Forrest

On Wed, Feb 15, 2012 at 10:38 AM, bberkowi <benjamin-berkowitz at uiowa.edu>wrote:

> OK, so if anyone can just help in general, it doesn't have to be with
> Python
> syntax (but it would be helpful).  This is what I have so far, and it's not
> working:
>
>    distanceMapper.Surface.GetPointData().SetActiveScalars('Scalars_')
>    distanceArray = distanceMapper.Surface.GetPointData().GetScalars()
>
>    #print 'DISTANCE SURFACE:',  distanceMapper.Surface
>
>    print 'DISTANCE ARRAY:',  distanceArray
>    tuple = []
>    tuple = distanceArray.GetTuple(0)
>    print tuple
>
> and GetTuple() doesn't work.  It returns an error, "Traceback (most recent
> call last):
>  File "VTK_testing.py", line 80, in <module>
>    tuple = distanceArray.GetTuple(0)
> AttributeError: GetTuple"
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Accessing-vtkPolyData-scalars-with-Python-tp5470807p5486620.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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/20120215/02b9a507/attachment.htm>


More information about the vtkusers mailing list