/* MACHINE-GENERATED ! */

frame pad {
	__0: vec @(Px/2, Py/2)
	__1: vec @(-Px/2, -Py/2)
	pad "$pin" . __0
}

frame pads {
	table
	    { pin, dx, dy }
	    { 1, -1, -1 }
	    { 2, 1, -1 }
	    { 3, 1, 1 }
	    { 4, -1, 1 }

	__0: vec @(dx*Gx/2, dy*Gy/2)
	frame pad .
}

frame outline {
	table
	    { px, py, x, y }
	    { 0mm, Dy/2, Gx-Px-2*w, 0mm }
	    { 0mm, -Dy/2, Gx-Px-2*w, 0mm }
	    { -Dx/2, 0mm, 0mm, Gy-Py-2*w }
	    { Dx/2, 0mm, 0mm, Gy-Py-2*w }

	__0: vec @(px, py)
	__1: vec .(x/2, y/2)
	__2: vec __0(-x/2, -y/2)
	line . __1 w
}

package "xtal4-${Dx}x${Dy}"
unit mm

table
    { Dx, Dy, Gx, Gy, Px, Py }
    { 3.2mm, 2.5mm, 2.2mm, 1.6mm, 1.4mm, 1.2mm }

set w = 5mil

frame pads @
frame outline @
measx pads.__0 -> pads.__0 1mm+Py/2+Gy
measy pads.__0 -> pads.__0 -1mm-Px/2-Gx
measy pad.__1 -> pad.__0 1mm
measx pad.__1 -> pad.__0 -1mm
measx outline.__0 >> outline.__0 Gy/2+Py/2+1.5mm
measy outline.__0 >> outline.__0 -(Gx/2+Px/2+1.5mm)