← Back to team overview

kicad-developers team mailing list archive

Re: Kicad libraries for pcbnew

 

--- In kicad-devel@xxxxxxxxxxxxxxx, Vesa Solonen <vsolonen@...> wrote:

> IMO the scripted method for making the land patterns is very much 
> preferred to anyting else. Please keep up the good work.

I'm doing something similar too, when generating whole libs of components... for example I used the following script when generating a whole family ofPhoenix COMBICON connectors (it's zsh, most probably works with bash too, possibly changing the declaration syntax)

#!/bin/zsh
PINS=$1
EDPNO=$2
float DMIL=393.7
integer PADSIZE=925
integer DRILL=512
integer PITCH=2000
integer LASTPINPOS=$((($PINS-1)*$PITCH))
integer X1=-1000
integer X2=$(($LASTPINPOS+1000))
integer Y2=$(($DMIL*4.6))
integer Y1=$(($DMIL*(-9.8+4.6)))
integer YR=$(($DMIL*3.6))
integer LABELX=$((LASTPINPOS/2))
cat <<EOF
PCBNEW-LibModule-V1 gio 05 feb 2009 09:44:12 CET
\$INDEX
COMBICON-MKDS1,5-$EDPNO-5,08
\$EndINDEX
\$MODULE COMBICON-MKDS1,5-$EDPNO-5,08 
Po 0 0 0 15 4989816F 498AA5CE ~~
Li COMBICON-MKDS1,5-$EDPNO-5,08
Cd Phoenix COMBICON MKDS1,5 vertical terminal block $PINS pin, 5.08mm pitch
Sc 498AA5CE
AR 
Op 0 0 0
T0 $LABELX 0 250 250 0 50 N V 21 N"COMBICON-MKDS1,5-$EDPNO-5,08"
T1 $LABELX 500 250 250 0 50 N I 21 N"COMBICON-MKDS1,5-$EDPNO-5,08"
DS $X1 $Y1 $X2 $Y1 120 21
DS $X1 $Y2 $X2 $Y2 120 21
DS $X1 $YR $X2 $YR 120 21
DS $X1 $Y1 $X1 $Y2 120 21
DS $X2 $Y1 $X2 $Y2 120 21
\$PAD
Sh "1" R $PADSIZE $PADSIZE 0 0 1800
Dr $DRILL 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 0 0
\$EndPAD
EOF
for PIN in $(seq 2 $PINS); do
integer PINPOS=$((($PIN-1)*$PITCH))
cat <<EOF
\$PAD
Sh "$PIN" C $PADSIZE $PADSIZE 0 0 1800
Dr $DRILL 0 0
At STD N 00E0FFFF
Ne 0 ""
Po $PINPOS 0
\$EndPAD
EOF
done
cat <<EOF
\$EndMODULE COMBICON-MKDS1,5-$EDPNO-5,08
\$EndLIBRARY
EOF

With this approach I usually draw a prototype with the editor to get the entities right, then I 'parametrize' it with some shell subst (perl would be useful too :D)

I generate the .emp to avoid the timestamp issues. I have to lay out the modules on the 'catalog' board, anyway, so it's not a big time waste.








References