[vtkusers] python wrap of stand alone vtk lib

Eric E. Monson emonson at cs.duke.edu
Mon Mar 15 15:13:26 EDT 2010


Hey Dean,

I don't know a huge amount about this, but as I've been developing my own classes, I've been using the structure and instructions in [vtk_src]/Examples/Build/vtkMy. I just did what it says in the README and copied the directory structure to another out-of-source spot, and with the CMake files already provided my classes automatically get wrapped using VTK's system. 

On the install & load side, I'm sure there's a better way in the end, but for testing out my classes as I'm going, I use the Python wrappers and load the classes like this:

import vtk
import sys
sys.path.append("/Users/emonson/Programming/VTK_cvs/vtkVTG/build/bin")
import libvtkvtgFilteringPython as vtgF

where that append() call points to my compiled & wrapped library directory, and then I can just instantiate my class (which exists in that libvtkvtgFilteringPython) like:

bs = vtgF.vtkBezierSurfaceSource()

and it works great.

Hopefully others will have more "proper" advice on the install side, but using what the developers have provided in the vtkMy directory works well on the compilation/wrapping end.

Talk to you later,
-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group


On Mar 15, 2010, at 2:48 PM, Dean Inglis wrote:

> Hi all,
> 
> I am somewhat new to python and am trying to do python wrapping
> of a stand alone c++ library that extends vtk.  Ive seen swig in quite a few threads but have no idea how to set this up with
> cmake and my library.  Can anyone provide a few links or
> pointers to get me started?  Ultimately id like to be able to have
> in a py script;
> 
> import vtk
> import mykit
> 
> def someExample():
> # initialize stuff
> widget = vtkMyKitWidget()
> # use the widget
> 
> Dean
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list