#!/bin/ksh
#
###
### necessary scale factor: (1/dpi*254) (eg. 1/300*25.4=.08458)
###
# MODE=layer
# MODE=draw
# MODE=plot
MODE=""
if [ -z "$1" ] ; then
echo "No working mode specified!"
echo "Usage: `basename $0` mode"
echo "Valid modes are: layer, draw, plot or all."
fi
MODE=$1
DATA_DIR=~/eagle/rot_facility
MACRODIR=/cad/VariCAD/Macros
# ==========================================================
# macro header
# ==========================================================
macro_header()
{
echo "Creating VariCAD macro '$MACROFIL'...\c"
echo "# macro $MACRONAM
# # of values;ortho;step;aperture;x step; y step;X win;Y win
Set;7;1;0;4;1;1;869;626
# command: als
CmdN;+;394
# Taste ; Aus
Panel;+;0;1;1;;
# Taste II ; OK
Panel;+;0;3;1;;" >> $MACROFIL
}
# ==========================================================
# layer macro
# -----------------------------
macro_layr()
{
echo "
# included command: lay
ICmdN;+;226
# Taste II ; Neu
Panel;+;0;2;1;;
# Taste ; $LAYER_CNT.
Panel;+;1;$LAYER_CNT;1;;
>Text;1;l$DIMENS
# Taste II ; OK
Panel;+;1;18;1;;
>Text;1;l$DIMENS
# Taste II ; Zuruck
Panel;+;0;7;1;;" >> $MACROFIL
LAYER_CNT=`expr $LAYER_CNT + 1`
}
# ==========================================================
# data import macro
# -----------------------------
macro_draw()
{
echo "
# included command: lay
ICmdN;+;226
# Textwahl
Panel;+;0;1;$LAYER_CNT;l$DIMENS
# command: gra
CmdN;+;2
File;+;/home/gerhardr/eagle/rot_facility/$DATA
BS;File" >> $MACROFIL
LAYER_CNT=`expr $LAYER_CNT + 1`
}
# ==========================================================
# plot macro
# -----------------------------
macro_plot()
{
echo "
# command: bla
CmdN;+;32
# Objekte zum Ausblenden wahlen
SegR;+;o;101.504;35.6148
Region;+;104.311;35.9976;104.439;36.2528
RET;SegR
ESC;SegR
# command: ubl
CmdN;+;33
Menu;+;2
# Textwahl
Panel;+;0;1;$LAYER_CNT;l$DIMENS
Y-N;+;1
# Taste II ; Zuruck
Panel;+;0;2;1;;
BS;Menu
# command: prn
CmdN;+;420
# Textwahl ; (Kompatiblen) Drucker wahlen:
Panel;+;1;1;8;HPGL Plotter (pen plotter)
>Text;4;;
# Taste ; Ausgabe un Datei
Panel;+;1;3;1;;
>Text;4;lpr %s
# Taste II ; OK
Panel;+;1;5;1;;
>Text;4;/home/gerhardr/eagle/rot_facility/$TOOL_N.hpg
# Taste II ; Drucken
Panel;+;3;20;1;;
>Text;8;1
>Text;13;297
>Text;14;420" >> $MACROFIL
LAYER_CNT=`expr $LAYER_CNT + 1`
}
# ==========================================================
# MAIN function begin
# ==========================================================
cd $DATA_DIR
LAYER_CNT=3
case $MODE in
l* ) MACROFIL=$MACRODIR/mk_layr.mcr ;;
d* ) MACROFIL=$MACRODIR/mk_draw.mcr ;;
p* ) MACROFIL=$MACRODIR/mk_plot.mcr ;;
a* ) $0 layer
$0 draw
$0 plot
exit 0;;
* ) echo "Invalid mode '$MODE', valid modes are: layer, draw, plot or all."
exit 1 ;;
esac
rm -f $MACROFIL
macro_header
for DATA in tool-?.????.dat
do DIMENS=`echo $DATA|cut -c8-11`
TOOL_N=`echo $DATA|cut -c1-11`
case $MODE in
l* ) macro_layr ;;
d* ) macro_draw ;;
p* ) macro_plot ;;
esac
done
echo " created."
gerhard.reithofer@tech-edv.co.at