Making threshold for variables in makro

Tecplot's automation language

Python scripts were supported in the alpha version for Legacy 360 (2013). Python inquiries in 2017 should be directed to the PyTecplot Forum.

Moderators: davetaflin, salter, steve, jprenaud, straton, Chris Idso

morten
Newbie
Posts: 5
Joined: Mon Jun 25, 2012 5:16 am
Location: Denmark

Making threshold for variables in makro

Postby morten » Sun Dec 30, 2012 3:32 am

Hi,
I want to make a cut off for some data in tecplot.
In macros I can call this data by {O} when e.g. using the alterdata command.

I want to set {O} to zero when it is below a given threeshold, say 0.05.

I have tried

$!IF {O}<0.05
{O}=0
$!ENDIF

but the first line is not accepted.

Thus, my problem at the moment is, that I don't know how to make if statements for the data, only for variables with a single value defined in the macro.

Any help would be greatly appreciated.
/Morten

Chris Idso
Jedi Master
Posts: 249
Joined: Mon Jan 15, 2007 10:07 am
Location: Bellevue, WA
Contact:

Re: Making threshold for variables in makro

Postby Chris Idso » Wed Jan 02, 2013 10:30 am

Morten,

Tecplot's macro language does have an IF statement, but it only works on variables that are declared within the macro, using the VARSET statement.

You can access the data you have loaded into Tecplot from the macro language, but you have to do it using function calls. Specifically, you can fetch a value of a variable for a given zone using the GETFIELDVALUE function, and you can set a value of a variable in a given zone using the SETFIELDVALUE function.

You would need to check all of the values of the desired variable in a given zone, and there is no way to check them all at once, so you will need to cycle through all the values for the desired variable in the desired zone one at a time in a loop (the macro language has LOOP and ENDLOOP statements). You can use the GETFIELDVALUE and SETFIELDVALUE statements within the loop to fetch each value and then reset it if you need to.
Chris


Christopher Idso

Tech Support Lead
Tecplot, Inc

Chris Idso
Jedi Master
Posts: 249
Joined: Mon Jan 15, 2007 10:07 am
Location: Bellevue, WA
Contact:

Re: Making threshold for variables in makro

Postby Chris Idso » Thu Jan 03, 2013 1:37 pm

Morten,

You can find the syntax for the GETFIELDVALUE and SETFIELDVALUE commands in Tecplot Reference Manual which is in the Doc folder within your Tecplot folder. The reference manual filename is tprm.pdf.
Chris





Christopher Idso



Tech Support Lead

Tecplot, Inc


Return to “Tecplot Macro Language”

Who is online

Users browsing this forum: No registered users and 1 guest

cron