CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Tecplot (https://www.cfd-online.com/Forums/tecplot/)
-   -   Nested loop macro question in tecplot (https://www.cfd-online.com/Forums/tecplot/232553-nested-loop-macro-question-tecplot.html)

Rannnnnnnn December 18, 2020 08:40

Nested loop macro question in tecplot
 
How to use nested loop in tecplot?

If there is only one LOOP, I can use |LOOP| in my program. But when Loops is nested up to two or more levels deep, if I still use |LOOP| in my program, how can tecplot distinguish which |LOOP| is for which LOOP level?

A example of two or more loop level will be easily understood

JohnConnell January 4, 2021 14:20

RE: Nested loop macro question in tecplot
 
Hello,
In nested loops of the Tecplot macro language, the intrinsic |LOOP| variable is bound to the loop number of the inner-most loop. In order to reference the outer loop number, you'll need to save it as a variable.


Here is an example macro of the inner and outer loops:
#!MC 1410
$!LOOP 2
$!VARSET |OuterLoop| = |LOOP|
$!LOOP 3
$!PAUSE "Outer Loop: |OuterLoop|\nInner Loop: |LOOP|"
$!ENDLOOP
$!ENDLOOP




As always feel free to email us at suport@tecplot.com if you have any further questions.


Thanks,
John Connell
Tecplot Support


All times are GMT -4. The time now is 15:12.