• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-Mar-2015-

resources/H03-Mar-2015-6239

vtk/H03-Mar-2015-2317

vtkbase/H03-Mar-2015-10783

vtkinteraction/H03-Mar-2015-790482

vtktesting/H03-Mar-2015-542480

READMEH A D03-Mar-20154.9 KiB161108

module.cmakeH A D03-Mar-2015164 1110

pkgIndex.tcl.inH A D03-Mar-20152.1 KiB5551

vtkDetermineTkResources.cmakeH A D03-Mar-20151.4 KiB2726

vtkParaTkAppInit.cxxH A D03-Mar-2015648 172

vtkTcl.hH A D03-Mar-2015750 2910

vtkTclUtil.cxxH A D03-Mar-201524.6 KiB862703

vtkTclUtil.hH A D03-Mar-20153.6 KiB11984

vtkTk.hH A D03-Mar-2015746 2910

vtkTkAppInit.cxxH A D03-Mar-20157.7 KiB279168

vtkTkAppInitConfigure.h.inH A D03-Mar-2015495 1912

vtkmodule.tcl.inH A D03-Mar-2015961 2119

vtktcl.cH A D03-Mar-20153 KiB138104

README

1VTK Tcl wrappers
2===========================================================================
3
4  I) Invoking the VTK package(s)
5 II) Invoking additional packages
6III) Installing the packages
7
8
9
10=============================
11  I) Invoking the VTK Tcl package(s)
12
13Load the whole VTK API by issuing the following line before any
14invocation of a VTK command (typically at the top of your Tcl script):
15
16        package require vtk
17
18This will load all VTK components and the corresponding
19commands. Depending on how VTK was built, some components might not be
20available (since Hybrid, Parallel, and Rendering can be
21excluded).
22
23VTK may also be used on a component-by-component basis by requiring
24the component explicitly. Example:
25
26        package require vtkrendering
27
28The above line will resolve the dependencies and invoke (in that case)
29the vtkgraphics and vtkimaging packages automatically (which will
30trigger the vtkfiltering and vtkcommon packages too). This method can
31be used to speed-up startup-time since only the required commands will
32be loaded.
33
34
35
36=============================
37 II) Invoking additional packages
38
39
40A) vtkinteraction
41**************
42
43The vtkinteraction package can be loaded to provide additional
44interaction support.
45
46        package require vtkinteraction
47
48i) Tcl interactor:
49
50The vtkinteraction package creates a generic Tcl interactor inside a
51console widget, allowing you to issue any Tcl commands while running
52the script. Once the package is loaded, a hidden .vtkInteract widget
53is created. Bind a key or set the user method of your
54vtkRenderWindowInteractor to deiconify that widget:
55
56        vtkRenderWindowInteractor iren
57            [...]
58            iren SetUserMethod {wm deiconify .vtkInteract}
59
60Example: see Examples/GUI/Tcl/Mace.Tcl.
61
62
63ii) 'vtkTkRenderWidget bindings':
64
65The vtkinteraction package also brings a set of user-interaction
66bindings for the vtkTkRenderWidget class. It allows you to use this Tk
67widget in a way similar to the usual VTK interactor. Once the package
68is loaded, call ::vtk::bind_tk_render_widget to associate the bindings
69to the render widget:
70
71        set ren [vtkTkRenderWidget .ren -width 300 -height 300 -rw renWin]
72        ::vtk::bind_tk_render_widget $ren
73
74Example: see Examples/GUI/Tcl/MaceTk.Tcl.
75
76
77B) vtktesting
78*************
79
80Some developpers might load the vtktesting package to include
81additional facilities.
82
83        package require vtktesting
84
85Once loaded, the package provides the functions usually located in the following files:
86
87        backdrop.tcl
88        colors.tcl
89        mccases.tcl
90
91
92
93=============================
94 IV) Installing the package index file
95
96A good description of the package and library facilities is given in
97the Chapter 12 "Script, Libraries and Packages" (page 135) of
98"Practical Programming in Tcl & Tk", Brent B. Welch, ISBN
990-13-616830-2.
100
101When a package is "required" by the 'package' command (see part I to
102III), the Tcl interpreter looks through a set of directories and their
103subdirectories for pkgIndex.tcl files. It sources those to build an
104internal database of packages (and version information).
105
106A pkgIndex.tcl file is generated by this VTK distribution to provide
107the packages described in the previous sections to the
108interpreter. They will load the corresponding DLLs, set some default
109behaviours/bindings/widgets and exit with an error message if the
110package could not be provided (DLL not found, for example).
111
112The package facility assume that Tcl libraries (and packages) are kept
113in well-known directories (and their subdirectories). The list of
114well-known directories is kept in the auto_path Tcl variable. It is
115initialized by tclsh or wish to provide default directories, including
116the default Tcl script library directory. For example :
117
118Windows:
119--------
120
121% puts $auto_path
122C:/devel/langages/tcl/8.3/lib/tcl8.3 C:/devel/langages/tcl/8.3/lib C:/devel/langages/tcl/8.3/lib/tk8.3
123
124Linux/Unix:
125--------
126
127root [1003] ~/tmp# wish
128% puts $auto_path
129/usr/lib/tcl8.3 /usr/lib /usr/lib/tk8.3
130
131Now let's see how we can make Tcl aware of the VTK Tcl packages. Tcl
132provides a way for you to tell the Tcl interpreter to search for
133pkgIndex.tcl files in any user-specified directory (and its
134subdirectories). Just set the TCLLIBPATH environment variable to a set
135of space-separated directories to search in (warning: Windows users
136shall use '/' instead of '\').
137
138If you have a VTK build tree on your hard disk, add Wrapping/Tcl to
139TCLLIBPATH.  For example:
140
141Windows:
142--------
143
144TCLLIBPATH=C:/Project/VTK-msvc6/Wrapping/Tcl/Debug
145
146Now check auto_path :
147
148% puts $auto_path
149C:/Project/VTK-msvc6/Wrapping/Tcl/Debug C:/devel/langages/tcl/8.3/lib/tcl8.3 C:/devel/langages/tcl/8.3/lib C:/devel/langages/tcl/8.3/lib/tk8.3
150
151Linux/Unix:
152--------
153
154root [1011] ~/tmp# export TCLLIBPATH=/home/myuser/VTK-gcc/Wrapping/Tcl
155root [1012] ~/tmp# wish
156% puts $auto_path
157/home/myuser/VTK-gcc/Wrapping/Tcl /usr/lib/tcl8.3 /usr/lib /usr/lib/tk8.3
158
159This shall do the trick :))
160Sebastien BARRE (sebastien.barre@kitware.com)
161