Updated the shipped documentation from the online wiki
[geda-gaf/peter-b.git] / gnetlist / scripts / sch2eaglepos.sh
blob08afb67e74295964b1e081bb47715b75e772e26f
1 #!/bin/bash
2 # By Braddock Gaskill (braddock@braddock.com), August 2004. This
3 # software is hereby declared to be in the public domain by Braddock
4 # Gaskill, the author.
5 FNAME="$1"
6 if [ -z "$FNAME" ]; then
7 echo "$0 <inputfile.sch>"
8 echo "This script will read a gschem schematic and attempt to
9 extract the relative positions of the components in the schematic,
10 and generate corresponding MOVE instructions for Eagle. You will
11 likely have to adjust XOFFSET, YOFFSET, XSCAL, and YSCALE at the
12 top of the script to obtain usable positions."
13 echo "By Braddock Gaskill (braddock@braddock.com), August 2004"
14 exit -1;
16 XOFFSET=40000
17 YOFFSET=33000
18 #XSCALE=10000
19 #YSCALE=10000
20 XSCALE=9000
21 YSCALE=9000
23 TMP=/tmp/$$
24 grep -B1 refdes= "$FNAME" |sed 's/=/ /' | cut -d" " -f2,3 |grep -v '^--' >/tmp/$$
26 3<$TMP
27 while read -u 3; do
28 # the directory on the client to backup
29 X=`echo $REPLY | cut -d' ' -f1`
30 Y=`echo $REPLY | cut -d' ' -f2`
31 read -u 3;
32 PART="$REPLY"
33 X=`echo "scale=5; ($X - $XOFFSET) / $XSCALE" |bc`
34 Y=`echo "scale=5; ($Y - $YOFFSET) / $YSCALE" |bc`
35 echo "MOVE '$PART' ($X $Y);"
36 done
37 rm "$TMP"