[vtkusers] Tcl_HashTable vtkInstanceLookup?

kitware-vtk at kulnet.kuleuven.ac.be kitware-vtk at kulnet.kuleuven.ac.be
Thu Aug 23 08:53:39 EDT 2001


---  Forwarded by news2mail for vtkEditor <vtkedit at esat.kuleuven.ac.be> ---

Hi,

I want to do the following: make vtk objects from within a tcl-script
and access those vtk objects from a shared library written in C++ which
is loaded into tcl.
My question: How can i get a pointer to the vtk object which is
associated with a name in tcl.
Example: In tcl i do: "vtkSphere sphere". Now i want to get a pointer to
the vtkSphere object named "sphere".
I used to do the following:
In my C++ library i declare: "extern Tcl_HashTable vtkInstanceLookup;"
And to get a pointer to a tcl named object, i did:

    Tcl_HashEntry *entry =
Tcl_FindHashEntry(&vtkInstanceLookup,"sphere");
    if (entry == NULL)
{
        Tcl_AppendResult(interp, "no object named \"sphere\"", (char *)
NULL);
        return TCL_ERROR;
    }
    vtkActor *actor = (vtkActor *)Tcl_GetHashValue(entry);

But with vtk3.2 this doesn't work anymore. Can someone tell me what the
correct way is for doing this?

Thanx,
-- 
vtkEditor
email: vtkedit at esat.kuleuven.ac.be
site: http://www.esat.kuleuven.ac.be/~vtkedit




More information about the vtkusers mailing list