[vtkusers] direct memory access from Tcl

hhiraki at lab.nig.ac.jp hhiraki at lab.nig.ac.jp
Mon Jan 5 23:07:11 EST 2004


If you need the memory address of a VTK object in Tcl, a work-around 
is the object inspection facilities of VTK (vtkObjectBase::Print).
For example,
  package require vtk
  proc vtk2address {obj} {
      if [regexp -- {^(vtk[^ ]+) \(([^)]+)\)} [$obj Print] mchd clsnam addr] {
          return $addr
      }
      error "$obj isn't a vtk object"
  }
  vtkObject testobj
  puts [vtk2address testobj]

I wonder how will you use the address? 
The Python interface to VTK seems to provide more features than 
Tcl's. I guess you may find some of them are worth porting to Tcl.

Regards,

Hideaki Hiraki


On Tue, 6 Jan 2004, Erin McKay wrote:
> Hi All
> 
> I wonder if someone could enlighten me: the Tcl interface to VTK 
> (4.3 on OS X) seems to lack any methods that return memory addresses. 
> These methods would, I feel, be very useful for integrating VTK 
> into existing scripted applications (well, my scripted applications 
> anyhoo). I have read the reference manual and guide but cannot find 
> a description of the reasoning behind their exclusion. Are they really 
> not available? Is this likely to change? Is there a work-around? 
> 
> regards
> 
> Erin McKay
> Dept. Nuclear Medicine, St. George Hospital
> ph: +61 (0)2 9350 3112 ext: 3130



More information about the vtkusers mailing list