[vtkusers] Build vtk classes - HELP!!!
Andrew Dolgert
ajd27 at cornell.edu
Tue Jan 13 16:59:48 EST 2004
Yi-Yu,
You've done the hard part by compiling and getting VTK running under
Python. Python can't find the member variable inData because public
member variables are not automatically wrapped when making python
wrappers. You have to add gettor and settor member functions to your
class:
class ...
{
public:
int GetInData() { return this->inData; }
void SetInData(int val) { this->inData = val; }
};
The VTK framework provides a shorthand for this in two macros, so you
could, alternatively, add
class ...
{
public:
vtkSetMacro(inData,int);
vtkGetMacro(inData,int);
};
This latter style is the recommended way to proceed in VTK in order to
make wrapping work correctly. The macros are defined in vtkSetGet.h.
Drew
More information about the vtkusers
mailing list