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

Евгения Маликова e_mal at inbox.ru
Sun Feb 5 14:38:42 EST 2017

Thank you very much.
It worked.

Best regards,

>Воскресенье,  5 февраля 2017, 21:10 +03:00 от David Gobbi <david.gobbi at gmail.com>:
>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  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:
>>>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 {
>>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() VTK_OVERRIDE;
>>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,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170205/51e377d7/attachment.html>

More information about the vtkusers mailing list