diff --git a/fab/prettygerbv b/fab/prettygerbv index d01e2ff..a408359 100755 --- a/fab/prettygerbv +++ b/fab/prettygerbv @@ -2,8 +2,8 @@ # # prettygerbv - Use gerbv to generate "pretty" views of a PCB # -# Written 2011, 2013 by Werner Almesberger -# Copyright 2011, 2013 Werner Almesberger +# Written 2011, 2013, 2017 by Werner Almesberger +# Copyright 2011, 2013, 2017 Werner Almesberger # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -58,11 +58,16 @@ EOF choose() { - if [ -e "$1-$3" ]; then - echo "$1-$3" - else - echo "$1-$2" - fi + name=$1 + shift + for n in "$@"; do + if [ -e "$name-$n" ]; then + echo "$name-$n" + return + fi + done + echo "no choice for $@" 1>&2 + exit 1 } @@ -81,12 +86,12 @@ run_gerbv() front() { layers_begin 5 - layer `choose $NAME Front.gtl F_Cu.gtl` $COPPER + layer `choose $NAME Front.gtl F_Cu.gtl F.Cu.gbr` $COPPER [ "$drill" ] && layer $drill $DRILL - layer `choose $NAME SoldP_Front.gtp F_Paste.gtp` $PASTE - layer `choose $NAME Mask_Front.gts F_Mask.gts` $INV $MASK - layer `choose $NAME SilkS_Front.gto F_SilkS.gto` $SILK - layer `choose $NAME PCB_Edges.gbr Edge_Cuts.gbr` $EDGE + layer `choose $NAME SoldP_Front.gtp F_Paste.gtp F.Paste.gbr` $PASTE + layer `choose $NAME Mask_Front.gts F_Mask.gts F.Mask.gbr` $INV $MASK + layer `choose $NAME SilkS_Front.gto F_SilkS.gto F.SilkS.gbr` $SILK + layer `choose $NAME PCB_Edges.gbr Edge_Cuts.gbr Edge.Cuts.gbr` $EDGE layers_end run_gerbv "$1" @@ -96,12 +101,12 @@ front() back() { layers_begin 5 - layer `choose $NAME Back.gbl B_Cu.gbl` $COPPER + layer `choose $NAME Back.gbl B_Cu.gbl B.Cu.gbr` $COPPER [ "$drill" ] && layer $drill $DRILL - layer `choose $NAME SoldP_Back.gbp B_Paste.gbp` $PASTE - layer `choose $NAME Mask_Back.gbs B_Mask.gbs` $INV $MASK - layer `choose $NAME SilkS_Back.gbo B_SilkS.gbo` $SILK - layer `choose $NAME PCB_Edges.gbr Edge_Cuts.gbr` $EDGE + layer `choose $NAME SoldP_Back.gbp B_Paste.gbp B.Paste.gbr` $PASTE + layer `choose $NAME Mask_Back.gbs B_Mask.gbs B.Mask.gbr` $INV $MASK + layer `choose $NAME SilkS_Back.gbo B_SilkS.gbo B.SilkS.gbr` $SILK + layer `choose $NAME PCB_Edges.gbr Edge_Cuts.gbr Edge.Cuts.gbr` $EDGE layers_end run_gerbv _tmp.png @@ -113,9 +118,9 @@ back() conn() { layers_begin 3 - layer `choose $NAME Back.gbl B_Cu.gbl` $BACK - layer `choose $NAME Front.gtl F_Cu.gtl` $FRONT - layer `choose $NAME PCB_Edges.gbr Edge_Cuts.gbr` $EDGE2 + layer `choose $NAME Back.gbl B_Cu.gbl B.Cu.gbr` $BACK + layer `choose $NAME Front.gtl F_Cu.gtl F.Cu.gbr` $FRONT + layer `choose $NAME PCB_Edges.gbr Edge_Cuts.gbr Edge.Cuts.gbr` $EDGE2 layers_end run_gerbv "$1"