Replay Scripts

Ansys ICEM CFD makes it possible for you to write your own specialized scripts to customize Ansys ICEM CFD or run complex operations in batch mode. ICEM CFD scripts are based on a variation of the Tcl/Tk language. Details of commands specific to ICEM CFD plus basic scripting information can be found in Ansys ICEM CFD Programmer's Guide.

The Replay Scripts menu item opens a submenu of options as shown in Figure 37: Replay Options.

Figure 37: Replay Options

Replay Options

Replay Control

This option helps you create script files by performing operations in Ansys ICEM CFD and recording the equivalent Tcl/Tk commands in a Replay file. You can modify or run this Replay file as a script file. This gives users unacquainted with Tcl/Tk an option to also use scripting.

The Replay control window can be minimized at any time.


Note:  If you are using Ansys ICEM CFD in Workbench and want to step through Workbench Input Parameters you have created, you must open the Workbench Replay Control from the One-click menu. For more information, see Interface Differences in the Data-Integrated ICEM CFD in the Workbench User's Guide.


Record (after current)

Toggles between Record mode and Edit mode.

Record mode

Commands will be sequentially numbered and appended to the list in the Replay Control dialog box.

The example shown in Figure 38: Replay Control Window - Record Mode contains the script commands recorded while performing the following operations in Ansys ICEM CFD.

With no geometry loaded, perform

Geometry > Create Point > Screen Select
New part name is GEOM.
Screen select a location.
Screen select a second location.
Screen select a third location.
Click Apply.

Figure 38: Replay Control Window - Record Mode

Replay Control Window - Record Mode

Edit mode

Line numbers are turned off and the Replay Control dialog box becomes a simple text editor. You can load or save a script file; undo or redo changes; and cut, copy, and paste command lines using the icons or menus. The Edit menu also contains Search and Replace commands.

The ICEM CFD window and the Do one / Do all / Do range / Skip controls remain active so you can verify the script commands as you edit.

When you switch back to Record mode, all commands will be renumbered sequentially.

Figure 39: Replay Control Window - Edit Mode

Replay Control Window - Edit Mode

Yellow highlighting indicates the current line being edited, as well as the location from where the replay would start if using Do one as described below.

Edit mode (Line: nn) indicates the line in the replay that is highlighed. If you click text in another line, the new line will be highlighted and the new line number will be indicated. This could be used with Do range as described below.

All commands

To record all the commands that you or Ansys ICEM CFD performs, toggle this option ON.

Do one

While running the script, clicking this button will perform only one step, or one line of the Replay file.

Do all

Ansys ICEM CFD will run the whole Replay file when this option is selected.

Do Range

To run a specific subset of the commands in the Replay file, select this option. The Replay Range window opens where you select the Start line and End line numbers, as shown in Figure 40: Replay Range window.

Figure 40: Replay Range window

Replay Range window

Skip

To ignore the command line where the cursor lies, select this option. The cursor will move to the next line.

Load

To open a previously stored Replay file (*.rpl) in the Replay Control window, select this option. The File Selection window opens where you choose the Replay file to be loaded.

Save

Saves the Replay file in a location specified in the File selection window.

Edit

Opens a text editor window where you can modify the existing Replay script. The application prompts you to save your work when you close the editor.

The choice of editor is determined in the General dialog box. If you use the internal editor,

  • It will open at the current line in the Replay control dialog box.

  • Any changes, including line numbers, are synchronized between the editor window and the Replay control dialog box.

  • Saving the file in the editor will also renumber and update the contents of the Replay control dialog box.

  • The editor window can be minimized, allowing you to work in ICEM CFD. Clicking Edit will bring the editor window back to the foreground and jump to the current line.

Insert

Inserts one line in the script so that you can enter comments or commands.

Delete one

Removes the selected line of command from the Replay file.

Delete all

Clears all the commands from the Replay Control window.

Delete range

Deletes a specific range of commands from the Replay file.

Renumber

If you have added or deleted commands manually, this button re-sequences the command line numbers.

Always update

Updates the model after each step. When this is disabled, the replay script will be run in batch mode and the model will be updated at the end. You can enable this option to see the step by step updates, however, you can disable it to more rapidly generate the model.

Ignore errors

When disabled (default), the replay control will stop executing the replay script when an erroneous command is reached. When enabled, the replay control will skip the erroneous command and continue to execute the subsequent commands in the replay script.

Stop

Halts an ongoing Replay of your script file.

Clean

This option simplifies a replay recording by deleting unnecessary lines. The determination of which lines are unnecessary is performed by the Edit Filter. You should Renumber after Clean. See Figure 41: Replay Control window After Clean where two lines have been removed, including line number 3.


Tip:
  • You can right-click in the Replay Control window and select Undo Clean to reverse the latest clean action.

  • You can right-click in the Replay Control window and select Edit Filter to add to, or remove from, the list of commands deleted by Clean. Right-click a second time to return to the normal replay scripting window.


Figure 41: Replay Control window After Clean

Replay Control window After Clean


Note:  If an Undo action was performed while recording the Replay file, then you need to manually remove the appropriate lines from the script (starting with undo_begin and ending with the undo_end command). The Clean filter does not take care of this.


Done

Closes the Replay Control window. The application prompts you to save the Replay file before closing the window if it is not saved.

Load script file

The Load script file option opens a dialog box where you select a replay script file (*.rpl) to display in the Replay Control window.

Run from script file

The Run from script file option opens a dialog box where you select a previously written script and initiate automatic replay.


Note:  The set of functions that begin with the letters ic_ , as documented in the Programmer’s Guide, are used to perform all the operations in ICEM CFD.



Note:  Reading through the tcl files in $ICEM_ACN/bin/med and using undocumented functions is not recommended because they might change at any time.


Recording scripts

This option performs the same function as the Record (after current) check box.