How to run cgx in batch mode

Most commands can be executed in batch-mode. Actually if you read a file with geometry (fbd-file) then you run cgx in batch mode already! You just have to add ”exit” or ”quit” at the end of the file and it will be obvious. You might use the ”read” command in such a command-file to reference other command-files or to read files with mesh-entities for whatever purposes. In such a way you can create and modify geometry or meshes in batch-mode or evaluate results in batch-mode. But you need a graphic-capable computer because cgx needs it even if no graphic output is requested. Nevertheless the pop up of the graphic window can be suppressed by starting cgx with the “-bg” parameter. In this mode the performance is higher since no graphic related actions are performed. Even during foreground operation the user has the possibillity to execute commands in the background mode when he switches this mode on with “asgn bg on”. Especially when reading commands from a file it increases the execution time significantly. After reading it has to be switched of with “asgn bg off”.

Some commands only make sense in a batch file like “if” and “while”. Please have a look into “If and while demo” on how to work with this commands. Results can be extracted and stored to a file, see “How to write values to a file”.

Be aware of the 'examples' directory. It holds examples on how to use the command language as a programming language. The 'ifwhiledemo' generates points in a loop and shows how to write cgx generated values to a file. The 'userDataset' shows how to generate a user dataset for a temperature field based on the z coordinate of the nodes.

It should be noted that a successive 'save' or 'exit' command will overwrite the batch file if it has the file-extension 'fbd'. To prevent this the user should use a different extension like 'fbl' instead of 'fbd'.

When executing commands which increase the used space then it might happen that geometry is clipped and can not be seen or accessed anymore. In such a case a “frame” command is needed. This command is usually automatically triggered. Especially in batch mode without graphic output it solves sometimes strange situations.

When the command “init” or “wsize” is used then they have to be used in the very first line. Otherwhise the window dimensions take only effect after the batch file was completely parsed and executed.