Introduction

Advanced users of EnSight often find themselves performing repetitive tasks. EnSight's macro facility lets you save a sequence of commands and then assign a keyboard key to those commands such that they are executed when the key is pressed.


Note:  Macros only work when the mouse cursor is in the graphics window.


Pressing a key assigned to a macro causes the associated command file to be read and executed. Depending on how it is set up, a macro can execute its file in one of three ways:

  1. The command file is executed once for each key press. This mode is useful for one-time operations such as cutting flipbook animation on/off or saving an image.

  2. The command file repeatedly executes as long as the key is held down. This is useful for operations that are continuous in nature, such as rotating around the Y axis by 5 degrees.

  3. Multiple command files execute in a cycle for each keystroke.

Keystroke macros are defined in a text file, macro.define. Macros can be defined at a site or local level, with local macros overriding site macros that might be defined for the same key. The macro.define file (if any) that resides in the %CEI%/ensight242/site_preferences/macros directory defines site-level macros, while the macro.define file (if any) under the user's EnSight defaults directory (located at %HOMEDRIVE%%HOMEPATH%\(username)\.ensight242 commonly located at C:\Users\username\.ensight242 on Win10, C:\Documents and Settings\yourusername\.ensight242 on older Windows, and ~/.ensight242 on Linux, and in ~/Library/Application Support/EnSight242 on the Mac) will define that user's local macros. Any command files referenced by macros must be located in these directories as well.

Most of the functions needed to define and edit macros can be found under the Macros tab of the Command Dialog (FileCommand from the Main Menu). Open this dialog to view the default, system macros in the default install.