[vtkusers] How to include VTK packages in TCL/TK ?

Gregor Bruce gregorb at clear.net.nz
Mon Jun 16 16:19:04 EDT 2003


Marcio Antonio Mathias wrote:

>someone know a good recipe how to get VTK working
>properly using the ActiveState Tcl/Tk 8.x release,
>integrate to another packages, without having to
>recompile all the packages together?
>  
>

I have found that using the Tcl package load command on each of vtk's 
Tcl dll's seems to provide a working version of vtk that responds to 
"package require vtk".  I don't use the standard vtk directories 
however.  I place the vtk dll's in the tcl bin dir (which must be in the 
path) and the xxxTcl.dll files in  lib/vtk along with the following two 
files.  Part of the reasoning here is to ensure that I can do a package 
require in a safe interp (e.g. the tcl browser plugin).

# vtktcl.tcl
package require vtkCommonTCL 4.2
package require vtkFilteringTCL 4.2
package require vtkGraphicsTCL 4.2
package require vtkIOTCL 4.2
package require vtkImagingTCL 4.2
package require vtkRenderingTCL 4.2
package provide vtkrendering 4.2
package provide vtk 4.2


and

# pagIndex.tcl
package ifneeded vtkinteraction 4.2 [list source [file join $dir 
vtkinteraction.tcl]]
package ifneeded Vtktkimageviewerwidget 1.2 [list load [file join $dir 
vtkRenderingTCL.dll]]
package ifneeded Vtktkrenderwidget 1.2 [list load [file join $dir 
bin/vtkRenderingTCL.dll]]
package ifneeded vtkCommonTCL 4.2 [list load [file join $dir 
vtkCommonTCL.dll]]
package ifneeded vtkFilteringTCL 4.2 [list load [file join $dir 
vtkFilteringTCL.dll]]
package ifneeded vtkGraphicsTCL 4.2 [list load [file join $dir 
vtkGraphicsTCL.dll]]
package ifneeded vtkIOTCL 4.2 [list load [file join $dir vtkIOTCL.dll]]
package ifneeded vtkImagingTCL 4.2 [list load [file join $dir 
vtkImagingTCL.dll]]
package ifneeded vtkRenderingTCL 4.2 [list load [file join $dir 
vtkRenderingTCL.dll]]
package ifneeded vtkHybridTCL 4.2 [list load [file join $dir 
vtkHybridTCL.dll]]
package ifneeded vtk 4.2  [list source [file join $dir vtktcl.tcl]]


I have tested this with the cone and MaceTk examples (i.e. examples that 
don't require and VTK DATA).   For the record I am building all the 
binaries for this myself including Tcl (Tcl/Tk 8.4.2) but this should 
work with the active state Tcl distribution assuming that the version of 
vtk binaries is compatible.


Hope this helps
Gregor Bruce








More information about the vtkusers mailing list