#!/bin/bash # usage: do_generate_bom name # given a project name and $name.sch (or $name.inf if panel), $name.pcb, $name.mapping.csv, # generate the fabrication outputs: gerbers, bom, and xy files DIR="$(dirname "$0")" mkdir -p fab rm -rf fab/"$1".* XY_REMAPS=() if [ -e "$1".sch ]; then # single board "$DIR"/generate_bom "$1".sch #"$DIR"/process_bom.py "$1".bom.csv > "$1".pbom.csv "$DIR"/fill_bom.py "$1".bom.csv "$1".mapping.csv > fab/"$1".fbom.csv elif [ -e "$1".inf ]; then # panel . "$1".inf > "$1".bom.csv PANEL_FILEGROUPS=() XY_REMAPS=() for x in "${PANEL_CONTENTS[@]}"; do offs=0 # if this entry has a tab in it, it has additional fields if [[ "$x" == *" "* ]]; then arr=(${x}) x="${arr[0]}" offs="${arr[1]}" coords="${arr[2]}" XY_REMAPS+=("$coords" "$offs") fi "$DIR"/generate_bom "$x".sch if [ "$offs" != "0" ]; then python remap_bom.py "$x".bom.csv "$offs" "$x".bom.csv.new mv "$x".bom.csv.new "$x".bom.csv fi if [ "$BOM_MAPPING_MODE" == "global" ]; then PANEL_FILEGROUPS+=("$x.bom.csv" "$1.mapping.csv") elif [ "$BOM_MAPPING_MODE" == "individual" ]; then PANEL_FILEGROUPS+=("$x.bom.csv" "$x.mapping.csv") else echo "PANEL_FILEGROUPS must be either global or individual" exit 1 fi done; "$DIR"/fill_bom.py "${PANEL_FILEGROUPS[@]}" > fab/"$1".fbom.csv || exit 1 else echo "error: no $1.sch schematic or $1.inf panel info file found" exit 1 fi iconv -f UTF-8 -t GB18030 fab/"$1".fbom.csv > fab/"$1"-2.fbom.csv || exit 1 "$DIR"/pcb_ops.py "$1".pcb > fab/"$1".xy.csv 2>fab/"$1".log "$DIR"/pcb_ops.py "$1".pcb printpnp > fab/"$1".place.csv 2>>fab/"$1".log if [ "$XY_REMAPS" != "" ]; then mv fab/"$1".xy.csv fab/"$1".xy.unmapped.csv python remap_xy.py fab/"$1".xy.unmapped.csv fab/"$1".xy.csv "${XY_REMAPS[@]}" fi pcb -x gerber --gerberfile fab/"$1" --metric --name-style hackvana "$1".pcb mv fab/"$1".g1 fab/"$1".g2l mv fab/"$1".g2 fab/"$1".g3l pcb -x png --outfile "$1"-top.png --dpi 500 --photo-mode "$1".pcb pcb -x png --outfile "$1"-bottom.png --dpi 500 --photo-mode --photo-flip-y "$1".pcb "$DIR"/display_smt.py fab/"$1".fbom.csv fab/"$1".xy.csv "$1"-top.png "$1"-bottom.png "$1"-smt- 500 #"$DIR"/display_smt.py fab/"$1".fbom.csv fab/"$1".place.csv "$1"-top.png "$1"-bottom.png "$1"-smt- 500