#!/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"