[vtkusers] How to use GetTupleValue(i, array) in python?
David Gobbi
david.gobbi at gmail.com
Fri Dec 18 22:19:30 EST 2009
On Fri, Dec 18, 2009 at 7:51 PM, <lynx.abraxas at freenet.de> wrote:
> On 18/12/09 21:07:03, lynx.abraxas at freenet.de wrote:
>> for i in range(0, PointNormalArray.GetNumberOfTuples()):
>> PointNormalArray.GetTupleValue(i, pointNormal) #make sure pointNormal is big enough!
>>
>> And I get the python error "AttributeError: GetTupleValue".
>> So I wonder how do I have to this in python?
>
> With David D.'s advice I found GetTuple3(i) which works fine. Is that the correct function to use here?
Yup, the numbered GetTuple methods are the proper methods for getting
tuples from arrays in python.
Methods like "GetTupleValue(int i, double *tuple)" aren't wrapped in
python unless they have a signature like GetTupleValue(int i, double
tuple[3]) so that the wrappers know how large the array is.
Likewise, methods like "double *GetTuple(int i)" aren't wrapped
unless there is a hint so that the wrappers know how many values will
be returned.
The wrappers don't do anything fancy like check how many components an
array has in order to find out what size of tuple to use. The
wrapping of a method is determined only by the method signature and
the hints in VTK/Wrapping/hints.
David
More information about the vtkusers
mailing list