[vtkusers] Writing compatible python wrappers for own software
Mark Asbach
Mark.Asbach at post.rwth-aachen.de
Fri Sep 5 04:46:09 EDT 2003
Hi list,
I'm quite new to the python world and therefore my
question might be basic, but I couldn't find an easy
answer to it:
Currently, I'm working on a backend for an existing
Finite-Element Solver that has its own embedded
python interpreter and interface. I'd like to add
visualization with vtk classes and did so - but only
on the C++ side. To the day, I can only extend the
existing python interface methods and build my
vizualization pipeline on the 'inside', but I'd like
to transfer more power to the python user.
What I need now, is a hint on how to pass vtk
objects to the python side so that I can use them
with the vtk python wrappers later on.
As an example, I've got a class that builds an array
of vtkUnstructuredGrid datastructures. It's C++
methods include something like:
vtkUnstructuredGrid * GetDataSourcePointer(int i);
Can I just use SWIG to wrap that call into python
and then use the return value for
SomeVtkFilter.SetInput(x.GetDataSourcePointer(0)) or
what do I need to do instead? Especially, what is
necessary to ensure correct reference counting for
the vtk smart pointers?
Thanks in advance,
Mark
More information about the vtkusers
mailing list