Python and Macro Script Support


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 TecUtilScriptExecRegisterCallback (const char *FileExt, const char *ScriptLanguage, ScriptExecCallback_pf ScriptExecCallback, ArbParam_t ClientData)
  Registers the script execution callback and client data with the specified file extension.
Boolean_t TecUtilScriptExec (const char *FileName)
  Executes the specified script file.
Boolean_t TecUtilScriptProcessorGetClientData (const char *ScriptExtension, ArbParam_t *ClientData)
  Returns client data associated with a script processor.
Boolean_t TecUtilStateIsProcessingMacro (void)
  Determine if Tecplot is currently playing a macro.
Boolean_t TecUtilStateIsProcessingStylesheet (void)
  Determine if Tecplot is currently processing a stylesheet.
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).
Precondition:
CommandProcessorIDString String must have a valid address and non-zero length.
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.
Precondition:
Command String must have a valid address and non-zero length.
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.

This function is Thread Safe.

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.
Precondition:
Title Pointer must be a valid address and non-NULL.
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.

Python Syntax:

  Results = TecUtil.MacroRecordAddOnCommand(AddOnIDString, Command)

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

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

Deprecated:
Please use TecUtilMacroRecordExtComRaw() instead.

Python Syntax:

  Results = TecUtil.MacroRecordAddOnComRaw(AddOnIDString, Command, RawData)

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

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.
Precondition:
CommandProcessorIDString String must have a valid address and non-zero length.

Command String must have a valid address and non-zero length.

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.
Precondition:
CommandProcessorIDString String must have a valid address and non-zero length.

Command String must have a valid address and non-zero length.

RawData String must have a valid address and non-zero length.

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 The name of the macro file to run. This should be the full path to the macro file. If the full path is not specified, any relative paths in your macro file may not be correctly resolved.
Returns:
TRUE if successful, FALSE otherwise.
Precondition:
FName String must have a valid address and non-zero length.
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("C:\\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.
Precondition:
QuickMacroName Pointer must be a valid address or NULL.

MacroParameters Pointer must be a valid address or NULL.

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.
Precondition:
MacroVar String must have a valid address and non-zero length.

ValueString Pointer must be a valid address and non-NULL.

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|"

Boolean_t TecUtilScriptExec ( const char *  FileName  ) 

Executes the specified script file.

Tecplot locates the script execute callback based upon the file name extension.

Since:
11.0-2-005
Parameters:
FileName Script file name to execute.
Returns:
TRUE if the script was found and executed without errors, FALSE otherwise.
Precondition:
FileName String must have a valid address and non-zero length.
See also:
TecUtilScriptExecRegisterCallback
Python Syntax:
  Results = TecUtil.ScriptExec(FileName)

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

Boolean_t TecUtilScriptExecRegisterCallback ( const char *  FileExt,
const char *  ScriptLanguage,
ScriptExecCallback_pf  ScriptExecCallback,
ArbParam_t  ClientData 
)

Registers the script execution callback and client data with the specified file extension.

When Tecplot encounters a file with the given extension it hands it off to the callback to execute.

Since:
11.0-2-005
Parameters:
FileExt File extension, such as "tcl" or "py", to associate with the script execution callback and client data.
ScriptLanguage Name of the scripting language. This name could be displayed in a Tecplot menu or dialog.
ScriptExecCallback Callback responsible for executing the script handed to it by Tecplot.
ClientData Any client data needed by the callback.
Returns:
TRUE if the script callback and client data were registered with the file extension, FALSE if the file extension is already registered with another callback.
Precondition:
ScriptLanguage String must have a valid address and non-zero length.
See also:
ScriptExecCallback_pf
Python Syntax:
    This function is not supported in Python.

Boolean_t TecUtilScriptProcessorGetClientData ( const char *  ScriptExtension,
ArbParam_t ClientData 
)

Returns client data associated with a script processor.

Since:
11.2-0-200
Parameters:
ScriptExtension An extension for which the script processor was registered.
ClientData A pointer to an ArbParam_t variable to receive the client data.
Returns:
Returns TRUE if the client data was successfully retrieved for the script extension. FALSE, if no script processor was registered for the given script extension.
Precondition:
ScriptExtension String must have a valid address and non-zero length.

ClientData Pointer must be a valid address and non-NULL.

See also:
TecUtilScriptExecRegisterCallback
Python Syntax:
    This function is not supported in Python.

Boolean_t TecUtilStateIsProcessingMacro ( void   ) 

Determine if Tecplot is currently playing a macro.

Since:
13.2-0-20865
Returns:
TRUE if Tecplot is playing a macro, otherwise FALSE.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilStateIsProcessingMacro()

Python Syntax:

  Results = TecUtil.StateIsProcessingMacro()

  Output:
    Results[0]    ReturnVal            boolean

Boolean_t TecUtilStateIsProcessingStylesheet ( void   ) 

Determine if Tecplot is currently processing a stylesheet.

Since:
13.2-0-20865
Returns:
TRUE if Tecplot is processing a stylesheet, otherwise FALSE.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilStateIsProcessingStylesheet()

Python Syntax:

  Results = TecUtil.StateIsProcessingStylesheet()

  Output:
    Results[0]    ReturnVal            boolean


Generated on Tue Mar 12 02:24:43 2013 for Tecplot by  doxygen 1.5.5