[vtkusers] Python wrapping and furter use of a custom class derived from vtkImplicitFunction

Евгения Маликова e_mal at inbox.ru
Sun Feb 5 12:02:58 EST 2017


 Hi,
I am trying to wrap a custom class derived from vtkImplicitFunction in python. Wrapping was done with a similar to http://public.kitware.com/pipermail/vtkusers/2016-August/096019.html  CMakeLists.txt .All methods are accessed and work fine within python. But when I try to pass this class variable to vtkSampleFunction as ImplicitFunction, I receive an error:

>m=myClassPython.myClass()
>s=vtk.vtkSampleFunction()
>s.SetImplicitFunction(m) TypeError:SetImplicitFunction argument 1: methond requires a VTK Object.

I'm launching this code with vtkpython.exe.

.h file of wrapped class looks like:

class myClass : public vtkImplicitFunction {
public:
static myClass *New();
vtkTypeMacro(myClass, vtkImplicitFunction);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
vtkMTimeType GetMTime() VTK_OVERRIDE;
// Description
// Evaluate function
double EvaluateFunction(double x[3]) VTK_OVERRIDE;
double EvaluateFunction(double x, double y, double z) {
return this->vtkImplicitFunction::EvaluateFunction(x, y, z);
}
.....
myClass();
~myClass() VTK_OVERRIDE;
private:
myClass(const myClass&) VTK_DELETE_FUNCTION;
void operator=(const myClass&)VTK_DELETE_FUNCTION;
};
I don't have much experience in vtk to python wrapping and I guess there is something very simple, but I don't have any idea what it can be. Any help would be appreciated.
Thank you in advance,
Best regards,
Evgeniya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170205/c1cdebf1/attachment.html>


More information about the vtkusers mailing list