#!/bin/bash set -x echo fish foo() { F="$1.kicad_mod" echo -n > $F cat << EOF >> $F (footprint "$F" (version 20240108) (generator "pcbnew") (generator_version "8.0") (layer "F.Cu") (property "Reference" "REF**" (at 0 -2 0) (unlocked yes) (layer "F.SilkS") (uuid "$(uuidgen)") (effects (font (size 1 1) (thickness 0.15) ) ) ) (property "Value" "ipad_air_2_lcd_mb" (at 0 1 0) (unlocked yes) (layer "F.Fab") (uuid "$(uuidgen)") (effects (font (size 1 1) (thickness 0.15) ) ) ) (property "Footprint" "" (at 0 0 0) (unlocked yes) (layer "F.Fab") (hide yes) (uuid "$(uuidgen)") (effects (font (size 1 1) (thickness 0.15) ) ) ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) (layer "F.Fab") (hide yes) (uuid "$(uuidgen)") (effects (font (size 1 1) (thickness 0.15) ) ) ) (property "Description" "" (at 0 0 0) (unlocked yes) (layer "F.Fab") (hide yes) (uuid "$(uuidgen)") (effects (font (size 1 1) (thickness 0.15) ) ) ) (attr smd) EOF h=$[ $2 - 1 ] p=1 my="$3" mh="$4" s1="$5" s2="$6" for i in $(seq 0 $h); do x=$(echo "scale=10;($i-($h / 2))*0.35" | bc) cat << EOF >> $F (pad "$p" smd rect (at $x $s1$my) (size 0.223 $mh) (layers "F.Cu" "F.Paste" "F.Mask") (uuid "$(uuidgen)") ) EOF p=$[$p +1] cat << EOF >> $F (pad "$p" smd rect (at $x $s2$my) (size 0.223 $mh) (layers "F.Cu" "F.Paste" "F.Mask") (uuid "$(uuidgen)") ) EOF p=$[$p +1] done ew=1.3 eh=2 h=$[ $h + 2 ] x=$(echo "scale=10;(($h / 2)*0.35) + (($ew -0.223)/2)" | bc) cat << EOF >> $F (pad "MP" smd rect (at -$x 0 180) (size $ew $eh) (layers "F.Cu" "F.Paste" "F.Mask") (uuid "$(uuidgen)") ) (pad "MP" smd rect (at $x 0 180) (size $ew $eh) (layers "F.Cu" "F.Paste" "F.Mask") (uuid "$(uuidgen)") ) ) EOF } foo ipad_mini_4_lcd_mb 21 0.95 0.8 "" "-" foo ipad_mini_4_lcd_fl 21 0.55 0.9 "-" "" foo ipad_air_2_lcd_mb 21 0.75 0.5 "" "-" foo ipad_air_2_lcd_fl 30 0.55 0.9 "-" ""