-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkicad_release.sh
More file actions
executable file
·66 lines (46 loc) · 1.41 KB
/
kicad_release.sh
File metadata and controls
executable file
·66 lines (46 loc) · 1.41 KB
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
#!/bin/bash
#edit these
PCB_FILE=$1
#Layers to export
LAYERS="F.Cu,B.Cu,B.Paste,F.Paste,B.Mask,F.Mask,F.Silkscreen,B.Silkscreen,Edge.Cuts"
if [ -z $PCB_FILE ]; then
echo "Usge $0 pcb_file_name"
exit 1
fi
#Test if pcb file exists
if [ ! -e $PCB_FILE ]; then
echo "File $PCB_FILE does not exist."
exit 1
fi
#Halt on any error
set -e
#Output directory
PCBOUTDIR=release_plot
#Utils
GERBV=gerbv
EVINCE=evince
# Replace this whatever you want. It will be visible with the filename
VERSION=`git describe --tags`
#Don't edit further
DATE_S=`date +%Y%m%d`
OUTFILEBASE=${PCB_FILE%.*}_${VERSION}_${DATE_S}
#create destination directory, if not existed.
mkdir -p $PCBOUTDIR
#clean up
rm -rf $PCBOUTDIR/*
rm -f *.tar.bz2 *.rar *.zip
#do the output
echo -e "\n\nCreating output...\n"
kicad-cli pcb export gerbers -o ${PCBOUTDIR}/ -l ${LAYERS} --ev --subtract-soldermask --use-drill-file-origin ${PCB_FILE}
kicad-cli pcb export drill --excellon-separate-th --drill-origin plot --generate-map -o ${PCBOUTDIR}/ ${PCB_FILE}
kicad-cli pcb export pos --units mm --use-drill-file-origin -o ${PCBOUTDIR}/xy.csv ${PCB_FILE}
#pack
echo -e "\n\nCreating archive...\n"
tar -jcvf ${OUTFILEBASE}.tar.bz2 ${PCBOUTDIR}
rar a ${OUTFILEBASE}.rar ${PCBOUTDIR}
zip -r ${OUTFILEBASE}.zip ${PCBOUTDIR}
#profit
echo -e "\n\nShowing results...\n"
${GERBV} "${PCBOUTDIR}"/*.{g??,drl} >/dev/null 2>&1 &
${EVINCE} ${PCBOUTDIR}/*.pdf >/dev/null 2>&1 &
exit 0