25 - 1   Creating a Macro

To record a macro in Tecplot RS, start the Macro Recorder, accessible in the Macro menu, and then perform the sequence of actions you wish to record. After recording your macro, if you wish, you can edit your macro file with an ASCII text editor to remove redundant operations, compress repetitive actions into loops, or otherwise modify the macro.

To operate the Macro Recorder, do the following:

1.Choose “Record Macro” from the Macro menu.

2.Specify a file name and location to save your macro in the Write Macro File dialog and click Save in that dialog (macros automatically use the file extension .mcr).

3.An Information dialog appears to let you know that Auto-redraw will not work during macro recording. Click OK.

4.Tecplot RS is now recording the macro. Execute the actions you wish to record. (The Macro Recorder dialog remains open during the recording session).

5.When you have completed the actions you wish to record, click the Stop Recording button in the Macro Recorder dialog.

note00375.pngTo redraw your plot while recording and see the result of your plot selections, click the Redraw button in the sidebar.

While recording macros, you can use the buttons in the Macro Recorder to add specific commands to your macro. These buttons insert the following:macro_recorder.png

Insert “Pause” Clicking this button adds a “pause” command to the macro. When you play a macro including a pause command, Tecplot RS displays a message box when it reaches the pause command, and waits for you to click OK before continuing to process the macro.

If you include several different plots or plot views in your macro, you may find it useful to insert a pause in the sequence. Click the Insert Pause button, and add a comment or label in the provided dialog. Then, when you replay the macro, the sequence will pause at this point, allowing you to view the results.

Insert “Graphics Off” Adds a “graphics off” command to the macro. When you play a macro containing a “graphics off” command, Tecplot RS stops displaying graphics in the workspace from the “graphics off” command until a “graphics on” command is encountered.

Insert “Graphics On” Adds a “graphics on” command to the macro.

Insert Raw Command Opens a dialog in which you can enter any valid Tecplot macro command. For example, you can add “$!LOOP 10” at the start of a section you want to repeat 10 times, then “$!ENDLOOP” at the end. See the Tecplot 360 Scripting Guide for information on the Tecplot macro language.

Stop Recording Click this button to stop recording when you have completed the sequence of actions you wish to include in your macro.

lightbulb00376.pngTo make your macro as compatible as possible with other versions of Tecplot RS, begin recording with a blank project and default formatting.

When creating a macro, be sure to think about the state of your project when you begin recording. For example, you may wish to begin with a blank project and default formatting to create a macro that will run without first loading data. On the other hand, if you wish to create a macro that operates on whatever data you have loaded at the time, you may wish to load example data before beginning to record your macro.

warning00378.pngTo use a macro to precisely duplicate the plot you had when you recorded it, Tecplot RS must be in the exact same state when you run the macro as it was when you began recording it. To accomplish this, start with an blank project for both recording and replaying a macro to start with all default settings except plot type (you can specify the plot type in your macro).

To begin with all default formatting and the default plot type, restart Tecplot RS before recording and replaying your macro.

warning00379.pngYou may encounter errors in macro playback if you include “pick” operations when recording a macro. A “pick” operation includes any instance of selecting an object by clicking it (such as text or a geometry).