[vtkusers] vtkParametricFunction sub-classes in Python
David Gobbi
david.gobbi at gmail.com
Mon Aug 29 10:31:00 EDT 2016
Hi Jack,
Virtual method hooks aren't implemented in the VTK python wrappers,
so a Python subclass of an abstract VTK class is still abstract. It's one
of the many improvements I'd add to the Python wrappers if I had the
time (my current wrapper improvement project is to update the VTK
wrapper hint system).
- David
On Mon, Aug 29, 2016 at 8:03 AM, Jack Zentner <jack.zentner at gmail.com>
wrote:
> All,
>
> I've been playing around with some parametric geometry in Python and I
> wanted to use VTK to visualize the surfaces that I'm creating. It seems
> that extending the vtkParametricFunction class and using it with the
> vtkParametricFunctionSource should work great. However I can't seem to get
> this to work from Python.
>
> Per Andrew Maclean's instructions in the "Parametric Equations for
> Surfaces"
> pdf, I've created my geometry class by inheriting from
> vtkParametricFunction
> and implemented the Evaluate, EvaluateScalar and GetDimension methods. The
> problem comes when I try to instantiate my new vtkParametricFunction
> object,
> I get the following error:
>
> TypeError: this is an abstract class and cannot be instantiated.
>
> I though maybe it was because I had not explicitly implemented the other
> virtual methods in the vtkParametricFunction interface. So I implemented
> all
> of those as well and I still get the same error. Then I tried to inherit
> from one of the C++ sub-classes of vtkParametricFunction and simply
> override
> the Evaluate, EvaluateSCalar and GetDimension methods. This works from an
> instantiation stand point but my overrides of Evaluate and the like are not
> being recognized.
>
> Am I missing something? Is it not possible to define vtkParametricFunction
> sub-classes in Python for use with a vtkParametricFunctionSource object?
>
> FYI, I'm using Python3.5 and the VTK 7.0 package from conda-forge.
>
>
> Thank you in advance,
>
> jack
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160829/961a11bd/attachment.html>
More information about the vtkusers
mailing list