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

David Gobbi david.gobbi at gmail.com
Sun Feb 5 13:10:21 EST 2017


Hi Evgeniya,

Try renaming your class to vtkMyClass to see if that works.

 - David

On Sun, Feb 5, 2017 at 10:02 AM, Евгения Маликова via vtkusers <
vtkusers at vtk.org> wrote:

> * 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 <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/4738efc0/attachment.html>


More information about the vtkusers mailing list