[vtkusers] vtkDoubleArray and python problem

Berk Geveci berkgeveci at hotmail.com
Wed Jan 16 15:48:29 EST 2002


Since vtkDataArray::InsertNextTuple() takes a pointer to an array
for which the number of elements is not know at compile time, it
can not be wrapped into Python.
You should use InsertNextTupleN() where N is the number of components
(and can be 1, 2, 3, 4 or 9) instead.

-Berk

>From: Robert Ellis Parrott <parrott at fas.harvard.edu>
>To: <vtkusers at public.kitware.com>
>Subject: [vtkusers] vtkDoubleArray and python problem
>Date: Wed, 16 Jan 2002 14:05:03 -0500 (EST)
>
>Hi folks,
>
>I'm trying to use VTK 4.0 to visualize some phase space info in python
>2.2; this is on linux.
>
>I'm trying to load coordinates and velocities into VTK data type,
>vtkDoubleArray.I can load position coordinates into a vtkPoints object,
>and scalar values into a vtkDoubleArray via SetValue(i,float) type of
>method.
>
>However, I can't (or don't know how to, perhaps) load 3 element arrays
>like position or velocity into a vtkDoubleArray.
>
>Looking though the man pages, there are methods like SetTuple(..) etc.,
>but for most of these I get:
>
> >>> pts = vtkDoubleArray()
> >>> pts.SetNumberOfTuples(5)
> >>> dum = pts.InsertNextTuple([1.0,1.0,1.0])
>Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>AttributeError: InsertNextTuple
> >>> dum = pts.SetTuple(1, [1.0, 1.0, 1.0])
>Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>AttributeError: SetTuple
>
>After doing a "nm libvtkCommonPython.so | grep DoubleArray" it seems as
>if these aren't even methods.
>
>How does one enter componenet data into a vtkDoubleArray in python? I need
>to associate a velocity with a position (visualize a vector field), and
>this seems the only way.
>
>thanx in advance,
>rob
>
>  ----------------------------
>Robert E. Parrott
>Department of Physics
>429 Lyman Laboratory
>Harvard University
>Cambridge, Massachusetts 02138
>(617)-496-4013
>parrott at fas.harvard.edu
>Robert.E.Parrott.96 at alum.dartmouth.org (permanent)
>
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers





_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com




More information about the vtkusers mailing list