Macro Processing


Functions

Boolean_t TecUtilMacroRunFunction (const char *QuickMacroName, const char *MacroParameters)
 Run a macro function.
Boolean_t TecUtilMacroPanelAddTitle (const char *Title)
 Add a title to a page in the Quick Macro Panel.
Boolean_t TecUtilMacroRunFile (const char *FName)
 Run a macro file.
Boolean_t TecUtilMacroAddCommandCallback (const char *CommandProcessorIDString, MacroCommandExtCallback_pf MacroCommandCallback)
 Include a function in the list of functions to call when the $!EXTENDEDCOMMAND macro command is processed.
Boolean_t TecUtilMacroRecordExtCommand (const char *CommandProcessorIDString, const char *Command)
 Instruct Tecplot to record a macro command to the macro file which is currently being recorded.
Boolean_t TecUtilMacroRecordAddOnCommand (const char *AddOnIDString, const char *Command)
Boolean_t TecUtilMacroRecordExtComRaw (const char *CommandProcessorIDString, const char *Command, const char *RawData)
 Instruct Tecplot to record a macro command, that includes raw data, to the macro file.
Boolean_t TecUtilMacroRecordAddOnComRaw (const char *AddOnIDString, const char *Command, const char *RawData)
Boolean_t TecUtilMacroRecordRawCommand (const char *Command)
 Send anything you want to the Tecplot record file.
Boolean_t TecUtilMacroExecuteCommand (const char *Command)
 Instruct Tecplot to execute a single macro command.
Boolean_t TecUtilMacroSetMacroVar (const char *MacroVar, const char *ValueString)
 Set the value for a macro variable.
Boolean_t TecUtilMacroFunctionExists (const char *FunctionName)
 Query Tecplot to see if a macro function called FunctionName exists.
Boolean_t TecUtilMacroIsBatchModeActive (void)
 Determine if Tecplot is currently running in batch mode.
Boolean_t TecUtilMacroIsRecordingActive (void)
 Determine if Tecplot is currently recording a macro.

Function Documentation

Boolean_t TecUtilMacroAddCommandCallback ( const char *  CommandProcessorIDString,
MacroCommandExtCallback_pf  MacroCommandCallback 
)

Include a function in the list of functions to call when the $!EXTENDEDCOMMAND macro command is processed.

This allows you to extend Tecplot's macro language, so that commands needed to perform operations in your application or add-on can be included in a Tecplot macro.

Parameters:
CommandProcessorIDString A unique string used to determine the function to call when an $!EXTENDEDCOMMAND macro command is processed. Each application or add-on should have its own unique ID string. For example, if a file converter add-on responsible for converting DXF files for Tecplot defines an ID string of "DXFCONVERTTOOL-1.2" then this same ID string must be used in the calls to TecUtilMacroRecordExtCommand() and TecUtilMacroAddCommandCallback().
MacroCommandCallback Name of the function to call when the $!EXTENDEDCOMMAND macro command is processed. The callback function you provide will have the following syntax:.
Returns:
Returns TRUE if callback has been added. Returns FALSE if the CommandProcessorIDString is invalid or if there is not enough room to allocate space for an additional callback (highly unlikely).
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilMacroAddCommandCallback(
   &                   CommandProcessorIDString,
   &                   MacroCommandCallback)
    CHARACTER*(*)   AddOnIDString
    EXTERNAL        MacroCommandCallback

Python Syntax:

    This function is not supported in Python.

The following example shows how an add-on can augment the Tecplot macro language with the commands "GO" and "STOP." First create a function that will be called by Tecplot when a "GO" or "STOP" command is encountered in a macro file.

   Boolean_t ProcessBananaCommands(char *Command,
                                   char **ErrMsg)
   {
     Boolean_t IsOk = TRUE;
     if (strcmp(Command,"GO") == 0)
       {
         // code here to execute a GO command 
       }
     else if (strcmp(Command, "STOP") == 0)
       {
         // code here to execute a STOP command 
       }
    else
       {
         *ErrMsg = TecUtilStringAlloc(80, "Error message string");
         sprintf(*ErrMsg, "Unknown BANANA command");
         IsOk = FALSE;
       }
     return IsOk;
   }
   In the initialization code for your add-on, register the function with:
     .
     .
     TecUtilMacroAddCommandCallback("BANANA",
                                    ProcessBananaCommands);
     .
     .

Boolean_t TecUtilMacroExecuteCommand ( const char *  Command  ) 

Instruct Tecplot to execute a single macro command.

The macro command is supplied as a string. Currently this command is restricted as follows: ? Only commands that do not require raw data are accepted. ? Command must be all on one line-no newlines. See the Tecplot Reference Manual for details about Tecplot's macro language.

Parameters:
Command Macro command. This must not be NULL
Returns:
TRUE if Command executed successfully, otherwise FALSE.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilMacroExecuteCommand(Command)
    CHARACTER*(*) Command

Python Syntax:

  Results = TecUtil.MacroExecuteCommand(Command)

  Input:
                  Command              string
  Output:
    Results[0]    ReturnVal            boolean

Execute a macro command to animate the I-planes:

   TecUtilMacroExecuteCommand("$!ANIMATEIJKPLANES PLANES = I");

Boolean_t TecUtilMacroFunctionExists ( const char *  FunctionName  ) 

Query Tecplot to see if a macro function called FunctionName exists.

Note:
This function requires Tecplot Version 7.5-0-6 or newer.
Parameters:
FunctionName Name of the macro function.
Returns:
TRUE if the function exists, otherwise FALSE.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilMacroFunctionExists(FunctionName)
    CHARACTER*(*) FunctionName

Python Syntax:

  Results = TecUtil.MacroFunctionExists(FunctionName)

  Input:
                  FunctionName         string
  Output:
    Results[0]    ReturnVal            boolean

If the macro function "abc" exists, then execute it.

   if (TecUtilMacroFunctionExists("abc"))
      {
         TecUtilMacroRunFunction("abc",(char *)NULL);
      }

Boolean_t TecUtilMacroIsBatchModeActive ( void   ) 

Determine if Tecplot is currently running in batch mode.

Returns:
TRUE if Tecplot is in batch mode, otherwise FALSE.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilMacroIsBatchModeActive()

Python Syntax:

  Results = TecUtil.MacroIsBatchModeActive()

  Output:
    Results[0]    ReturnVal            boolean

Perform some operations if Tecplot is not running in batch mode:

   if (!TecUtilMacroIsBatchModeActive())
     {
       // Perform some operations
     }

Boolean_t TecUtilMacroIsRecordingActive ( void   ) 

Determine if Tecplot is currently recording a macro.

Returns:
TRUE if Tecplot is recording macros, otherwise FALSE.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilMacroIsRecordingActive()

Python Syntax:

  Results = TecUtil.MacroIsRecordingActive()

  Output:
    Results[0]    ReturnVal            boolean

If Tecplot is currently recording a macro, record the macro command "GO" for the addon "BANANA":

Boolean_t TecUtilMacroPanelAddTitle ( const char *  Title  ) 

Add a title to a page in the Quick Macro Panel.

Parameters:
Title String containing the title. Each call to TecUtilMacroPanelAddTitle() adds a title to successive pages in the Quick Macro Panel
Returns:
TRUE if successfull, otherwise FALSE.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilMacroPanelAddTitle(Title)
    CHARACTER*(*) Title

Python Syntax:

  Results = TecUtil.MacroPanelAddTitle(Title)

  Input:
                  Title                string
  Output:
    Results[0]    ReturnVal            boolean

Add the title "Flow Options" to the next macro panel:

   TecUtilMacroPanelAddTitle("Flow Options");

Boolean_t TecUtilMacroRecordAddOnCommand ( const char *  AddOnIDString,
const char *  Command 
)

Deprecated:
Please use TecUtilMacroRecordExtCommand() instead.

Boolean_t TecUtilMacroRecordAddOnComRaw ( const char *  AddOnIDString,
const char *  Command,
const char *  RawData 
)

Deprecated:
Please use TecUtilMacroRecordExtComRaw() instead.

Boolean_t TecUtilMacroRecordExtCommand ( const char *  CommandProcessorIDString,
const char *  Command 
)

Instruct Tecplot to record a macro command to the macro file which is currently being recorded.

Parameters:
CommandProcessorIDString Unique string to identify command as belonging to a particular command processor. Use TecUtilMacroAddCommandCallback() to install a callback function.
Command Character string containing the command. This command must be one that your command processor understands since it will be passed to the function you register with TecUtilMacroAddCommandCallback().
Returns:
TRUE if successful. FALSE if an I/O error occurs while writing the command to a file.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilMacroRecordExtCommand(
   &                   CommandProcessorIDString,
   &                   Command)
    CHARACTER*(*)   AddOnIDString
    CHARACTER*(*)   Command

Python Syntax:

  Results = TecUtil.MacroRecordExtCommand(CommandProcessorIDString, Command)

  Input:
                  CommandProcessorIDString string
                  Command              string
  Output:
    Results[0]    ReturnVal            boolean

Boolean_t TecUtilMacroRecordExtComRaw ( const char *  CommandProcessorIDString,
const char *  Command,
const char *  RawData 
)

Instruct Tecplot to record a macro command, that includes raw data, to the macro file.

Parameters:
CommandProcessorIDString Unique string to identify command as belonging to a particular command processor. Use TecUtilMacroAddCommandCallback() to install a callback function.
Command Character string containing the command. This command must be one that your command processor understands since it will be passed to the function you register with TecUtilMacroAddCommandCallback().
RawData Character string containing the raw data. This text will follow a RAWDATA marker in the macro file. Use of newlines to organize the raw data in a readable fashion is encouraged. The RawData section cannot contain the $! since the $! marks the start of a Tecplot macro command. The # may be used in the raw data, however all text following the # up to the following newline will be discarded when the macro is processed. When the $!EXTENDEDCOMMAND is later processed by Tecplot the text in the RAWDATA section will be concatenated to the command string (including a newline (\n) to separate the command from the raw data.
Returns:
TRUE if successful; FALSE if an I/O error occurs while writing the command to a file.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilMacroRecordExtComRaw(
   &                   CommandProcessorIDString,
   &                   Command,
   &                   RawData)
    CHARACTER*(*)   CommandProcessorIDString
    CHARACTER*(*)   Command
    CHARACTER*(*)   RawData

Python Syntax:

  Results = TecUtil.MacroRecordExtComRaw(CommandProcessorIDString, Command, RawData)

  Input:
                  CommandProcessorIDString string
                  Command              string
                  RawData              string
  Output:
    Results[0]    ReturnVal            boolean

Record an add-on command that has the text "3.7 9.4" in the RAWDATA section:

   if (TecUtilMacroIsRecordingActive())
     {
       TecUtilMacroRecordExtComRaw("MyMacroProcessor",
                                   "LOADXY",
                                   "3.7 9.4");
     }

Boolean_t TecUtilMacroRecordRawCommand ( const char *  Command  ) 

Send anything you want to the Tecplot record file.

Parameters:
Command Character string to write to the record file. You can send anything you want
Returns:
TRUE if successful; FALSE if an I/O error occurs while writing the command to a file.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilMacroRecordRawCommand(Command)
    CHARACTER*(*) Command

Python Syntax:

  Results = TecUtil.MacroRecordRawCommand(Command)

  Input:
                  Command              string
  Output:
    Results[0]    ReturnVal            boolean

Record commands that will cause Tecplot to loop to animate 3 zones when the macro is played back:

   if (TecUtilMacroIsRecordingActive())
     {
       TecUtilMacroRecordRawCommand("$!Loop 3\n"
                                    "$!ActiveFieldZones[|Loop|]\n"
                                    "$!Redraw\n"
                                    "$!EndLoop\n");

Boolean_t TecUtilMacroRunFile ( const char *  FName  ) 

Run a macro file.

See the Tecplot Reference Manual for details about Tecplot macro files.

Parameters:
FName Name of the file containing macro commands
Returns:
TRUE if successful, FALSE otherwise.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilMacroRunFile(FName)
    CHARACTER*(*) FName

Python Syntax:

  Results = TecUtil.MacroRunFile(FName)

  Input:
                  FName                string
  Output:
    Results[0]    ReturnVal            boolean

Load and run the macro file mymacro.mcr:

   TecUtilMacroRunFile("mymacro.mcr");

Boolean_t TecUtilMacroRunFunction ( const char *  QuickMacroName,
const char *  MacroParameters 
)

Run a macro function.

See the Tecplot Reference Manual for details about Tecplot macro functions.

Parameters:
QuickMacroName The name of the macro function to run
MacroParameters Any parameters which QuickMacroName requires. Pass NULL for macro functions which require no parameters
Returns:
TRUE if successful, FALSE otherwise.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilMacroRunFunction(
   &                   QuickMacroName,
   &                   MacroParameters)
    CHARACTER*(*)   QuickMacroName
    CHARACTER*(*)   MacroParameters

Python Syntax:

  Results = TecUtil.MacroRunFunction(QuickMacroName, MacroParameters)

  Input:
                  QuickMacroName       string
                  MacroParameters      string
  Output:
    Results[0]    ReturnVal            boolean

Run a macro function called "Calculate" which takes no parameters and another macro function called "Display" which takes the name of a layout file and an integer as parameters:

   TecUtilMacroRunFunction("Calculate", (char *)NULL);
   TecUtilMacroRunFunction("Display", "(\"contour.lay\", 2)");

Boolean_t TecUtilMacroSetMacroVar ( const char *  MacroVar,
const char *  ValueString 
)

Set the value for a macro variable.

Any macro executed after this call may then reference the value using |macrovar|.

Parameters:
MacroVar Name of the macro variable you want to assign a value.
ValueString Value to assign to MacroVar. Must be a valid string of length greater than zero
Returns:
TRUE if the MacroVar is a valid variable name and memory could be allocated to store ValueString, FALSE otherwise.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilMacroSetMacroVar(
   &                   MacroVar,
   &                   ValueString)
    CHARACTER*(*)   MacroVar
    CHARACTER*(*)   ValueString

Python Syntax:

  Results = TecUtil.MacroSetMacroVar(MacroVar, ValueString)

  Input:
                  MacroVar             string
                  ValueString          string
  Output:
    Results[0]    ReturnVal            boolean

Assign a file name to the macro variable FNAME, then use it in a Tecplot macro:

   IsOk = TecUtilMacroSetMacroVar("FName","/home/george/test.dat");
   ....
   In a later macro you can reference |FName|:
   $!ReadDataSet "|FName|"


Generated on Wed Dec 19 02:19:03 2007 for Tecplot by  doxygen 1.5.2-20070506