Visitrc file

A visitrc file is a file called visitrc that is located in your VisIt user directory, which on most platforms is ~/.visit. The visitrc file is a Python source code file that contains Python scripting commands that VisIt should execute when the CLI is started. If the VisIt GUI detects the presence of the visitrc file, then the CLI will also be launched on start up, setting up your VisIt session so that both the GUI and CLI are connected to the viewer.

The visitrc file is most often used to define Python functions that will be called when you click on buttons in VisIt's Macros window.

Recording a macro

VisIt's Command window contains controls that allow you to record most GUI actions and view Python scripting code needed to accomplish those actions. The Command window provides 8 conventional tabs that serve as destinations for recorded Python coding. In addition to those 8 tabs, there is a special tab called Macros that shows the contents of the visitrc file. If you record Python code to the Macros tab then that Python code is turned into a function that can be called in response to a button click from a button in the Macros window.

To record a macro:

  • Open the Command window and choose to Store commands in Macros.
  • Click the Record button
  • Perform any GUI actions that you want to record to a single button click.
  • Click the Stop button in the Command window.
  • Enter the name of a Python function in which to store your set of recorded commands.
  • Enter the text for the macro button as it will appear in the Macro window.
  • Now, the Macros tab will contain a function for your recorded commands and it will call the RegisterMacro function from the VisIt Python Interface to associate your Python function with the named button. Dont't forget that you can edit the recorded Python code to suit your needs. You can generalize the code so it can, for example, operate on the active database instead of a specific database. The state information that you need to generalize can often be returned by the GetGlobalAttributes(), GetWindowInformation(), or GetMetaData() functions.
  • Click the Update macros button to make VisIt update the buttons in the Macros window so it will contain your new button.
  • No further steps need to be taken to save your macro since the macro definitions in the Macros tab of the Command window will be automatically saved to your visitrc file.
  • Click the new button in the Macros window whenever you want to replay the recorded set of commands.