[vtkusers] Python extension module, working with VTK - how?

Vladimir Lazunin lazunin.v.aa at m.titech.ac.jp
Mon Apr 30 04:53:08 EDT 2007


Hello.

Is it possible to create a python extension module (*.pyd) that works with  
VTK functions and data?
Now, I have Python 2.5 and VTK 5.0.3. VTK Python wrappers are also  
installed and work fine.

I want to convert some of my C++ functions to make them accessible from  
Python. So, for example, I have:

void remove_cells(vtkPolyData *model, long *cells, long n)

I tried changing it into:

static PyObject * remove_cells(PyObject *self, PyObject *args)

Then, I found 'vtkPythonGetPointerFromObject' and 'PyArg_VTKParseTuple'  
functions in the "vtkPythonUtil.h" header, but can'r figure out how to use  
them. Could anyone give an example of getting arguments and returning  
results for such kind of C++ function?



More information about the vtkusers mailing list