GiD - The personal pre and post processor

Batch file

Menu: Files->Import->Batch file...


Sometimes, you may wish to organise a number of commands into a group outside GiD, ready to be implemented in one go. To do so, commands can be written in a file and GiD will read this file and execute the commands. These commands are the same ones as are used in GiD when entered in the command line or using the commands in the Right buttons menu.


Example: Many points have been digitized and their coordinates saved in a file. These points are to be joined with straight lines to create the outline of the geometry. To do so, the file would look similar to this:

geometry create line
3.7 4.5 8
2 5 9
4,5,6
...
1 7 0.0
escape


A batch file can also be loaded into GiD by giving its name with the option -b when opening GiD (see Invoking GiD). Another way to read batch files to create dynamic presentations is with the Read batch window (see Read batch window). One GiD session can be registered in a batch file. This can be useful for checking the batch commands or to repeat one session (see Preferences).


BATCH FILE COMMANDS


There are some special commands to be added to a batch file that are treated differently from regular GiD commands. Their format is one or several words after the control string ***** (five asterisks) and everything in one line.

  • Write a log file


*****OUTPUTFILENAME filename


filename is substituted with a real file name where all the session warnings (those which appear in the GiD messages warning line) are written. This can be useful when running GiD in batch mode with the option -n (see Invoking GiD) and GiD output is desired.

  • Execute a Tcl command in a batch file


*****TCL tcl_command


Note: If this command is used in a batch file and GiD is invoked with the option -n, it will not work. So that Tcl commands are executed when GiD is run without a window, you should use the -n2 option (see Invoking GiD).

  • Insert comments in the code of a batch file
geometry create line 1,2
*****COMMENTS -this is a comment-
2,3 escape
  • Print messages in the lower GiD messages line
geometry create line 1,2
*****PRINT  -This is a message that will appear in the messages line-
2,3 escape


  • Print messages in a window
geometry create line 1,2
*****PRINT1  -This is a message that will appear in a new window-
2,3 escape

COPYRIGHT © 2022 · GID · CIMNE