On the other hand, is it possible to interact between bas file and tcl script, for example, in bas file, the information is passed to tcl
*tcl(SaveID Surface_Load *condID)
later on condID can be extracted from tcl to bas using the same way. This is my idea, I think it’s possible but i’m not able to find that in the Customization Manual
Example: In this example the *Tcl command is used to call a Tcl function defined in the problem type .tcl file. That function can receive a variable value as its argument with *variable. It is also possible to assign the returned value to a variable, but the Tcl procedure must return a numerical value.
In the .bas file:
*set var num=1
*tcl(WriteSurfaceInfo *num)
*set var num2=tcl(MultiplyByTwo *num)
As is explained you can assing the value returned by a *tcl procedure to a .bas variable, but it is limited to integer or real numbers, because .bas variables can’t store strings.
A trick to pass a string from Tcl to .bas is to set the value of an auxiliary ‘General data’ question (that can be hidden). It is possible to set the value from Tcl and ask this value with *gendata()
I could communicate between bas and tcl using a global variable in tcl, e.g. create a list variable in tcl and fill it in bas, then call it out from tcl in bas
So far this approach works well without problem. However, GiD may crash if the tcl variable is the same with some GiD internal variable. But it’s not likely.