Wrapping class that uses VTK

92 views
Skip to first unread message

Marcel

unread,
Nov 24, 2010, 2:56:28 AM11/24/10
to cython-users
Hello,

I am working on a C++ project that uses VTK in its interface, i.e. we
need to be able to pass VTK objects.
We want to provide Python wrappers for this project, and I am
currently investigating whether this is feasible with Cython.

VTK already comes with its own wrapping, and I would not want to redo
the work and wrapping VTK again.
I know that with SWIG it is possible to reuse the VTK wrappers, by
using PyObject* as the argument to the method and
then casting it to the corresponding VTK object:

void SomeFunction( PyObject *object ) {
vtkPolydata *pd = (vtkPolydata*) vtkPythonGetPointerFromObject(object,
"vtkPolydata" );
// work with polydata
}

and then call this function from Python as
pd = vtk.vtkPolyData()
SomeFunction(pd)


I could not figure out how to do something similar with Cython. Has
anybody experience with such task, or can point me to an example?

Thanks in advance and best regards,

Marcel
Reply all
Reply to author
Forward
0 new messages