[vtkusers] downcasting in python wrappers in VTK 4.2.2

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Mon Jun 30 23:25:59 EDT 2003


>>>>> "JB" == Justin Binns <binns at mcs.anl.gov> writes:

    JB> I'm having a problem in VTK 4.2.2 - it appears the behavior of
    JB> the python wrappers is different between a windows build and a
    JB> linux build, with the Windows build behavior being 'correct'
    JB> (seemingly).  To set the stage, these are both from the same
    JB> tarball, from the latest stable release of VTK (4.2.2).

[snip]

    JB> Notice: the object type of the GetOutput() is a generic
    JB> DataSet, and the output from the GetPointData() is a
    JB> completely useless vtkObject.  Even after an Update() (and it
    JB> has noticably read the file), the objects are the same generic
    JB> types.  It appears that under Linux, the object isn't being
    JB> cast back to it's appropriate type before return, while under
    JB> windows, it is.

This is wierd.  Does this happen when using Tcl and C++ also?  I doubt
that is has something to do with the sources but perhaps something is
wrong with your build?  You said that the right libraries are found,
are you sure?  Do you have multiple copies of the VTK libraries
floating around on the system?  Does ldd show you the right libraries?

    JB> Any thoughts on how I might fix this?  Which sources to look
    JB> in?  Is this already fixed in CVS?  Thanks much!

FWIW, with VTK CVS the following works:

In [2]: r = vtk.vtkXMLUnstructuredGridReader ()

In [3]: r.SetFileName("/tmp/vtkbin.vtu")

In [4]: r.GetOutput()
Out[4]: <libvtkCommonPython.vtkUnstructuredGrid vtkobject at 0x83c4a90>

In [5]: r.GetOutput().GetPointData()
Out[5]: <libvtkCommonPython.vtkPointData vtkobject at 0x83c4b68>

cheers,
prabhu



More information about the vtkusers mailing list