Page 1 of 1
Current directory macro variable
Posted: Mon Feb 23, 2009 6:46 am
by greg
Re: Current directory macro variable
Posted: Tue Feb 24, 2009 6:26 am
by greg
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
Re: Current directory macro variable
Posted: Tue Feb 24, 2009 7:40 am
by greg
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
Re: Current directory macro variable
Posted: Thu Dec 11, 2014 12:19 pm
by werdnahman
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?