Tcl-related question on data access

Miller, James V (CRD) millerjv at crd.ge.com
Mon Aug 23 14:16:01 EDT 1999


Take a look at common/vtkTclUtil.cxx.  There are two routines vtkTclGetPointerFromObject() and
vtkTclGetObjectFromPointer() that can be used map/unmap Tcl names and C++ pointers. I am assuming
what you want is to pass in the name of a vtkObject that was created in Tcl and get the corresponding
C++ pointer.  If so, this will do the trick.  Just be careful of reference counting issues.





-----Original Message-----
From: Kenneth Wang [mailto:kenwang at leland.Stanford.EDU]
Sent: Monday, August 23, 1999 1:46 PM
To: vtkusers at gsao.gso.med.ge.com
Subject: Tcl-related question on data access


Hi,

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?

Thanks,
Ken Wang




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


-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------


-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list