/* MACHINE-GENERATED ! */

frame via {
	set d = 0.2mm

	__0: vec @(d/2, d/2)
	__1: vec @(-d/2, -d/2)
	hole . __0
}

frame antenna {
	set w = 5mil

	__0: vec @(W1/2, -D4/2)
	__1: vec .(0mm, L6)
	__2: vec .(D5, 0mm)
	__3: vec .(W2, 0mm)
	__4: vec @(-W1/2, D4/2)
	pad "1" __0 . trace
	pad "X" . __1 trace
	__5: vec .(-D1, 0mm)
	__6: vec __1(-W1, 0mm)
	__33: vec .(0mm, W2)
	__34: vec .(-D1, D2)
	line __5 . w
	__7: vec __3(D6, 0mm)
	__8: vec .(W2, 0mm)
	__9: vec .(0mm, W2)
	pad "X" __6 . trace
	__10: vec __3(0mm, -L6)
	__11: vec .(-W2, D4)
	pad "2" . __10 trace
	pad "X" . __3 trace
	__12: vec __7(0mm, -L4)
	__13: vec .(W2, 0mm)
	pad "X" __7 . trace
	__14: vec .(L5, 0mm)
	__15: vec .(0mm, W2)
	pad "X" __13 . trace
	__18: vec .(0mm, L4)
	__19: vec .(L2, 0mm)
	__20: vec .(0mm, -W2)
	pad "X" __18 . trace
	__25: vec .(-W2, 0mm)
	__21: vec .(0mm, -L4)
	__22: vec .(W2, 0mm)
	pad "X" __25 . trace
	__23: vec .(L5, 0mm)
	__16: vec __14(W2, 0mm)
	__17: vec .(0mm, L4)
	pad "X" __14 . trace
	__24: vec __23(W2, 0mm)
	__26: vec .(0mm, L4)
	pad "X" __23 . trace
	__27: vec __23(0mm, W2)
	pad "X" __22 . trace
	__28: vec .(0mm, L4)
	__29: vec .(L2, 0mm)
	__30: vec .(0mm, -W2)
	pad "X" __28 . trace
	__31: vec .(-W2, 0mm)
	__32: vec __30(0mm, -L1)
	pad "X" __31 . trace
	__38: vec .(tail, W2)
// @@@ avoid problems with zero-sized tails. Note that this breaks non-zero
// tails. Anyone trying to use these experimental antennas is advised to
// switch to kicad-libs/modules/meander-2450MHz.fpd instead.
//	pad "X" __32 . trace
	__35: vec __29(D3+tail, D2)
	line . __34 w
	__36: vec .(0mm, -(D2+W2+L6-D4))
	line __35 . w
	__37: vec .(-(W2+L5+L2+L5+L2+D3+tail), 0mm)
	line __36 . w
	frame via @
}

package "MEANDER-$size"
unit mm
allow touch

table
    { L1, L2, L3, L4, L5, L6 }
    { 3.94mm, 2.7mm*size/100, 5mm, 2.64mm, 2mm*size/100, 4.9mm }

table
    { W1, W2 }
    { 0.9mm, 0.5mm }

table
    { D1, D2, D3, D4, D5, D6 }
    { 0.5mm, 0.3mm, 0.3mm, 0.5mm, 1.4mm, 1.7mm }

set __tail = 3*W2

set tail = 0mm

table
    { size }
    { 80 }
    { 90 }
    { 100 }
    { 105 }
    { 110 }
    { 115 }
    { 120 }

__0: vec @(0mm, 0.1mm)
frame antenna .
measx antenna.__33 >> antenna.__9 1mm
measx antenna.__18 >> antenna.__19 1mm
measx antenna.__28 >> antenna.__29 1mm
measx antenna.__29 >> antenna.__35 1mm
measx antenna.__21 >> antenna.__22 -1mm
measx antenna.__22 >> antenna.__23 -1mm
measx antenna.__23 >> antenna.__24 -1mm
measx antenna.__12 >> antenna.__13 -1mm
measx antenna.__13 >> antenna.__14 -1mm
measx antenna.__14 >> antenna.__16 -1mm
measx antenna.__1 >> antenna.__2 -0.5mm
measx antenna.__3 >> antenna.__7 -0.5mm
measx antenna.__5 >> antenna.__4
measy antenna.__33 >> antenna.__34 1mm
measy antenna.__0 >> antenna.__4 W1
measy antenna.__10 >> antenna.__11 W2
measx antenna.__4 >> antenna.__0 -D4-1mm
measx antenna.__11 >> antenna.__10 -D4-1mm
measy antenna.__6 >> antenna.__33 1mm
measx antenna.__31 >> antenna.__32 -L1-1mm
measy antenna.__8 >> antenna.__9 -1mm
measy antenna.__20 >> antenna.__19 -1mm
measy antenna.__30 >> antenna.__29 -1mm-tail
measy antenna.__21 >> antenna.__25 0.5mm
measy antenna.__12 >> antenna.__7 0.5mm
measy antenna.__32 >> antenna.__30 -1mm-tail
measx antenna.__34 >> antenna.__35 1.5mm-D2
measy antenna.__5 >> antenna.__34 1.5mm-D1
measx antenna.__32 >> antenna.__38 -1mm
