summaryrefslogtreecommitdiff
path: root/trunk/darwin/electronics/Arduino-Sanguino/eagle_package_release
blob: 98dec99a4a0b4b630b46ebd2c0d070f447fa0bd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash

#########################################################################
#
# usage: ./eagle_package_release board_name [version]
#
# running this script will generate an electronics release file suitable for release on sourceforge and for production use.
# it will produce the following files in a .zip file:
# 
# * gerber
# * postscript
# * pdf
# * png
# * povray render
#
# installation / required tools:
#
# this script is for linux.  recommend using Ubuntu.
#
# *eagle*
# you must have eagle in your path somewhere.  we recommend using the latest version
# download here: http://www.cadsoft.de/download.htm
# (dont forget to add it to your $PATH in ~/.bashrc)
# 
# *povray*
# this is the 3D rendering engine.  its pretty easy to install:
# sudo apt-get install povray povray-includes
#
#########################################################################

#init up
BOARD=`basename $1`
VERSION=${2:-`date +%Y-%m-%d`}
TO_DIR="reprap-$BOARD-$VERSION"
FILELIST=""

#directory structure
echo "Making Files..."
mkdir -p "$TO_DIR"
mkdir -p "$TO_DIR/gerber"
mkdir -p "$TO_DIR/ps"
mkdir -p "$TO_DIR/eagle"
mkdir -p "$TO_DIR/renders"

#create our gerber files!
echo "Creating Gerber Files..."
eagle -X -N -d GERBER_RS274X -o "$TO_DIR/gerber/ComponentTraces.pho" $BOARD/*.brd Top Pads Vias tGND_GNDA
eagle -X -N -d GERBER_RS274X -o "$TO_DIR/gerber/CopperTraces.pho" $BOARD/*.brd Bottom Pads Vias
eagle -X -N -d GERBER_RS274X -o "$TO_DIR/gerber/SolderMaskComponent.pho" $BOARD/*.brd tStop
eagle -X -N -d GERBER_RS274X -o "$TO_DIR/gerber/SolderMaskCopper.pho" $BOARD/*.brd bStop
eagle -X -N -d GERBER_RS274X -o "$TO_DIR/gerber/SilkScreen.pho" $BOARD/*.brd Dimension tPlace tDocu tValues tNames
eagle -X -N -d GERBER_RS274X -o "$TO_DIR/gerber/TopCream.pho" $BOARD/*.brd Dimension tCream
eagle -X -N -d GERBER_RS274X -o "$TO_DIR/gerber/BottomCream.pho" $BOARD/*.brd Dimension bCream

# Drill data for NC drill st.
# warning : eagle takes path of -R option from input file directory.
eagle -X -N -d EXCELLON -E -0.02 -E 0.1 -R ${BOARD}.drl -o $TO_DIR/gerber/${BOARD}.drd ${BOARD}/*.brd Drills Holes
cp $BOARD/*.drl $TO_DIR/gerber 

#clean up the process
rm -rf $TO_DIR/gerber/*.gpi 
rm -rf $TO_DIR/gerber/*.dri 

echo "Creating PS Files..."
eagle -X -N -d PS -o "$TO_DIR/ps/Schematic.ps" $BOARD/*.sch Nets Busses Symbols Names Values
eagle -X -N -d PS -o "$TO_DIR/ps/ComponentTraces.ps" $BOARD/*.brd Top Pad Via Dimension tGND_GNDA
eagle -X -N -d PS -o "$TO_DIR/ps/ComponentSilkscreen.ps" $BOARD/*.brd Pad Via Dimension tPlace tNames tDocu tValues
eagle -X -N -d PS -o "$TO_DIR/ps/CopperTraces.ps" $BOARD/*.brd Bottom Pad Via Dimension
eagle -X -N -d PS -o "$TO_DIR/ps/CopperSilkscreen.ps" $BOARD/*.brd Pad Via Dimension bPlace bNames bDocu
eagle -X -N -d PS -o "$TO_DIR/ps/TopCream.ps" $BOARD/*.brd Dimension tCream
eagle -X -N -d PS -o "$TO_DIR/ps/BottomCream.ps" $BOARD/*.brd Dimension bCream

#convert to pdf...
echo "Converting to PDF..."
cp -a "$TO_DIR/ps" "$TO_DIR/pdf"
for PS in $TO_DIR/pdf/*.ps
do
	TO_FILE=`basename $PS .ps`.pdf
	ps2pdf $PS $TO_DIR/pdf/$TO_FILE
done
rm $TO_DIR/pdf/*.ps

#convert to png...
echo "Converting to PDF..."
cp -a "$TO_DIR/ps" "$TO_DIR/png"
for PS in $TO_DIR/png/*.ps
do
	TO_FILE=`basename $PS .ps`.png
	echo "gs -dNOPAUSE -dBATCH -sDEVICE=png256 -sOutputFile=$TO_DIR/png/$TO_FILE $PS"
	gs -dNOPAUSE -dBATCH -sDEVICE=png256 -sOutputFile=$TO_DIR/png/$TO_FILE $PS
done
rm $TO_DIR/png/*.ps


#render our board with POVRay and eagle3d - high quality
if [ -f ${BOARD}/${BOARD}.pov ]
then
	echo "Rendering board with eagle3D and POVRay..."
	#eagle -X -N -d eagle3D/ulp/3d41.ulp -o "$TO_DIR/renders/render.pov" $BOARD/*.brd
	povray eagle3D/render.ini +I${BOARD}/${BOARD}.pov +Otemp.png +FN +W1200 +H1024 +Q9 +A +AM2 -D -V +WL0
	mv temp.png ${TO_DIR}/renders/${BOARD}.png
	cp ${BOARD}/*.pov ${TO_DIR}/renders
else
	echo "No .pov file found, not rendering 3D version of board."
fi

#create our source dir
cp $BOARD/*.brd "$TO_DIR/eagle/";
cp $BOARD/*.sch "$TO_DIR/eagle/";

if [ -d ${BOARD}/exerciser ]
then
	svn export https://reprap.svn.sourceforge.net/svnroot/reprap/trunk/reprap/electronics/${BOARD}/exerciser "$TO_DIR/exerciser"
	echo "Exporting exerciser scripts."
else
	echo "No exerciser directory found, bailing."
fi

#create our archive
echo "Archiving..."
zip -qr "$TO_DIR.zip" "$TO_DIR"

#cleanup
echo "Cleanup..."
rm -rf "$TO_DIR"

#done!
echo "Release v$VERSION created as ${TO_DIR}.zip"