[vtkusers] C++ pointers into Python

David Gobbi dgobbi at irus.rri.ca
Mon Dec 10 13:13:49 EST 2001


Hi Carl,

Methods that use pass-by-reference aren't wrapped (except where the
the parameter being passed is a vtkObject).  The main reason for this
is that python itself treats references to most basic types (int, float,
etc) as const.  As a result there is no way to wrap these methods in an
obvious way, i.e. even if they were wrapped, a Python programmer would
have a tough time figuring out exactly how to use them.

If your cell array is part of a vtkPolyData (or any vtkDataSet) then
you can use one of these two vtkPolyData methods instead:
   vtkCell *GetCell(int cellId);
   void GetCell(int cellId, vtkGenericCell *cell);

 - David

--
  David Gobbi, MSc                       dgobbi at irus.rri.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario

On Mon, 10 Dec 2001, Carl Hetherington wrote:

> Hi,
>
> Apologies in advance, I am a VTK newbie of two days and a Python newbie of
> an afternoon!
>
> I'd like to call (for example) the function
>
> int vtkCellArray::GetNextCell(int &npts, int *&pts)
>
> from a Python program, so that Python has npts and pts available.  How can
> I go about doing this?
>
> Thanks,
>
> Carl





More information about the vtkusers mailing list