[vtkusers] VTK and SWIG

David Gobbi david.gobbi at gmail.com
Mon May 23 18:05:02 EDT 2011


Hi Wayne,

The the "__this__" mechanism is, indeed, based off an old version of
SWIG. I've been aware of this issue for a while, but have resisted the
temptation to "fix" the code because I don't use swig anymore and any
fixes that I attempt would probably make the situation worse.

If you could supply a (tested) patch, I will gladly review it and
apply it to the VTK development head.

 - David


On Mon, May 23, 2011 at 3:33 PM, Wayne Christopher <wayne at 4raccoons.com> wrote:
> I have a python vtkPolyData object that I would like to pass to a swigged
> C++ routine, which takes a vtkPolyData* as an argument.
>
> Based on the discussion in
> http://www.vtk.org/pipermail/vtkusers/2003-October/070054.html, I tried
> passing in mypolydata.__this__.  This value seems to be a string like
> '_0000000006ffe330_p_vtkPolyData'.  However, my swig wrapper fails with
>
> TypeError: in method 'MyClass_MyMethod', argument 2 of type 'vtkPolyData *'
>
> When I look at other swig pointers, they all seem to be of the form
>
> <Swig Object of type 'MyClass *' at 0x5e5c420>
>
> Is this a sign that the vtk __this__ mechanism works only with an older swig
> version?  Is there a workaround?  (Other than passing in the actual pointer
> as an integer and casting it to a vtkPolyData* ?)
>
> Thanks,
>
>    Wayne



More information about the vtkusers mailing list