[vtkusers] Help with tcl interpreter

Johanna pettersson.johanna at home.se
Wed Jul 30 02:33:23 EDT 2003


Hi and thank you all for helping me out.

Since my tcl script run ok when running it by itself I could not understand why it did not work when running it with the interp. The problem was that it could not find my vtk stuff. 

By using Tcl_Main instead of creating my own interpreter, and by explicitly telling which vtk libraries to use in the tcl script I got it to work.

Thank you again.
Sincerely
Johanna

-----Original Message-----
From: "leonid" <tazin at iec.co.il>
To: "Johanna" <pettersson.johanna at home.se>
Date: Wed, 30 Jul 2003 08:47:51 +0300
Subject: Re: [vtkusers] Help with tcl interpreter

Hi Joanna
You may write
eval=Tcl_Eval(tclinterp,"package require vtk");
eval=Tcl_Eval(tclinterp,"package require vtkinteraction");
and if you correct install vtk tcl (you may check this by run tests for tcl)
after this you have
full access to vtk tcl commands from C++ progamm
Leonid
----- Original Message -----
From: Johanna <pettersson.johanna at home.se>
To: <vtkusers at vtk.org>
Sent: éåí ùìéùé 29 éåìé 2003 16:52
Subject: RE: [vtkusers] Help with tcl interpreter


> This is part of my code and the result:
>
> Code:
>   Tcl_Interp *tclinterp;
>   tclinterp = Tcl_CreateInterp();
>
>   eval=Tcl_GlobalEval(tclinterp,"info library");
>
>   if (tclinterp->result != 0) {
>     printf("Test [%s]\n", tclinterp->result);
>   }
>
>   if (eval==TCL_ERROR) {
>     printf("eval=[%d]\n", eval);
>     return TCL_ERROR;
>   }
>
> Result/Output:
>   Test [no library has been specified for Tcl]
>
> So I guess my libraries are not loaded ok. However I still get a TCL_ERROR
from Tcl_GlobalEval so it seems that not even the line
'Tcl_GlobalEval(tclinterp,"info library")' is ok.
>
> I tried to do 'Tcl_EvalFile(tclinterp, "/usr/lib/tcl8.3/init.tcl")' but
since all Tcl_EvalFile, Tcl_GlobalEval etc generates a TCL_ERROR I do not
think it worked.
>
> /Johanna
>
> -----Original Message-----
> From: "shahid" <shahed at isb.paknet.com.pk>
> To: <vtkusers at vtk.org>
> Date: Tue, 29 Jul 2003 17:24:38 +0500
> Subject: RE: [vtkusers] Help with tcl interpreter
>
>
> You probably need to first check that you Interp process is initialized
> properly
> code=Tcl_Eval(tclinterp,"info library"); # returned path must include path
> to vtk files
>                                                #else "package require vtk"
> shall fail
> doing
> Tcl_EvalFile(tclinterp, "your_tcllibpath/init.tcl"); # may help to
> initialize the interpreter properly
>
> Hope this shall solve your problem.
>
> shahed
>
> -----Original Message-----
> From: vtkusers-admin at vtk.org [mailto:vtkusers-admin at vtk.org]On Behalf Of
> Johanna
> Sent: Tuesday, July 29, 2003 12:38 PM
> To: vtkusers at vtk.org
> Subject: [vtkusers] Help with tcl interpreter
>
>
> Hello
>
> I am trying to use Tcl_Interp and Tcl_EvalFile to evaluate a tcl script
from
> a c++ file. My code looks like this:
>
> Tcl_Interp *tclinterp;
> tclinterp = Tcl_CreateInterp();
>
> int code = Tcl_EvalFile(tclinterp, "myTclScript.tcl");
>
> if (code!=TCL_OK) {
>   return TCL_ERROR;
> }
>
> The problem is that Tcl_EvalFile is never TCL_OK and always returns an
> error, i.e. myTclScript.tcl can not be evaluated. When my tcl script has
> been run by the interpreter I would like to access some actors generated
in
> the tcl script.
>
> Does anyone have any experience on this and can see what I am doing wrong?
>
> Sincerely
> Johanna
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
****************************************************************************
********
> This footnote confirms that this email message has been scanned by
> PineApp Mail-SeCure for the presence of malicious code, vandals & computer
viruses.
>
****************************************************************************
********
>
>


Check the FAQ at:
<htt




More information about the vtkusers mailing list