Current directory macro variable

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

User avatar
greg
Newbie
Posts: 5
Joined: Fri Jul 20, 2007 12:24 pm
Location: Bordeaux, FRANCE
Contact:

Current directory macro variable

Postby greg » Mon Feb 23, 2009 6:46 am

Hi,
I cannot find no variable giving the current directory,
I mean the directory that appears when displaying variable
|DATASETFNAME|

I need this to write a quick macro function that replaces
the current plot by the most recent plot file with the same
style parameters.
Thank you !

Gregoire
Je sers la science, et c'est ma joie.
[disciplus simplex]

User avatar
greg
Newbie
Posts: 5
Joined: Fri Jul 20, 2007 12:24 pm
Location: Bordeaux, FRANCE
Contact:

Re: Current directory macro variable

Postby greg » Tue Feb 24, 2009 6:26 am

In fact I use a macro file "test.mcr" with a system call to the bash script "tecp.sh"
(see below) I just figured out that it was not possible to use this, because environment
variables are set on tecplot start-up, and fixed as is unless tecplot is restarted.
Very annoying. Is there is some macro command to update environment variables
without restarting?

--------------------------------------test.mcr
#!MC 1120
# Created by Tecplot 360 build 11.2-0-563
$!System "cp ~/bin/tecp.sh ."
$!System ". ./tecp.sh"
$!System "rm ./tecp.sh"
$!READDATASET '"|$TCR|/|$LST|"'
READDATAOPTION = REPLACE
RESETSTYLE = NO
INCLUDETEXT = NO
INCLUDEGEOM = NO
INCLUDECUSTOMLABELS = NO
VARLOADMODE = BYNAME
ASSIGNSTRANDIDS = YES
$!PICK SETMOUSEMODE
MOUSEMODE = SELECT
$!ACTIVEFIELDMAPS += [|NUMZONES|]


--------------------------------------tecp.sh
#!/bin/bash
export TCR=$PWD
touch temp.txt
ls *.plt > temp.txt
export LST=$(tail temp.txt | sed -n '8p')
rm temp.txt
Je sers la science, et c'est ma joie.

[disciplus simplex]

User avatar
greg
Newbie
Posts: 5
Joined: Fri Jul 20, 2007 12:24 pm
Location: Bordeaux, FRANCE
Contact:

Re: Current directory macro variable

Postby greg » Tue Feb 24, 2009 7:40 am

Never mind, I fixed it using symbolic linking
if anybody feels interested:


------------------------------tecp.sh to insert in ~/bin directory
#!/bin/bash
touch temp.txt
ls *.plt > temp.txt
export LST=$(tail -1 temp.txt)
rm -f temp.txt Last_file.dat
ln -s $LST Last_file.dat

---------------------------------------block to insert in tecplot.mcr
$!MACROFUNCTION

NAME = "Load Last Data"

SHOWINMACROPANEL = TRUE
$!System "tecp.sh"
$!READDATASET '"Last_file.dat"'
READDATAOPTION = REPLACE
RESETSTYLE = NO
INCLUDETEXT = NO
INCLUDEGEOM = NO
INCLUDECUSTOMLABELS = NO
VARLOADMODE = BYNAME
ASSIGNSTRANDIDS = YES
$!PICK SETMOUSEMODE
MOUSEMODE = SELECT
$!ACTIVEFIELDMAPS += [|NUMZONES|]
$!ENDMACROFUNCTION
Je sers la science, et c'est ma joie.

[disciplus simplex]

werdnahman
Newbie
Posts: 9
Joined: Thu May 22, 2014 7:20 am
Location: Louisville

Re: Current directory macro variable

Postby werdnahman » Thu Dec 11, 2014 12:19 pm

I am interested, but I can't get this to work. The symbolic link doesn't work for me since the target isn't a directory (when it is, I get a directory full of symlinks), and so I can't get Tecplot to read in a list of data files to read.

Anyone else tried this lately with more success?
Andrew

UofL CFD


Return to “Tecplot Macro Language”

Who is online

Users browsing this forum: No registered users and 2 guests