Dear GiD team,
We have a problemtype defined with the "classic" system and we wonder if there is a way to pass additional arguments to the BAT file.
The idea is to define a problem type variable to select if we want to run the model or simply generate the input data.
Regards,
Daniel
Additional arguments to the BAT file
Moderator: GiD Team
Re: Additional arguments to the BAT file
It is possible to add more arguments to the batch, but I think that are not necessary for your case
If do you simply want to write the calculation file you can use
Files->Export->Calculation file...
instead of
Calculate->Calculate...
that writhe the file/s and also start the solver (through the .bat, for both cases, classical and customLib)
If do you simply want to write the calculation file you can use
Files->Export->Calculation file...
instead of
Calculate->Calculate...
that writhe the file/s and also start the solver (through the .bat, for both cases, classical and customLib)
Re: Additional arguments to the BAT file
Thanks for your answer
I tried the option you mentioned, but it does not really fit our case.
As I have seen, the option "Export / Calculation file" executes only the *.BAS files, however in our case we need to execute an additional A.exe that is found in the *.BAT file.
Therefore, the idea would be to run the *.BAS plus an A.exe and exclude B.exe, which is the solver.
Cordially
Daniel
I tried the option you mentioned, but it does not really fit our case.
As I have seen, the option "Export / Calculation file" executes only the *.BAS files, however in our case we need to execute an additional A.exe that is found in the *.BAT file.
Therefore, the idea would be to run the *.BAS plus an A.exe and exclude B.exe, which is the solver.
Cordially
Daniel
Re: Additional arguments to the BAT file
there are a lot of possibilities
e.g.
1) write in the .dat calculation file some information (for example of a 'general data' question) that say B.xe that when running must not do noting
2) implement in your <proglemtype>.tcl file the GiD-Tcl event
(see 'Customization help' : TCL AND TK EXTENSION>Event procedures>problemtype>Run)
proc AfterWriteCalcFileGIDProject { file error } {
...body...
set value ...
return $value
}
and inside this procedure start A.exe (with the 'exec' tcl command)
Then when exporting the calculation file will include invoke this A.exe (that could be considered part of the process to create the definitive calculation file)
(ant then must remove from the .bat the call to A.exe and invoke only B.exe that represent the real calculation)
3) send the information to the bat file in other ways, like a environment variable, set at Tcl level (with the global array ::env)
set ::env(variable)
and modifying the .bat to run B.exe or not depending on its value
4) send the information as you initially suggested as an extra 'command line' argument of the call to the .bat file
it is possible do it implementing the GiD-Tcl event SelectGIDBatFile
proc SelectGIDBatFile { dir basename } {
...
}
5) modify the menus of GiD adding your own new option
Calculate->Export file only....
that invoke your own procedure that do what you want: export the .dat and then run A.exe
e.g.
1) write in the .dat calculation file some information (for example of a 'general data' question) that say B.xe that when running must not do noting
2) implement in your <proglemtype>.tcl file the GiD-Tcl event
(see 'Customization help' : TCL AND TK EXTENSION>Event procedures>problemtype>Run)
proc AfterWriteCalcFileGIDProject { file error } {
...body...
set value ...
return $value
}
and inside this procedure start A.exe (with the 'exec' tcl command)
Then when exporting the calculation file will include invoke this A.exe (that could be considered part of the process to create the definitive calculation file)
(ant then must remove from the .bat the call to A.exe and invoke only B.exe that represent the real calculation)
3) send the information to the bat file in other ways, like a environment variable, set at Tcl level (with the global array ::env)
set ::env(variable)
and modifying the .bat to run B.exe or not depending on its value
4) send the information as you initially suggested as an extra 'command line' argument of the call to the .bat file
it is possible do it implementing the GiD-Tcl event SelectGIDBatFile
proc SelectGIDBatFile { dir basename } {
...
}
5) modify the menus of GiD adding your own new option
Calculate->Export file only....
that invoke your own procedure that do what you want: export the .dat and then run A.exe