A restricted COM wrapper for vtk 3.1
This is a partial implementation of a COM (Ole) wrapper for the C++ classes of the vtk visualization library . It is intended primarily for use with Visual Basic 6/VBA. Some stuff is still missing and some functions are not working as expected.
The wrapper code tries to imitate the C++ version like the Tcl/Tk wrapper does. Because of naming conflicts, I have renamed the vtk classes so the names are beginning with cvtk instead of vtk . If you have a look at the VB translation of the Visquad.cxx example from the vtk distribution, you can see that for example:
C++ : vtkRenderWindow* renwin = vtkRenderMaster::New()
VB : Dim renwin As New cvtkRenderWindow
For seasoned VB programmers, there should be little trouble with the coding conventions but remember always to use the Set keyword to assign an object to a variable:
Dim contpoly As cvtkPolyData: Set contpoly = contours.GetOutput
VB will not complain if you forget this, but the results may not be as expected.
1) As COM as well as VB doesn't know anything about function overloading, multiple function names are identified by appending big O's to the original function names.
2) Functions returning a pointer to an array (in C++) will only return the first entry in VB as you can not assign an array to a function return value. As there is (nearly always) an overloaded variant of the function that takes an array as an argument, this is not a severe limitation. For example instead of
Dim bounds(1 to 6) as Single
bounds = cvtkFloatPoints.GetBounds
3) The wrapper has only been tested with VB6.
I always wanted to have some quick and nice visualization method for data in
Microsoft-Excel spreadsheets. As Basic is the most natural way to go, I had to bite the
bullet. An example is shown here.
If do not plan to do any work on the COM wrapper since I have switched to Visual J++ for my own visualization purposes. VJ++ works fine with the vtk Java wrapping code. If you need a more complete COM wrapper for vtk, you should go to http://www.principiamathematica.com.
Last change: 11/30/00 by Karl M. Syring