« Back

Tecplot File Types and an Example Macro


Understanding Tecplot file types is helpful for getting the most out of your Tecplot Software and for working efficiently. In this Tecplot Tip we define each Tecplot file types and use the Tecplot Macro as an example. 

Tecplot basic file types:

  • layout file or *.lay is a file that creates a specified plot (e.g. an XY plot of surface temperature vs. time) and is tied to a specific data set.
  • style file or *.sty is a file that creates a specified type of plot (e.g. a “doghouse plot”, but is not tied to a specific data set.
  • plt file or *.plt is a file of data in Tecplot’s binary format.
  • dat file or *.dat is a file of data in Tecplot’s ASCII format.
  • macro file or *.mcr is a file that directs Tecplot to take a given action (e.g. load a *.dat file, and create a standard plot via a chosen *.sty file).

Note that the .sty, .mcr, and .lay files are human readable (and editable) via a simple text editor like Microsoft Notepad.

Example Macro

Below is an example of a Tecplot macro that takes the difference between two variables through a range of zones.

#!MC 1000
 #
 # First must create T_del variable for all zones #
 $!AlterData Equation = "{T_del} = 0"
 #
 # Loop over the base set of zones. Deposit the delta into T_del for the base set of zones only. If you to assign T_del to
 # the difference in BOTH sets of zones change "$!AlterData [|Loop|]" to be "$!AlterData [|Loop|,|OtherZone|]"
 #
 $!Varset |BaseNumZones| = (|NumZones|/2) $!Loop |BaseNumZones|
 $!VarSet |OtherZone| = (|Loop|+|BaseNumZones|)
 $!AlterData [|Loop|] Equation = "{T_del} = {T ,K}[|Loop|] - {T ,K}[|OtherZone|]"
 $!EndLoop

This macro could be named diff.mcr, and then run from the Tecplot menu Scripting >> Play Macro/Script.
Alternately, the macro could be put inside of another macro function. To do this, copy the macro below into the tecplot.mcr file found in the Tecplot root directory. (It’s the same as the above macro minus the #!MC 1000 line)

!MacroFunction Name = “Calculate Difference”
 #
 # First must create T_del variable for all zones #
 $!AlterData Equation = "{T_del} = 0"
 #
 # Loop over the base set of zones. Deposit the delta into T_del for the base set of zones only. If you to assign T_del to
 # the difference in BOTH sets of zones change "$!AlterData [|Loop|]" to be "$!AlterData [|Loop|,|OtherZone|]"
 #
 $!Varset |BaseNumZones| = (|NumZones|/2) $!Loop |BaseNumZones|
 $!VarSet |OtherZone| = (|Loop|+|BaseNumZones|)
 $!AlterData [|Loop|] Equation = "{T_del} = {T ,K}[|Loop|] - {T ,K}[|OtherZone|]"
 $!EndLoop
$!EndMacroFunction

Run this macro from Tecplot’s quick macro panel Scripting >> Quick Macros, and click on the Calculate Difference button in the menu.
To find out how Tecplot can customize your application, contact us at sales@tecplot.com, or use the online Contact Form.