Commit 27fcf5b0 authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

housekeep

parent 1a096f4a
File deleted
<html> <html>
<head> <head>
<title>CBA</title> <title>fab libraries</title>
<link rel="stylesheet" href="https://copplestone.pages.cba.mit.edu/styling/stylesheet.css">
</head> </head>
<body link="black" vlink="black" alink="black">
<font face="bitstream vera sans,arial,helvetica,sans-serif">
<body id="main"> <div style="margin-left:5%;margin-right:5%;">
<h1>Fab Libraries</h1>
<p>This repository holds libraries of components commonly used during How to Make (almost) Anything. Currently we have libraries for Eagle and KiCAD. If you have updated or different libraries to add then please submit a <a href="https://gitlab.cba.mit.edu/pub/ring/merge_requests">merge request.<a/></p>
<p>Eagle - <a href="eagle/fab.lbr">fab.lbr</a> - <a href="https://learn.sparkfun.com/tutorials/how-to-install-and-setup-eagle/using-the-sparkfun-libraries">Instructions to add library to Eagle</a></p> <br>
<p>KiCAD - <a href="kicad/fab.mod">fab.mod</a> and <a href="kicad/fab.lib">fab.lib</a> - <a href="https://www.accelerated-designs.com/help/KiCad_Library.html">Instructions to add library to KiCAD</a></p>
</body> <h1>Fab Libraries</h1>
<p>
This repository holds libraries of components commonly used in fab classes and labs. If you have updated or different libraries to add then please submit a <a href="https://gitlab.cba.mit.edu/pub/libraries/merge_requests">merge request.<a/>
<p>
<div style="margin-left:5%;margin-right:5%;">
<b><a href=https://www.autodesk.com/products/eagle>Eagle</a>:</b> <a href="eagle/fab.lbr">fab.lbr</a>
<p>
<b><a href=http://kicad-pcb.org>KiCad</a>:</b> <a href="kicad/fab.mod">fab.mod</a> <a href="kicad/fab.lib">fab.lib</a>
<p>
<b><a href=http://kokompe.cba.mit.edu>Kokompe</a>:</b> <a href=kokompe/pcb.cad>pcb.cad</a>
#
# pcb.cad
#
# .cad PCB template
#
# Neil Gershenfeld 11/3/14
# (c) Massachusetts Institute of Technology 2014
#
# This work may be reproduced, modified, distributed,
# performed, and displayed for any purpose, but must
# acknowledge the fab modules project. Copyright is
# retained and must be preserved. The work is provided
# as is; no warranty is provided, and users accept all
# liability.
#
#
# uncomment for desired output:
#
output = "traces, labels, and exterior"
#output = "traces and exterior"
#output = "interior"
#output = "exterior"
#output = "traces"
#output = "holes"
#output = "solder mask"
#
# define shapes and transformations
#
# color(color,part)
# circle(x0, y0, r)
# cylinder(x0, y0, z0, z1, r)
# cone(x0, y0, z0, z1, r0)
# sphere(x0, y0, z0, r)
# torus(x0, y0, z0, r0, r1)
# rectangle(x0, x1, y0, y1)
# cube(x0, x1, y0, y1, z0, z1)
# right_triangle(x0, y0, h)
# triangle(x0, y0, x1, y1, x2, y2) (points in clockwise order)
# pyramid(x0, x1, y0, y1, z0, z1)
# function(Z_of_XY)
# functions(upper_Z_of_XY,lower_Z_of_XY)
# add(part1, part2)
# subtract(part1, part2)
# intersect(part1, part2)
# move(part,dx,dy)
# translate(part,dx,dy,dz)
# rotate(part, angle)
# rotate_x(part, angle)
# rotate_y(part, angle)
# rotate_z(part, angle)
# rotate_90(part)
# rotate_180(part)
# rotate_270(part)
# reflect_x(part,x0)
# reflect_y(part,y0)
# reflect_z(part,z0)
# reflect_xy(part)
# reflect_xz(part)
# reflect_yz(part)
# scale_x(part, x0, sx)
# scale_y(part, y0, sy)
# scale_z(part, z0, sz)
# scale_xy(part, x0, y0, sxy)
# scale_xyz(part, x0, y0, z0, sxyz)
# coscale_x_y(part, x0, y0, y1, angle0, angle1, amplitude, offset)
# coscale_x_z(part, x0, z0, z1, angle0, angle1, amplitude, offset)
# coscale_xy_z(part, x0, y0, z0, z1, angle0, angle1, amplitude, offset)
# taper_x_y(part, x0, y0, y1, s0, s1)
# taper_x_z(part, x0, z0, z1, s0, s1)
# taper_xy_z(part, x0, y0, z0, z1, s0, s1)
# shear_x_y(part, y0, y1, dx0, dx1)
# shear_x_z(part, z0, z1, dx0, dx1)
True = "1"
False = "0"
def color(color, part):
part = '('+str(color)+'*(('+part+')!=0))'
return part
Red = (225 << 0)
Green = (225 << 8)
Blue = (225 << 16)
Gray = (128 << 16) + (128 << 8) + (128 << 0)
White = (255 << 16) + (255 << 8) + (255 << 0)
Teal = (255 << 16) + (255 << 8)
Pink = (255 << 16) + (255 << 0)
Yellow = (255 << 8) + (255 << 0)
Brown = (45 << 16) + (82 << 8) + (145 << 0)
Navy = (128 << 16) + (0 << 8) + (0 << 0)
Tan = (60 << 16) + (90 << 8) + (125 << 0)
def circle(x0, y0, r):
part = "(((X-(x0))*(X-(x0)) + (Y-(y0))*(Y-(y0))) <= (r*r))"
part = replace(part,'x0',str(x0))
part = replace(part,'y0',str(y0))
part = replace(part,'r',str(r))
return part
def cylinder(x0, y0, z0, z1, r):
part = "(((X-(x0))*(X-(x0)) + (Y-(y0))*(Y-(y0)) <= (r*r)) & (Z >= (z0)) & (Z <= (z1)))"
part = replace(part,'x0',str(x0))
part = replace(part,'y0',str(y0))
part = replace(part,'z0',str(z0))
part = replace(part,'z1',str(z1))
part = replace(part,'r',str(r))
return part
def cone(x0, y0, z0, z1, r0):
part = cylinder(x0, y0, z0, z1, r0)
part = taper_xy_z(part, x0, y0, z0, z1, 1.0, 0.0)
return part
def sphere(x0, y0, z0, r):
part = "(((X-(x0))*(X-(x0)) + (Y-(y0))*(Y-(y0)) + (Z-(z0))*(Z-(z0))) <= (r*r))"
part = replace(part,'x0',str(x0))
part = replace(part,'y0',str(y0))
part = replace(part,'z0',str(z0))
part = replace(part,'r',str(r))
return part
def torus(x0, y0, z0, r0, r1):
part = "(((r0 - sqrt((X-(x0))*(X-(x0)) + (Y-(y0))*(Y-(y0))))*(r0 - sqrt((X-(x0))*(X-(x0)) + (Y-(y0))*(Y-(y0))) + (Z-(z0))*(Z-(z0))) <= (r1*r1))"
part = replace(part,'x0',str(x0))
part = replace(part,'y0',str(y0))
part = replace(part,'z0',str(z0))
part = replace(part,'r0',str(r0))
part = replace(part,'r1',str(r1))
return part
def rectangle(x0, x1, y0, y1):
part = "((X >= (x0)) & (X <= (x1)) & (Y >= (y0)) & (Y <= (y1)))"
part = replace(part,'x0',str(x0))
part = replace(part,'x1',str(x1))
part = replace(part,'y0',str(y0))
part = replace(part,'y1',str(y1))
return part
def cube(x0, x1, y0, y1, z0, z1):
part = "((X >= (x0)) & (X <= (x1)) & (Y >= (y0)) & (Y <= (y1)) & (Z >= (z0)) & (Z <= (z1)))"
part = replace(part,'x0',str(x0))
part = replace(part,'x1',str(x1))
part = replace(part,'y0',str(y0))
part = replace(part,'y1',str(y1))
part = replace(part,'z0',str(z0))
part = replace(part,'z1',str(z1))
return part
def right_triangle(x0, y0, l):
part = "((X > x0) & (X < x0 + l - (Y-y0)) & (Y > y0))"
part = replace(part,'x0',str(x0))
part = replace(part,'y0',str(y0))
part = replace(part,'l',str(l))
return part
def triangle(x0, y0, x1, y1, x2, y2): # points in clockwise order
part = "(((((y1)-(y0))*(X-(x0))-((x1)-(x0))*(Y-(y0))) >= 0) & ((((y2)-(y1))*(X-(x1))-((x2)-(x1))*(Y-(y1))) >= 0) & ((((y0)-(y2))*(X-(x2))-((x0)-(x2))*(Y-(y2))) >= 0))"
part = replace(part,'x0',str(x0))
part = replace(part,'y0',str(y0))
part = replace(part,'x1',str(x1))
part = replace(part,'y1',str(y1))
part = replace(part,'x2',str(x2))
part = replace(part,'y2',str(y2))
return part
def pyramid(x0, x1, y0, y1, z0, z1):
part = cube(x0, x1, y0, y1, z0, z1)
part = taper_xy_z(part, (x0+x1)/2., (y0+y1)/2., z0, z1, 1.0, 0.0)
return part
def function(Z_of_XY):
part = '(Z <= '+Z_of_XY+')'
return part
def functions(upper_Z_of_XY,lower_Z_of_XY):
part = '(Z <= '+upper_Z_of_XY+') & (Z >= '+lower_Z_of_XY+')'
return part
def add(part1, part2):
part = "part1 | part2"
part = replace(part,'part1',part1)
part = replace(part,'part2',part2)
return part
def subtract(part1, part2):
part = "(part1) & ~(part2)"
part = replace(part,'part1',part1)
part = replace(part,'part2',part2)
return part
def intersect(part1, part2):
part = "(part1) & (part2)"
part = replace(part,'part1',part1)
part = replace(part,'part2',part2)
return part
def move(part,dx,dy):
part = replace(part,'X','(X-('+str(dx)+'))')
part = replace(part,'Y','(Y-('+str(dy)+'))')
return part
def translate(part,dx,dy,dz):
part = replace(part,'X','(X-('+str(dx)+'))')
part = replace(part,'Y','(Y-('+str(dy)+'))')
part = replace(part,'Z','(Z-('+str(dz)+'))')
return part
def rotate(part, angle):
angle = angle*pi/180
part = replace(part,'X','(cos(angle)*X+sin(angle)*y)')
part = replace(part,'Y','(-sin(angle)*X+cos(angle)*y)')
part = replace(part,'y','Y')
part = replace(part,'angle',str(angle))
return part
def rotate_x(part, angle):
angle = angle*pi/180
part = replace(part,'Y','(cos(angle)*Y+sin(angle)*z)')
part = replace(part,'Z','(-sin(angle)*Y+cos(angle)*z)')
part = replace(part,'z','Z')
part = replace(part,'angle',str(angle))
return part
def rotate_y(part, angle):
angle = angle*pi/180
part = replace(part,'X','(cos(angle)*X+sin(angle)*z)')
part = replace(part,'Z','(-sin(angle)*X+cos(angle)*z)')
part = replace(part,'z','Z')
part = replace(part,'angle',str(angle))
return part
def rotate_z(part, angle):
angle = angle*pi/180
part = replace(part,'X','(cos(angle)*X+sin(angle)*y)')
part = replace(part,'Y','(-sin(angle)*X+cos(angle)*y)')
part = replace(part,'y','Y')
part = replace(part,'angle',str(angle))
return part
def rotate_90(part):
part = reflect_y(part,0)
part = reflect_xy(part)
return part
def rotate_180(part):
part = rotate_90(part)
part = rotate_90(part)
return part
def rotate_270(part):
part = rotate_90(part)
part = rotate_90(part)
part = rotate_90(part)
return part
def reflect_x(part,x0):
part = replace(part,'X','(x0-X)')
part = replace(part,'x0',str(x0))
return part
def reflect_y(part,y0):
part = replace(part,'Y','(y0-Y)')
part = replace(part,'y0',str(y0))
return part
def reflect_z(part,z0):
part = replace(part,'Z','(z0-Z)')
part = replace(part,'z0',str(z0))
return part
def reflect_xy(part):
part = replace(part,'X','temp')
part = replace(part,'Y','X')
part = replace(part,'temp','Y')
return part
def reflect_xz(part):
part = replace(part,'X','temp')
part = replace(part,'Z','X')
part = replace(part,'temp','Z')
return part
def reflect_yz(part):
part = replace(part,'Y','temp')
part = replace(part,'Z','Y')
part = replace(part,'temp','Z')
return part
def scale_x(part, x0, sx):
part = replace(part,'X','((x0) + (X-(x0))/(sx))')
part = replace(part,'x0',str(x0))
part = replace(part,'sx',str(sx))
return part
def scale_y(part, y0, sy):
part = replace(part,'Y','((y0) + (Y-(y0))/(sy))')
part = replace(part,'y0',str(y0))
part = replace(part,'sy',str(sy))
return part
def scale_z(part, z0, sz):
part = replace(part,'Z','((z0) + (Z-(z0))/(sz))')
part = replace(part,'z0',str(z0))
part = replace(part,'sz',str(sz))
return part
def scale_xy(part, x0, y0, sxy):
part = replace(part,'X','((x0) + (X-(x0))/(sxy))')
part = replace(part,'Y','((y0) + (Y-(y0))/(sxy))')
part = replace(part,'x0',str(x0))
part = replace(part,'y0',str(y0))
part = replace(part,'sxy',str(sxy))
return part
def scale_xyz(part, x0, y0, z0, sxyz):
part = replace(part,'X','((x0) + (X-(x0))/(sxyz))')
part = replace(part,'Y','((y0) + (Y-(y0))/(sxyz))')
part = replace(part,'Z','((z0) + (Z-(z0))/(sxyz))')
part = replace(part,'x0',str(x0))
part = replace(part,'y0',str(y0))
part = replace(part,'z0',str(z0))
part = replace(part,'sxyz',str(sxyz))
return part
def coscale_x_y(part, x0, y0, y1, angle0, angle1, amplitude, offset):
phase0 = pi*angle0/180.
phase1 = pi*angle1/180.
part = replace(part,'X','((x0) + (X-(x0))/((offset) + (amplitude)*cos((phase0) + ((phase1)-(phase0))*(Y-(y0))/((y1)-(y0)))))')
part = replace(part,'x0',str(x0))
part = replace(part,'y0',str(y0))
part = replace(part,'y1',str(y1))
part = replace(part,'phase0',str(phase0))
part = replace(part,'phase1',str(phase1))
part = replace(part,'amplitude',str(amplitude))
part = replace(part,'offset',str(offset))
return part
def coscale_x_z(part, x0, z0, z1, angle0, angle1, amplitude, offset):
phase0 = pi*angle0/180.
phase1 = pi*angle1/180.
part = replace(part,'X','((x0) + (X-(x0))/((offset) + (amplitude)*cos((phase0) + ((phase1)-(phase0))*(Z-(z0))/((z1)-(z0)))))')
part = replace(part,'x0',str(x0))
part = replace(part,'z0',str(z0))
part = replace(part,'z1',str(z1))
part = replace(part,'phase0',str(phase0))
part = replace(part,'phase1',str(phase1))
part = replace(part,'amplitude',str(amplitude))
part = replace(part,'offset',str(offset))
return part
def coscale_xy_z(part, x0, y0, z0, z1, angle0, angle1, amplitude, offset):
phase0 = pi*angle0/180.
phase1 = pi*angle1/180.
part = replace(part,'X','((x0) + (X-(x0))/((offset) + (amplitude)*cos((phase0) + ((phase1)-(phase0))*(Z-(z0))/((z1)-(z0)))))')
part = replace(part,'Y','((y0) + (Y-(y0))/((offset) + (amplitude)*cos((phase0) + ((phase1)-(phase0))*(Z-(z0))/((z1)-(z0)))))')
part = replace(part,'x0',str(x0))
part = replace(part,'y0',str(y0))
part = replace(part,'z0',str(z0))
part = replace(part,'z1',str(z1))
part = replace(part,'phase0',str(phase0))
part = replace(part,'phase1',str(phase1))
part = replace(part,'amplitude',str(amplitude))
part = replace(part,'offset',str(offset))
return part
def taper_x_y(part, x0, y0, y1, s0, s1):
part = replace(part,'X','((x0) + (X-(x0))*((y1)-(y0))/((s1)*(Y-(y0)) + (s0)*((y1)-Y)))')
part = replace(part,'x0',str(x0))
part = replace(part,'y0',str(y0))
part = replace(part,'y1',str(y1))
part = replace(part,'s0',str(s0))
part = replace(part,'s1',str(s1))
return part
def taper_x_z(part, x0, z0, z1, s0, s1):
part = replace(part,'X','((x0) + (X-(x0))*((z1)-(z0))/((s1)*(Z-(z0)) + (s0)*((z1)-Z)))')
part = replace(part,'x0',str(x0))
part = replace(part,'z0',str(z0))
part = replace(part,'z1',str(z1))
part = replace(part,'s0',str(s0))
part = replace(part,'s1',str(s1))
return part
def taper_xy_z(part, x0, y0, z0, z1, s0, s1):
part = replace(part,'X','((x0) + (X-(x0))*((z1)-(z0))/((s1)*(Z-(z0)) + (s0)*((z1)-Z)))')
part = replace(part,'Y','((y0) + (Y-(y0))*((z1)-(z0))/((s1)*(Z-(z0)) + (s0)*((z1)-Z)))')
part = replace(part,'x0',str(x0))
part = replace(part,'y0',str(y0))
part = replace(part,'z0',str(z0))
part = replace(part,'z1',str(z1))
part = replace(part,'s0',str(s0))
part = replace(part,'s1',str(s1))
return part
def shear_x_y(part, y0, y1, dx0, dx1):
part = replace(part,'X','(X - (dx0) - ((dx1)-(dx0))*(Y-(y0))/((y1)-(y0)))')
part = replace(part,'y0',str(y0))
part = replace(part,'y1',str(y1))
part = replace(part,'dx0',str(dx0))
part = replace(part,'dx1',str(dx1))
return part
def shear_x_z(part, z0, z1, dx0, dx1):
part = replace(part,'X','(X - (dx0) - ((dx1)-(dx0))*(Z-(z0))/((z1)-(z0)))')
part = replace(part,'z0',str(z0))
part = replace(part,'z1',str(z1))
part = replace(part,'dx0',str(dx0))
part = replace(part,'dx1',str(dx1))
return part
def coshear_x_z(part, z0, z1, angle0, angle1, amplitude, offset):
phase0 = pi*angle0/180.
phase1 = pi*angle1/180.
part = replace(part,'X','(X - (offset) - (amplitude)*cos((phase0) + ((phase1)-(phase0))*(Z-(z0))/((z1)-(z0))))')
part = replace(part,'z0',str(z0))
part = replace(part,'z1',str(z1))
part = replace(part,'phase0',str(phase0))
part = replace(part,'phase1',str(phase1))
part = replace(part,'amplitude',str(amplitude))
part = replace(part,'offset',str(offset))
return part
#
# text classes and definitions
#
class text:
#
# text class
#
def __init__(self,text,x,y,z,line='',height='',width='',space='',align='CC',color=White,angle=0):
#
# parameters
#
if (line == ''):
line = 1
if (height == ''):
height = 6*line
if (width == ''):
width = 4*line
if (space == ''):
space = line/2.0
self.width = 0
self.height = 0
self.text = text
#
# construct shape dictionary
#
shapes = {}
shape = triangle(0,0,width/2.0,height,width,0)
cutout = triangle(0,-2.5*line,width/2.0,height-2.5*line,width,-2.5*line)
cutout = subtract(cutout,rectangle(0,width,height/4-line/2,height/4+line/2))
shape = subtract(shape,cutout)
shapes['A'] = shape
shape = circle(width/2,width/2,width/2)
shape = subtract(shape,circle(width/2,width/2,width/4))
shape = add(shape,rectangle(width-line,width,0,height/3))
shapes['a'] = shape
shape = rectangle(0,width-height/4,0,height)
shape = add(shape,circle(width-height/4,height/4,height/4))
shape = add(shape,circle(width-height/4,3*height/4,height/4))
w = height/2-1.5*line
shape = subtract(shape,rectangle(line,line+w/1.5,height/2+line/2,height-line))
shape = subtract(shape,circle(line+w/1.5,height/2+line/2+w/2,w/2))
shape = subtract(shape,rectangle(line,line+w/1.5,line,height/2-line/2))
shape = subtract(shape,circle(line+w/1.5,height/2-line/2-w/2,w/2))
shapes['B'] = shape
shape = circle(width/2,width/2,width/2)
shape = subtract(shape,circle(width/2,width/2,width/4))
shape = add(shape,rectangle(0,line,0,height))
shapes['b'] = shape
shape = circle(width/2,width/2,width/2)
shape = add(shape,circle(width/2,height-width/2,width/2))
shape = add(shape,rectangle(0,width,line+w/2,height-line-w/2))
w = width-2*line
shape = subtract(shape,circle(width/2,line+w/2,w/2))
shape = subtract(shape,circle(width/2,height-line-w/2,w/2))
shape = subtract(shape,rectangle(line,width,line+w/2,height-line-w/2))
shapes['C'] = shape
shape = circle(width/2,width/2,width/2)
shape = subtract(shape,circle(width/2,width/2,width/4))
shape = subtract(shape,rectangle(width/2,width,width/2-line/1.5,width/2+line/1.5))
shapes['c'] = shape
shape = circle(line,width-line,width-line)
shape = subtract(shape,circle(line,width-line,width-2*line))
shape = subtract(shape,rectangle(-width,line,0,height))
shape = scale_y(shape,0,height/(2*(width-line)))
shape = add(shape,rectangle(0,line,0,height))
shapes['D'] = shape
shape = rectangle(width-line,width,0,height)
shape = add(shape,circle(width/2,width/2,width/2))
shape = subtract(shape,circle(width/2,width/2,width/2-line))
shapes['d'] = shape
shape = rectangle(0,line,0,height)
shape = add(shape,rectangle(0,width,height-line,height))
shape = add(shape,rectangle(0,2*width/3,height/2-line/2,height/2+line/2))
shape = add(shape,rectangle(0,width,0,line))
shapes['E'] = shape
shape = circle(width/2,width/2,width/2)
shape = subtract(shape,circle(width/2,width/2,width/2-line))
shape = subtract(shape,triangle(width,0,width/2,width/2-line/2,width,width/2-line/2))
shape = add(shape,rectangle(0,width,width/2-line/2,width/2+line/2))
shapes['e'] = shape
shape = rectangle(0,line,0,height)
shape = add(shape,rectangle(0,width,height-line,height))
shape = add(shape,rectangle(0,2*width/3,height/2-line/2,height/2+line/2))
shapes['F'] = shape
shape = circle(width-line/2,height-width/2,width/2)
shape = subtract(shape,circle(width-line/2,height-width/2,width/2-line))
shape = subtract(shape,rectangle(0,width-line/2,0,height-width/2))
shape = subtract(shape,rectangle(width-line/2,2*width,0,height))
shape = add(shape,rectangle(width/2-line/2,width/2+line/2,0,height-width/2))
shape = add(shape,rectangle(width/5,4*width/5,height/2-line/2,height/2+line/2))
shapes['f'] = shape
shape = circle(width/2,width/2,width/2)
shape = add(shape,circle(width/2,height-width/2,width/2))
shape = add(shape,rectangle(0,width,line+w/2,height-line-w/2))
w = width-2*line
shape = subtract(shape,circle(width/2,line+w/2,w/2))
shape = subtract(shape,circle(width/2,height-line-w/2,w/2))
shape = subtract(shape,rectangle(line,width,line+w/2,height-line-w/2))
shape = add(shape,rectangle(width/2,width,line+w/2,2*line+w/2))
shapes['G'] = shape
shape = circle(width/2,width/2,width/2)
shape = subtract(shape,circle(width/2,width/2,width/2-line))
w = height/3-width/2
shape = add(shape,rectangle(width-line,width,w,width))
shape = add(shape,subtract(subtract(circle(width/2,w,width/2),circle(width/2,w,width/2-line)),rectangle(0,width,w,height)))
shapes['g'] = shape
shape = rectangle(0,line,0,height)
shape = add(shape,rectangle(width-line,width,0,height))
shape = add(shape,rectangle(0,width,height/2-line/2,height/2+line/2))
shapes['H'] = shape
w = width/2
shape = circle(width/2,w,width/2)
shape = subtract(shape,circle(width/2,w,width/2-line))
shape = subtract(shape,rectangle(0,width,0,w))
shape = add(shape,rectangle(0,line,0,height))
shape = add(shape,rectangle(width-line,width,0,w))
shapes['h'] = shape
shape = rectangle(width/2-line/2,width/2+line/2,0,height)
shape = add(shape,rectangle(width/5,4*width/5,0,line))
shape = add(shape,rectangle(width/5,4*width/5,height-line,height))
shapes['I'] = shape
shape = rectangle(width/2-line/2,width/2+line/2,0,height/2)
shape = add(shape,circle(width/2,3*height/4,.6*line))
shapes['i'] = shape
shape = circle(width/2,width/2,width/2)
shape = subtract(shape,circle(width/2,width/2,width/2-line))
shape = subtract(shape,rectangle(0,width,width/2,height))
shape = add(shape,rectangle(width-line,width,width/2,height))
shapes['J'] = shape
w = height/3-width/2
shape = rectangle(width/2-line/2,width/2+line/2,w,height/2)
shape = add(shape,subtract(subtract(subtract(circle(width/4-line/2,w,width/2),circle(width/4-line/2,w,width/2-line)),rectangle(0,width,w,height)),rectangle(-width,width/4-line/2,-height/3,height)))
shape = add(shape,circle(width/2,3*height/4,.6*line))
shapes['j'] = shape
shape = rectangle(0,width,0,height)
shape = subtract(shape,triangle(line,height,width-1.1*line,height,line,height/2+.5*line))
shape = subtract(shape,triangle(width,0,line+0.8*line,height/2,width,height))
shape = subtract(shape,triangle(line,0,line,height/2-.5*line,width-1.1*line,0))
shapes['K'] = shape
shape = rectangle(0,width,0,height)
shape = subtract(shape,rectangle(line,width,2*height/3,height))
shape = subtract(shape,triangle(line,2*height/3,width-1.3*line,2*height/3,line,height/3+.5*line))
shape = subtract(shape,triangle(width,0,line+0.8*line,height/3,width,2*height/3))
shape = subtract(shape,triangle(line,0,line,height/3-0.5*line,width-1.3*line,0))
shapes['k'] = shape
shape = rectangle(0,line,0,height)
shape = add(shape,rectangle(0,width,0,line))
shapes['L'] = shape
shape = rectangle(width/2-line/2,width/2+line/2,0,height)
shapes['l'] = shape
shape = rectangle(0,width,0,height)
shape = subtract(shape,triangle(line,0,line,height-3*line,width/2-line/3,0))
shape = subtract(shape,triangle(line,height,width-line,height,width/2,1.5*line))
shape = subtract(shape,triangle(width/2+line/3,0,width-line,height-3*line,width-line,0))
shapes['M'] = shape
w = width/2
l = 1.3*line
shape = circle(width/2,w,width/2)
shape = subtract(shape,circle(width/2,w,width/2-l))
shape = subtract(shape,rectangle(0,width,0,w))
shape = add(shape,rectangle(width-l,width,0,w))
shape = add(shape,move(shape,width-l,0))
shape = add(shape,rectangle(0,l,0,width))
shape = scale_x(shape,0,width/(2*width-l))
shapes['m'] = shape
shape = rectangle(0,width,0,height)
shape = subtract(shape,triangle(line,height+1.5*line,width-line,height+1.5*line,width-line,1.5*line))
shape = subtract(shape,triangle(line,-1.5*line,line,height-1.5*line,width-line,-1.5*line))
shapes['N'] = shape
w = width/2
shape = circle(width/2,w,width/2)
shape = subtract(shape,circle(width/2,w,width/2-line))
shape = subtract(shape,rectangle(0,width,0,w))
shape = add(shape,rectangle(0,line,0,width))
shape = add(shape,rectangle(width-line,width,0,w))
shapes['n'] = shape
shape = circle(width/2,width/2,width/2)
shape = add(shape,circle(width/2,height-width/2,width/2))
shape = add(shape,rectangle(0,width,line+w/2,height-line-w/2))
w = width-2*line
shape = subtract(shape,circle(width/2,line+w/2,w/2))
shape = subtract(shape,circle(width/2,height-line-w/2,w/2))
shape = subtract(shape,rectangle(line,width-line,line+w/2,height-line-w/2))
shapes['O'] = shape
shape = circle(width/2,width/2,width/2)
shape = subtract(shape,circle(width/2,width/2,width/2-line))
shapes['o'] = shape
shape = rectangle(0,line,0,height)
w = 2*height/3
shape = add(shape,circle(width-w/2,height-w/2,w/2))
shape = add(shape,rectangle(0,width-w/2,height-w,height))
shape = subtract(shape,circle(width-w/2,height-w/2,w/2-line))
shape = subtract(shape,rectangle(line,width-w/2,height-w+line,height-line))
shapes['P'] = shape
shape = circle(width/2,width/2,width/2)
shape = subtract(shape,circle(width/2,width/2,width/4))
shape = add(shape,rectangle(0,line,-height/3,width))
shapes['p'] = shape
shape = subtract(circle(width/2,width/2,width/2),circle(width/2,width/2,width/2-.9*line))