Tcl-related question on data access

Kenneth Wang kenwang at leland.Stanford.EDU
Mon Aug 23 13:46:16 EDT 1999


I'd like to ask a question about connecting vtk data to other
software.  Here's my situation: I use vtk pretty extensively for
visualizing and processing data.  Like almost all of us, I also work
on other stuff which both uses and produces that data.  What I want to
be able to do is to take vtkDataSet objects that are produced by my
vtk scripts and get access to data contained therein directly from
other C++ code.  However, since I use vtk largely from Tcl, I'm not
sure how to do this in-core.

What I currently do is to use files for intermediate communication.
Inside an executable which links vtk as well as other modules under
the same Tcl interpreter, I write a data file from a vtk script, then
inside C++ use a vtk reader to reconstruct the object.  But, this is
clearly a big hack, is inefficient, and generally pollutes my file
space, especially as the number of objects goes up.

What I'd like to do is to access the Tcl hashtable which I'm guessing
the Tcl wrapping mechanism produces and manages, such that I can take
an interpreter-level object name and get back a C++ pointer to a vtk
object.  So my questions are:

  1. Does vtk use such a hashtable?

  2. How can I get access to that table?

  3. Can I use interpreter-level names as produced by vtk
     (e.g. vtkTemp33) to look up entries in this table?

  4. When do temporary / intermediate vtk objects (i.e. vtkTempXX) get
     created and when are they destroyed?

Ken Wang

Kenneth C. Wang			E-mail: kenwang at
Electrical Engineering Dept.	Voice:  (650) 725-0458
Stanford University		Fax:    (650) 725-7731
CIS 214, Stanford, CA 94305	Web:

This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.

More information about the vtkusers mailing list