« Back

Tecplot Tip: Create an Animation of Slices through a 3D Volumetric Simulation


In Tecplot 360 it’s faster and uses less memory to work with slice zones instead of slice objects. This macro extracts the slice object to a slice zone and synchronizes the dynamic text of a variable with the slice as it moves through the volume.

#!MC 1200
# set up variables
$!VarSet |TextXPos| = 9
$!VarSet |TextYPos| = 90
$!VarSet |XStart| = 0.1
$!VarSet |XEnd| = 0.9
$!VarSet |XDelta| = 0.1
$!VarSet |NDim| = 50 # nacelle diam.
# put in text box 'stub'
$!ATTACHTEXT
ANCHORPOS
{
X = |TextXPos|
Y = |TextYPos|
}
TEXT = ' '
$!REDRAW
# prep to export movie
$!EXPORTSETUP EXPORTFNAME = '|MACROFILEPATH|myMovie.mp4'
$!EXPORTSTART
EXPORTREGION = CURRENTFRAME
$!VarSet |CurX| = |XStart|
# loop
$!While |CurX| < |XEnd|
# select text box [you may have to play with these values]
$!PICK ADDALLINRECT
SELECTTEXT = YES
X1 = 1.1
X2 = 4.0
Y1 = 0.4
Y2 = 1.5
$!PICK CLEAR
# select slice
$!SLICEATTRIBUTES 1 PRIMARYPOSITION{X = |CurX|}
$!VarSet |MyFraction| = (|CurX|/|NDim|)
$!ATTACHTEXT
ANCHORPOS
{
X = |TextXPos|
Y = |TextYPos|
Y = 90
}
TEXT = '&(PRIMARYSLICEPOS[1]) (X pos.)n|MyFraction| (X pos./diam.)'
$!REDRAW
$!EXPORTNEXTFRAME
$!VarSet |CurX| += |XDelta|
$!EndWhile
$!EXPORTFINISH

What type of animations do you need to create? If you’d like help with your animations, give us a call at 425-653-1200, e-mail sales@tecplot.com, or browse more Tecplot Macros >>