[vtkusers] Re: vtk and python for large amout of data

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Mon Dec 9 22:23:32 EST 2002


>>>>> "MS" == Marcus Stojek <stojek at part-gmbh.de> writes:

[snip]

    MS> Although I think I did everything correct, there seems to be a
    MS> problem with NumberOfPoints(). With GetPoint(id) I get the
    MS> right coordinates for all Points, but still NumberOfPoints is
    MS> 1. Below you will find my small example code. Any idea?

[snip]

Nitpick: Indentation matters with Python code, so next time please
make sure your code sample is valid Python code. :)

        #points
        vpoints=vtkFloatArray()
        vpoints.SetNumberOfComponents(3)
        vpoints.SetVoidArray(narray,nnum,1)

This is wrong!  Even though you might get all the right values with
the GetTuple3 method.  You need to do this:

        vpoints.SetVoidArray(narray,len(narray),1)

i.e. give the *full* length of the array.  If you don't you will get
the wrong number of tuples (1) instead of the right (5) number and
hence incorrect number of points etc.

cheers,
prabhu



More information about the vtkusers mailing list