[vtkusers] FW: passing vtk tcl instances to C? I found something...

Sven Prevrhal sven.prevrhal at oarg.ucsf.edu
Tue Apr 17 21:19:52 EDT 2001


Hi,

Maybe you can confirm this answer to my original question (see below).
Basically, I need
	Tcl_CmdInfo  info;
	Tcl_GetCommandInfo(interp,$source->bytes,&info);
	(vtkObject *)(((vtkTclCommandArgStruct *)(info.clientData))->Pointer);
to gain access to the object. Is that correct?

Just if somebody is interested, a SWIG typemap would look like this:

%module vtkexample
%{
#include "vtkObject.h"
#include "vtkTclUtil.h"
#include "vtkSystemIncludes.h"
#include "vtkObject.h"
%}

%typemap(tcl8,in) vtkObject * {
	Tcl_CmdInfo  info;
	Tcl_GetCommandInfo(interp,$source->bytes,&info);
	$target = (vtkObject *)(((vtkTclCommandArgStruct
*)(info.clientData))->Pointer);
}

Now one could "straight-aheadedly" SWIG-wrap a function with a vtkObject arg
or any derived class, e.g.

const char *foo (vtkObject *o) {
	return o->GetClassName();
}

Am I right?

Sven

-----Original Message-----
From: Sven Prevrhal [mailto:sven.prevrhal at oarg.ucsf.edu]
Sent: Tuesday, April 17, 2001 5:00 PM
To: Vtk Mailing List
Subject: passing vtk tcl instances to C?


Hi everybody,

I'd like to use vtk mainly in Tcl/Tk, but some time-critical stuff needs to
be implemented in C. How can I pass a vtk command instance from Tcl to C?

E.g., I have
tcl> vtkScalars s

Now I want to access this s in C.

Any help highly appreciated!

Thanks
Sven







More information about the vtkusers mailing list