9.10 Managing macros

To manage macros containing a set of ABAQUS Scripting Interface commands, select FileMacro Manager from the main menu bar. When you create a macro, ABAQUS/CAE records a sequence of ABAQUS Scripting Interface commands in a macro file while you interact with ABAQUS/CAE. Each command corresponds to an interaction with ABAQUS/CAE, and replaying the macro reproduces the sequence of interactions.

Macros are stored in a file called abaqusMacros.py. ABAQUS/CAE searches three directories for abaqusMacros.py, in the following order:

The abaqusMacros.py file can exist in more than one of these directories. The Macro Manager contains a list of the existing macros that ABAQUS/CAE detected in all the abaqusMacros.py files. If a macro uses the same name in more than one abaqusMacros.py file, ABAQUS/CAE uses the last macro encountered.

Your macro will run only in the same context in which it was recorded. For example, if you create a macro that copies a part named gear1 to a new part named gear2, the macro will be executed in a new ABAQUS/CAE session only if a part named gear1 exists.

The ABAQUS Scripting Interface commands are stored in ASCII text. You can edit abaqusMacros.py with a standard text editor; however, any errors that you introduce into the file will prevent the Macro Manager from displaying. For more information on commands, see the ABAQUS Scripting Manual.

Tip:  If you edit any of the abaqusMacros.py files using a text editor, you can click Reload from the buttons at the bottom of the Macro Manager to update the macro list without closing the manager.

To create a macro:

  1. From the main menu bar, select FileMacro Manager.

    The Macro Manager dialog box appears.

  2. From the buttons across the bottom of the Macro Manager dialog box, click Create.

  3. Enter a name for the macro in the Create Macro dialog box that appears, and click Continue. You cannot overwrite an existing macro.

    Each of your interactions with ABAQUS/CAE is stored as a command in the abaqusMacros.py file. A Recording macro dialog box appears to remind you the macro is recording. In addition, the Create, Delete, Run,and Reload buttons are not available in the Macro Manager while the macro is recording.

  4. Click the Stop recording button to save the macro in abaqusMacros.py.

    ABAQUS/CAE updates the macro list in the Macro Manager.

To delete a macro:

  1. From the main menu bar, select FileMacro Manager.

    The Macro Manager dialog box appears.

  2. Select the macro to delete. You can select more than one macro.

  3. From the buttons across the bottom of the Macro Manager dialog box, click Delete.

  4. From the dialog box that appears, click OK to confirm your action.

    ABAQUS/CAE deletes the macro from abaqusMacros.py and updates the macro list in the Macro Manager. You cannot recover a deleted macro.

To run a macro:

  1. From the main menu bar, select FileMacro Manager.

    The Macro Manager dialog box appears.

  2. Select the macro to run.

  3. From the buttons across the bottom of the Macro Manager dialog box, click Run. You can run only one macro; the Run button is not available if you selected more than one macro.

    ABAQUS/CAE runs the commands in the selected macro and displays a message in the message area when the macro execution completes.


For information on related topics, click any of the following items: