opening multiple data files using macros

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

nipunarora088
Newbie
Posts: 4
Joined: Sun Mar 30, 2014 9:53 pm
Location: New delhi, India

opening multiple data files using macros

Postby nipunarora088 » Wed Apr 02, 2014 10:22 pm

I have to handle many data files and on each file i have to perform similar functions for which i have already written a macro script. The name of the files are in the numerical order like "plunging_1.plt", "plunging_2.plt","plunging_3.plt",,,,,.

#!MC 1200
# Created by Tecplot 360 build 12.0.0.4231
$!VarSet |MFBD| = 'C:\Program Files (x86)\Tecplot\Tec360 2011\bin'
$!READDATASET '"H:\Plunging_membrane\codes\newman\22_3_14\plunging_1.plt" '



Is it possible to open these files using a for loop instead of opening each file individually and then executing the same commands.

User avatar
salter
Moderator
Posts: 188
Joined: Thu Dec 21, 2006 10:57 am
Location: NASA Langley Research Center
Contact:

Re: opening multiple data files using macros

Postby salter » Thu Apr 03, 2014 6:50 am

Absolutely. Since you know the name of the file, and a digit that changes from file to file in succession, you can develop a macro that regenerates the next file name. In fact, if the file name change is not even numeric, there is still a way to reconstruct a file name in succession but that is more involved.

For your situation, you can use something like:

Code: Select all

$!VarSet |NumFiles| = 102
$!Loop |NumFiles|
  $!ReadDataSet  '"H:\Plunging_membrane\codes\newman\22_3_14\plunging_|loop|.plt" '
...
# Perform rest of macro
...
$!EndLoop

Look at $TEC360HOME/doc/tecplot/tprm.pdf for more information on looping and text use. By default, each instance of any variable is always a text string. It is only when the contents are numeric will it be converted if the context makes sense for the command being used.


Good Luck,
Steve...

Aerospace Research Engineer
Aerothermodynamics Branch
NASA Langley Research Center

nipunarora088
Newbie
Posts: 4
Joined: Sun Mar 30, 2014 9:53 pm
Location: New delhi, India

Re: opening multiple data files using macros

Postby nipunarora088 » Thu Apr 03, 2014 8:49 am

Thanks Steve. This will save a lot of time. Thanks a lot

User avatar
salter
Moderator
Posts: 188
Joined: Thu Dec 21, 2006 10:57 am
Location: NASA Langley Research Center
Contact:

Re: opening multiple data files using macros

Postby salter » Fri Apr 04, 2014 6:55 am

You are most welcome.
Steve...



Aerospace Research Engineer

Aerothermodynamics Branch

NASA Langley Research Center


Return to “Tecplot Macro Language”

Who is online

Users browsing this forum: No registered users and 5 guests