/* MACHINE-GENERATED ! */

frame inner_pin {
	__0: vec @(-E/2, -C/2)
	__1: vec @(E/2, C/2)
	pad "$n" . __0
}

frame outer_pin {
	__0: vec @(-B/2, -C/2)
	__1: vec @(B/2, C/2)
	pad "$n" . __0
}

frame inner_pins {
	set x = P1*(i-pins/4-1/2)

	set y = (A+C)/2*dy

	set n = a+f*(i-1)

	table
	    { dy, f, a }
	    { 1, -1, pins }
	    { -1, 1, 1 }

	loop i = 2, pins/2-1

	__0: vec @(x, y)
	frame inner_pin .
}

frame outline {
}

frame outer_pins {
	set x = P1*(i-pins/4-1/2)+(P1-P2)*s

	set y = (A+C)/2*dy

	set n = a+f*(i-1)

	table
	    { dy, f, a }
	    { 1, -1, pins }
	    { -1, 1, 1 }

	table
	    { i, s }
	    { 1, 1 }
	    { pins/2, -1 }

	__0: vec @(x, y)
	frame outer_pin .
}

package "MNR-$variant"
unit mm
allow overlap

table
    { pins, variant, A, B, C, D, E, P1, P2, outer_offset, L, W }
    { 4, "02", 0.5mm, 0.375mm, 0.5mm, 1.5mm, B, 0.675mm, P1, P1/2, 1mm, 1mm }
    { 4, "12", 1mm, 0.5mm, 0.75mm, 2.5mm, B, 0.8mm, P1, P1/2, 1.6mm, 1.6mm }
    { 8, "04", 0.5mm, 0.4mm, 0.5mm, 1.5mm, 0.3mm, 0.5mm, 0.525mm, P1/2, 2mm, 1mm }
    { 8, "14", 1mm, 0.5mm, 0.75mm, 2.5mm, 0.4mm, 0.8mm, 0.85mm, P1/2, 3.2mm, 1.6mm }
    { 10, "15", 1mm, 0.48mm, 0.75mm, 2.5mm, 0.32mm, 0.64mm, 0.72mm, 0mm, 3.2mm, 1.6mm }
    { 16, "18", 1mm, 0.3mm, 0.75mm, 2.5mm, B, 0.5mm, P1, P1/2, 4mm, 1.6mm }

__0: vec @(-L/2, -W/2)
__1: vec @(L/2, W/2)
rect __0 . 0.1mm
frame inner_pins @
frame outer_pins @
frame outline @
measx outer_pins.__0 -> inner_pins.__0 -0.7mm
measx inner_pins.__0 -> inner_pins.__0 -0.7mm
measx inner_pins.__0 -> outer_pins.__0 -1mm
measx outer_pins.__0 -> outer_pins.__0 -1.2mm
measy outer_pins.__0 -> outer_pins.__0 0.5mm
measy outer_pin.__0 >> inner_pin.__1 0.75mm
measy outer_pin.__0 -> outer_pin.__1 1mm
measx outer_pin.__0 -> outer_pin.__1 -1mm
measx inner_pin.__0 -> inner_pin.__1 -1mm
