/* MACHINE-GENERATED ! */

frame mechholes {
	table
	    { x }
	    { e*(n-2)/2 }
	    { -e*(n-2)/2 }

	set diameter = 0.75mm

	__0: vec @(0mm, x)
	__1: vec .(-diameter/2, -diameter/2)
	__2: vec __0(diameter/2, diameter/2)
	hole __1 .
}

frame pinholes {
	set x = (ix-0.5)*pitch_x

	set y = (iy-(2*n-2)/4)*e*dy

	set pin = ix*n+iy+1

	table
	    { ix, dy }
	    { 0, -1 }
	    { 1, 1 }

	set pitch_x = 1.27mm

	set hgx = 2.2mm

	set diameter = 0.71mm

	loop iy = 0, n-1

	__0: vec @(x, y)
	__1: vec .(diameter/2, diameter/2)
	__2: vec __0(-diameter/2, -diameter/2)
	hole . __1
}

frame pads {
	set x = (ix-0.5)*(gx+px)

	set y = (iy-(2*n-2)/4)*e*dy

	set pin = ix*n+iy+1

	table
	    { ix, dy }
	    { 0, -1 }
	    { 1, 1 }

	loop iy = 0, n-1

	__0: vec @(x, y)
	__1: vec .(px/2, py/2)
	__2: vec __0(-px/2, -py/2)
	pad "$pin" . __1
}

frame outline {
	set r = 0.1mm

	set length = e*n+0.38mm

	set width = 3.4mm

	__2: vec @(-width/2, length/2)
	__0: vec .(-4*r, 4*r)
	__1: vec .(0mm, r)
	circ __0 . r
	__3: vec @(width/2, -length/2)
	rect . __2 r
}

package "M50-315$n"
unit mm

set w = 5mil

set e = 1.27mm

set px = 1.65mm

set py = 0.8mm

set gx = 2.2mm

loop n = 3, 40

frame pads @
frame outline @
frame pinholes @
frame mechholes @
measx pads.__2 -> pads.__1 -0.8mm
measx pads.__1 -> pads.__2 -py-0.8mm
measy pads.__2 -> pads.__1 0.8mm
measy pads.__0 -> pads.__0 3mm
measy pads.__1 -> pads.__2 px+0.8mm
measx pads.__2 >> pads.__1 -2mm
measx pinholes.__0 -> pinholes.__0 -0.5mm
