[vtkusers] SafeDownCast in Python wrapper

David Gobbi david.gobbi at gmail.com
Sat Jun 7 15:36:30 EDT 2014


I can also add some info on this, with regards to your previous email.

Calling dir() on a VTK class does not list inherited methods.  A method
might exist, even if dir() does not show it.

The best way to get information about a wrapped method is to call help()
on the method:

  from vtk import *
  help(vtkXMLImageDataReader.SetInputString)

 - David


On Sat, Jun 7, 2014 at 1:20 PM, Sebastien Jourdain
<sebastien.jourdain at kitware.com> wrote:
> Hi Markus,
>
> In order to get access to those methods in Python you just need to import
> the module that define the classes that you care about.
> To figure our the import line look at the file "module.cmake" inside the
> directory of your C++ class definition.
> Then from the name of the module do something like that before getting a
> reference of that class.
>
> from {name}Python import *
>
> That's it!
>
> Seb
>
>
>
> On Fri, Jun 6, 2014 at 9:46 PM, Markus Fuger <markus.fuger at outlook.com>
> wrote:
>>
>> Hello,
>>
>> I don't actually want to do that - but because I did not get any answer to
>> post here:
>> http://www.vtk.org/pipermail/vtkusers/2014-May/084020.html
>> I ask another question because I think it might be the solution for my
>> initial problem.
>>
>> How to properly use the SafeDownCast Method with the Python wrapper to use
>> methods that should be inherited from a parent class? According to this
>> document (
>> https://github.com/Kitware/VTK/blob/master/Wrapping/Python/README_WRAP.txt )
>> it should not be needed - but in the same way I cannot access the
>> SetInputString method for vtkXMLStructuredDataReaders.
>>
>> Thanks in advance for your help!
>> Markus


More information about the vtkusers mailing list