Additional arguments to the BAT file

Moderator: GiD Team

dgarolera
Posts: 2
Joined: Tue Mar 13, 2018 12:37 pm

Additional arguments to the BAT file

Postby dgarolera » Tue Mar 13, 2018 12:58 pm

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
User avatar
escolano
Posts: 1568
Joined: Thu Sep 18, 2014 3:31 pm

Re: Additional arguments to the BAT file

Postby escolano » Tue Mar 13, 2018 9:02 pm

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)
dgarolera
Posts: 2
Joined: Tue Mar 13, 2018 12:37 pm

Re: Additional arguments to the BAT file

Postby dgarolera » Thu Mar 15, 2018 9:19 am

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
User avatar
escolano
Posts: 1568
Joined: Thu Sep 18, 2014 3:31 pm

Re: Additional arguments to the BAT file

Postby escolano » Thu Mar 15, 2018 12:25 pm

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

Return to “Customization”

Who is online

Users browsing this forum: No registered users and 1 guest