ZONENAME in a loop?

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

chasm
Newbie
Posts: 1
Joined: Fri Jan 25, 2008 2:01 pm
Location: Minneapolis, MN
Contact:

ZONENAME in a loop?

Postby chasm » Fri Jan 25, 2008 2:38 pm

Hello,

I have a macro that loops through all my zones, and using GETZONETYPE, I can IF ELSE various settings depending on whether my zone is ordered or FEM.

I would like to add a check based on the ZONENAME, but I cannot figure out how to get the ZONENAME using my loop counter. Things I have tried:

Straightforward:
$!IF "|ZONENAME[|LOOP%3.3d|]|" == "myname"

Hoping for a double variable expansion:
$!VARSET |FOO| = "ZONENAME[|LOOP%3.3d|]"
$!IF "||FOO||" == "myname"

I'd really prefer to stay in macros and not have to learn Python.

-Charles

Ben

Re: ZONENAME in a loop?

Postby Ben » Fri Jan 25, 2008 3:26 pm

The macro language does not understand nested macro variables. For example, this expression:

|ZONENAME[|LOOP|]|

Is interpreted as:
1. Macro variable: |ZONENAME[|
2. Characters "LOOP"
3. Macro variable: |]|

To get around this limitation, you can use the extendmcr add-on. This add-on is not enabled by default (go yell at Jim), so you'll have to edit your tecplot.add file. Then you can do something like this:

Code: Select all

$!Loop |NumZones|
  $!ExtendedCommand
    CommandProcessorID='extendmcr'
    Command='QUERY.ZONENAMEBYNUM |Loop| MyZone'

  $!If "|MyZone|" == "myname"
  ...
  $!EndIf
$!EndLoop


Return to “Tecplot Macro Language”

Who is online

Users browsing this forum: MSN [Bot] and 0 guests