Created
October 12, 2018 22:42
-
-
Save hidsh/248c9eb4916e44627c614449c5809690 to your computer and use it in GitHub Desktop.
shell script: rename gerber files to place an order to elecrow.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Rename gerber-files from KiCAD to place an order to `elecrow.com` | |
# | |
# This script is fully based on renamer_elecrow.sh by tnishinaga: https://gist.github.com/tnishinaga/feeb86415ecf977a59615baa9846e4e0 | |
# THX! | |
# | |
usage() | |
{ | |
echo "Rename gerber-files from KiCAD according to elecrow.com's order-rules" | |
echo | |
echo " USAGE: `basename $0` FILENAME_PREFIX" | |
echo " e.g. `basename $0` hoge <-- hoge-F.Cu.gbr, hoge-B.Cu.gbr, ..." | |
echo | |
echo " hoge-F.Cu.gbr --> hoge.GTL # TOP CUPPER LAYER" | |
echo " hoge-B.Cu.gbr --> hoge.GBL # BOTTOM CUPPER LAYER" | |
echo " hoge-F.Mask.gbr --> hoge.GTS # TOP SOLDER MASK" | |
echo " hoge-B.Mask.gbr --> hoge.GBS # BOTTOM SOLDER MASK" | |
echo " hoge-F.SilkS.gbr --> hoge.GTO # TOP SILK SCREEN" | |
echo " hoge-B.SilkS.gbr --> hoge.GBO # BOTTOM SILK SCREEN" | |
echo " hoge.drl (v4) --> hoge.TXT # DRILL (PLATED)" | |
echo " hoge-PTH.drl (v5) --> hoge.TXT # DRILL (PLATED)" | |
echo " hoge-NPTH.drl --> hoge-NPTH.TXT # DRILL (NON-PLATED)" | |
echo " hoge-Edge.Cuts.gbr --> hoge.GML # OUTLINE (ROUTER)" | |
echo | |
echo " CAUTION: supported 2 layer PCB only." | |
exit 1; | |
} | |
do_rename() | |
{ | |
src=$1 | |
dest=$2 | |
[ -e $src ] || { echo " \"$src\" is not found."; return 1; } | |
mv $src $dest | |
} | |
do_rename_or_quit() | |
{ | |
src=$1 | |
dest=$2 | |
[ -e $src ] || { echo " \"$src\" is not found."; exit 1; } | |
mv $src $dest | |
} | |
### entry point is here | |
[ $# -eq 1 ] || usage | |
PREFIX=$1 | |
do_rename_or_quit "$PREFIX"-F.Cu.gbr "$PREFIX".GTL | |
do_rename_or_quit "$PREFIX"-B.Cu.gbr "$PREFIX".GBL | |
do_rename_or_quit "$PREFIX"-F.Mask.gbr "$PREFIX".GTS | |
do_rename_or_quit "$PREFIX"-B.Mask.gbr "$PREFIX".GBS | |
do_rename_or_quit "$PREFIX"-F.SilkS.gbr "$PREFIX".GTO | |
do_rename_or_quit "$PREFIX"-B.SilkS.gbr "$PREFIX".GBO | |
do_rename "$PREFIX".drl "$PREFIX".TXT | |
do_rename "$PREFIX"-PTH.drl "$PREFIX".TXT | |
do_rename "$PREFIX"-NPTH.drl "$PREFIX"-NPTH.TXT | |
do_rename_or_quit "$PREFIX"-Edge.Cuts.gbr "$PREFIX".GML |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment