[vtkusers] vtkDoubleArray and python problem

Robert Ellis Parrott parrott at fas.harvard.edu
Wed Jan 16 14:05:03 EST 2002


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)






More information about the vtkusers mailing list