[vtkusers] pystrings

Prabhu Ramachandran prabhu_r at users.sf.net
Sat Apr 9 06:58:04 EDT 2005


>>>>> "RH" == rharder  <rharder at uiuc.edu> writes:

    RH> hi, I'm using PyString_FromStringAndSize to get c arrays into
    RH> python then vtk datasets.  Is there a way to do this that does
    RH> not generate a copy of the array as PyString_FromStringAndSize
    RH> does?

Use something like this:

 vtk_array.SetVoidArray(num_array_flat, len(num_array_flat), 0)

Then remember to save a reference to the numeric array if not you'll
get a nice segfault.

cheers,
prabhu



More information about the vtkusers mailing list