Skip to content
Snippets Groups Projects
pcb.py 289 KiB
Newer Older
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
#!/usr/bin/env python
#
# pcb.py
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
#    functional representation PCB template
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
#
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
# usage:
#    pcb.py | frep.py [dpi [filename]]
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
#
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
# Neil Gershenfeld 8/24/21
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
#
# This work may be reproduced, modified, distributed,
# performed, and displayed for any purpose, but must
# acknowledge this project. Copyright is retained and
# must be preserved. The work is provided as is; no
# warranty is provided, and users accept all liability.
#

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
# uncomment for desired output
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
#output = "top, labels, and exterior"
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
#output = "top, labels, holes, and exterior"
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
#output = "top, bottom, labels, and exterior"
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
output = "top, bottom, labels, holes, and exterior"
#output = "top traces"
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
#output = "top traces and exterior"
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
#output = "bottom traces reversed"
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
#output = "bottom traces reversed and exterior"
#output = "holes"
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
#output = "interior"
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
#output = "holes and interior"
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
#output = "exterior"
#output = "solder mask"

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# import
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

import math,json,sys

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# define shapes and transformations
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

# color(color,part)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
# circle(x,y,r)
# cylinder(x,y,z0,z1,r)
# cone(x,y,z0,z1,r)
# sphere(x,y,z,r)
# torus(x,y,z,r0,r1)
# rectangle(x0,x1,y0,y1)
# cube(x0,x1,y0,y1,z0,z1)
# line(x0,y0,x1,y1,z,width)
# right_triangle(x,y,h)
# triangle(x0,y0,x1,y1,x2,y2) (points in clockwise order)
# pyramid(x0,x1,y0,y1,z0,z1)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# function(Z_of_XY)
# functions(upper_Z_of_XY,lower_Z_of_XY)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
# add(part1,part2)
# subtract(part1,part2)
# intersect(part1,part2)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# move(part,dx,dy)
# translate(part,dx,dy,dz)
# rotate(part, angle)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
# rotate_x(part,angle)
# rotate_y(part,angle)
# rotate_z(part,angle)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# 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)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
# 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)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

true = "1"
false = "0"

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def color(color,part):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   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)

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def circle(x0,y0,r):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = "(((X-(x0))*(X-(x0)) + (Y-(y0))*(Y-(y0))) <= (r*r))"
   part = part.replace('x0',str(x0))
   part = part.replace('y0',str(y0))
   part = part.replace('r',str(r))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def cylinder(x0,y0,z0,z1,r):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = "(((X-(x0))*(X-(x0)) + (Y-(y0))*(Y-(y0)) <= (r*r)) & (Z >= (z0)) & (Z <= (z1)))"
   part = part.replace('x0',str(x0))
   part = part.replace('y0',str(y0))
   part = part.replace('z0',str(z0))
   part = part.replace('z1',str(z1))
   part = part.replace('r',str(r))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def cone(x0,y0,z0,z1,r0):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = cylinder(x0, y0, z0, z1, r0)
   part = taper_xy_z(part, x0, y0, z0, z1, 1.0, 0.0)
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def sphere(x0,y0,z0,r):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = "(((X-(x0))*(X-(x0)) + (Y-(y0))*(Y-(y0)) + (Z-(z0))*(Z-(z0))) <= (r*r))"
   part = part.replace('x0',str(x0))
   part = part.replace('y0',str(y0))
   part = part.replace('z0',str(z0))
   part = part.replace('r',str(r))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def torus(x0,y0,z0,r0,r1):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   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 = part.replace('x0',str(x0))
   part = part.replace('y0',str(y0))
   part = part.replace('z0',str(z0))
   part = part.replace('r0',str(r0))
   part = part.replace('r1',str(r1))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def rectangle(x0,x1,y0,y1):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = "((X >= (x0)) & (X <= (x1)) & (Y >= (y0)) & (Y <= (y1)))"
   part = part.replace('x0',str(x0))
   part = part.replace('x1',str(x1))
   part = part.replace('y0',str(y0))
   part = part.replace('y1',str(y1))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def cube(x0,x1,y0,y1,z0,z1):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = "((X >= (x0)) & (X <= (x1)) & (Y >= (y0)) & (Y <= (y1)) & (Z >= (z0)) & (Z <= (z1)))"
   part = part.replace('x0',str(x0))
   part = part.replace('x1',str(x1))
   part = part.replace('y0',str(y0))
   part = part.replace('y1',str(y1))
   part = part.replace('z0',str(z0))
   part = part.replace('z1',str(z1))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def line(x0,y0,x1,y1,z,width):
   dx = x1-x0
   dy = y1-y0
   l = math.sqrt(dx*dx+dy*dy)
   nx = dx/l
   ny = dy/l
   rx = -ny
   ry = nx
   part = "((((X-(x0))*(nx)+(Y-(y0))*(ny)) >= 0) & (((X-(x0))*(nx)+(Y-(y0))*(ny)) <= l) & (((X-(x0))*(rx)+(Y-(y0))*(ry)) >= (-width/2)) & (((X-(x0))*(rx)+(Y-(y0))*(ry)) <= (width/2)) & (Z == z))"
   part = part.replace('x0',str(x0))
   part = part.replace('x1',str(x1))
   part = part.replace('y0',str(y0))
   part = part.replace('y1',str(y1))
   part = part.replace('nx',str(nx))
   part = part.replace('ny',str(ny))
   part = part.replace('rx',str(rx))
   part = part.replace('ry',str(ry))
   part = part.replace('l',str(l))
   part = part.replace('z',str(z))
   part = part.replace('width',str(width))
   return part

def right_triangle(x0,y0,l):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = "((X > x0) & (X < x0 + l - (Y-y0)) & (Y > y0))"
   part = part.replace('x0',str(x0))
   part = part.replace('y0',str(y0))
   part = part.replace('l',str(l))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def triangle(x0,y0,x1,y1,x2,y2): # points in clockwise order
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   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 = part.replace('x0',str(x0))
   part = part.replace('y0',str(y0))
   part = part.replace('x1',str(x1))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = part.replace('y1',str(y1))
   part = part.replace('x2',str(x2))
   part = part.replace('y2',str(y2))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def pyramid(x0,x1,y0,y1,z0,z1):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   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

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def add(part1,part2):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = "part1 | part2"
   part = part.replace('part1',part1)
   part = part.replace('part2',part2)
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def subtract(part1,part2):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = "(part1) & ~(part2)"
   part = part.replace('part1',part1)
   part = part.replace('part2',part2)
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def intersect(part1,part2):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = "(part1) & (part2)"
   part = part.replace('part1',part1)
   part = part.replace('part2',part2)
   return part

def move(part,dx,dy):
   part = part.replace('X','(X-('+str(dx)+'))')
   part = part.replace('Y','(Y-('+str(dy)+'))')
   return part   

def translate(part,dx,dy,dz):
   part = part.replace('X','(X-('+str(dx)+'))')
   part = part.replace('Y','(Y-('+str(dy)+'))')
   part = part.replace('Z','(Z-('+str(dz)+'))')
   return part   

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def rotate(part,angle):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   angle = angle*math.pi/180
   part = part.replace('X','(math.cos(angle)*X+math.sin(angle)*y)')
   part = part.replace('Y','(-math.sin(angle)*X+math.cos(angle)*y)')
   part = part.replace('y','Y')
   part = part.replace('angle',str(angle))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def rotate_x(part,angle):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   angle = angle*math.pi/180
   part = part.replace('Y','(math.cos(angle)*Y+math.sin(angle)*z)')
   part = part.replace('Z','(-math.sin(angle)*Y+math.cos(angle)*z)')
   part = part.replace('z','Z')
   part = part.replace('angle',str(angle))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def rotate_y(part,angle):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   angle = angle*math.pi/180
   part = part.replace('X','(math.cos(angle)*X+math.sin(angle)*z)')
   part = part.replace('Z','(-math.sin(angle)*X+math.cos(angle)*z)')
   part = part.replace('z','Z')
   part = part.replace('angle',str(angle))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def rotate_z(part,angle):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   angle = angle*math.pi/180
   part = part.replace('X','(math.cos(angle)*X+math.sin(angle)*y)')
   part = part.replace('Y','(-math.sin(angle)*X+math.cos(angle)*y)')
   part = part.replace('y','Y')
   part = part.replace('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 = part.replace('X','(x0-X)')
   part = part.replace('x0',str(x0))
   return part

def reflect_y(part,y0):
   part = part.replace('Y','(y0-Y)')
   part = part.replace('y0',str(y0))
   return part

def reflect_z(part,z0):
   part = part.replace('Z','(z0-Z)')
   part = part.replace('z0',str(z0))
   return part

def reflect_xy(part):
   part = part.replace('X','temp')
   part = part.replace('Y','X')
   part = part.replace('temp','Y')
   return part

def reflect_xz(part):
   part = part.replace('X','temp')
   part = part.replace('Z','X')
   part = part.replace('temp','Z')
   return part

def reflect_yz(part):
   part = part.replace('Y','temp')
   part = part.replace('Z','Y')
   part = part.replace('temp','Z')
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def scale_x(part,x0,sx):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = part.replace('X','((x0) + (X-(x0))/(sx))')
   part = part.replace('x0',str(x0))
   part = part.replace('sx',str(sx))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def scale_y(part,y0,sy):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = part.replace('Y','((y0) + (Y-(y0))/(sy))')
   part = part.replace('y0',str(y0))
   part = part.replace('sy',str(sy))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def scale_z(part,z0,sz):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = part.replace('Z','((z0) + (Z-(z0))/(sz))')
   part = part.replace('z0',str(z0))
   part = part.replace('sz',str(sz))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def scale_xy(part,x0,y0,sxy):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = part.replace('X','((x0) + (X-(x0))/(sxy))')
   part = part.replace('Y','((y0) + (Y-(y0))/(sxy))')
   part = part.replace('x0',str(x0))
   part = part.replace('y0',str(y0))
   part = part.replace('sxy',str(sxy))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def scale_xyz(part,x0,y0,z0,sxyz):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = part.replace('X','((x0) + (X-(x0))/(sxyz))')
   part = part.replace('Y','((y0) + (Y-(y0))/(sxyz))')
   part = part.replace('Z','((z0) + (Z-(z0))/(sxyz))')
   part = part.replace('x0',str(x0))
   part = part.replace('y0',str(y0))
   part = part.replace('z0',str(z0))
   part = part.replace('sxyz',str(sxyz))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def coscale_x_y(part,x0,y0,y1,angle0,angle1,amplitude,offset):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   phase0 = math.pi*angle0/180.
   phase1 = math.pi*angle1/180.
   part = part.replace('X','((x0) + (X-(x0))/((offset) + (amplitude)*math.cos((phase0) + ((phase1)-(phase0))*(Y-(y0))/((y1)-(y0)))))')
   part = part.replace('x0',str(x0))
   part = part.replace('y0',str(y0))
   part = part.replace('y1',str(y1))
   part = part.replace('phase0',str(phase0))
   part = part.replace('phase1',str(phase1))
   part = part.replace('amplitude',str(amplitude))
   part = part.replace('offset',str(offset))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def coscale_x_z(part,x0,z0,z1,angle0,angle1,amplitude,offset):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   phase0 = math.pi*angle0/180.
   phase1 = math.pi*angle1/180.
   part = part.replace('X','((x0) + (X-(x0))/((offset) + (amplitude)*math.cos((phase0) + ((phase1)-(phase0))*(Z-(z0))/((z1)-(z0)))))')
   part = part.replace('x0',str(x0))
   part = part.replace('z0',str(z0))
   part = part.replace('z1',str(z1))
   part = part.replace('phase0',str(phase0))
   part = part.replace('phase1',str(phase1))
   part = part.replace('amplitude',str(amplitude))
   part = part.replace('offset',str(offset))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def coscale_xy_z(part,x0,y0,z0,z1,angle0,angle1,amplitude,offset):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   phase0 = math.pi*angle0/180.
   phase1 = math.pi*angle1/180.
   part = part.replace('X','((x0) + (X-(x0))/((offset) + (amplitude)*math.cos((phase0) + ((phase1)-(phase0))*(Z-(z0))/((z1)-(z0)))))')
   part = part.replace('Y','((y0) + (Y-(y0))/((offset) + (amplitude)*math.cos((phase0) + ((phase1)-(phase0))*(Z-(z0))/((z1)-(z0)))))')
   part = part.replace('x0',str(x0))
   part = part.replace('y0',str(y0))
   part = part.replace('z0',str(z0))
   part = part.replace('z1',str(z1))
   part = part.replace('phase0',str(phase0))
   part = part.replace('phase1',str(phase1))
   part = part.replace('amplitude',str(amplitude))
   part = part.replace('offset',str(offset))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def taper_x_y(part,x0,y0,y1,s0,s1):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = part.replace('X','((x0) + (X-(x0))*((y1)-(y0))/((s1)*(Y-(y0)) + (s0)*((y1)-Y)))')
   part = part.replace('x0',str(x0))
   part = part.replace('y0',str(y0))
   part = part.replace('y1',str(y1))
   part = part.replace('s0',str(s0))
   part = part.replace('s1',str(s1))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def taper_x_z(part,x0,z0,z1,s0,s1):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = part.replace('X','((x0) + (X-(x0))*((z1)-(z0))/((s1)*(Z-(z0)) + (s0)*((z1)-Z)))')
   part = part.replace('x0',str(x0))
   part = part.replace('z0',str(z0))
   part = part.replace('z1',str(z1))
   part = part.replace('s0',str(s0))
   part = part.replace('s1',str(s1))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def taper_xy_z(part,x0,y0,z0,z1,s0,s1):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = part.replace('X','((x0) + (X-(x0))*((z1)-(z0))/((s1)*(Z-(z0)) + (s0)*((z1)-Z)))')
   part = part.replace('Y','((y0) + (Y-(y0))*((z1)-(z0))/((s1)*(Z-(z0)) + (s0)*((z1)-Z)))')
   part = part.replace('x0',str(x0))
   part = part.replace('y0',str(y0))
   part = part.replace('z0',str(z0))
   part = part.replace('z1',str(z1))
   part = part.replace('s0',str(s0))
   part = part.replace('s1',str(s1))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def shear_x_y(part,y0,y1,dx0,dx1):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = part.replace('X','(X - (dx0) - ((dx1)-(dx0))*(Y-(y0))/((y1)-(y0)))')
   part = part.replace('y0',str(y0))
   part = part.replace('y1',str(y1))
   part = part.replace('dx0',str(dx0))
   part = part.replace('dx1',str(dx1))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def shear_x_z(part,z0,z1,dx0,dx1):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   part = part.replace('X','(X - (dx0) - ((dx1)-(dx0))*(Z-(z0))/((z1)-(z0)))')
   part = part.replace('z0',str(z0))
   part = part.replace('z1',str(z1))
   part = part.replace('dx0',str(dx0))
   part = part.replace('dx1',str(dx1))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def coshear_x_z(part,z0,z1,angle0,angle1,amplitude,offset):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   phase0 = math.pi*angle0/180.
   phase1 = math.pi*angle1/180.
   part = part.replace('X','(X - (offset) - (amplitude)*math.cos((phase0) + ((phase1)-(phase0))*(Z-(z0))/((z1)-(z0))))')
   part = part.replace('z0',str(z0))
   part = part.replace('z1',str(z1))
   part = part.replace('phase0',str(phase0))
   part = part.replace('phase1',str(phase1))
   part = part.replace('amplitude',str(amplitude))
   part = part.replace('offset',str(offset))
   return part

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# text classes and definitions
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

class text:
   #
   # text class
   #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   def __init__(self,text,x,y,z=0,line='',height='',width='',space='',align='CC',color=White,angle=0):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858
      #
      # 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))
      shape = scale_y(shape,0,height/width)
      shape = add(shape,move(rotate(rectangle(-line/2,line/2,-width/4,width/4),30),3*width/4,width/4))
      shapes['Q'] = shape
      shape = circle(width/2,width/2,width/2)
      shape = subtract(shape,circle(width/2,width/2,width/2-line))
      shape = add(shape,rectangle(width-line,width,-height/3,width))
      shapes['q'] = 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))
      leg = triangle(line,0,line,height,width,0)
      leg = subtract(leg,triangle(line,-2.0*line,line,height-2.0*line,width,-2.0*line))
      leg = subtract(leg,rectangle(0,width,height/3,height))
      shape = add(shape,leg)
      shapes['R'] = shape
      shape = circle(width,0,width)
      shape = subtract(shape,circle(width,0,width-line))
      shape = subtract(shape,rectangle(.8*width,2*width,-height,height))
      shape = subtract(shape,rectangle(0,2*width,-height,0))
      shape = add(shape,rectangle(0,line,0,width))
      shapes['r'] = 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/2,width/2,width))
      shape = add(shape,move(reflect_y(reflect_x(shape,width),width),0,width-line))
      shape = scale_y(shape,0,height/(2*width-line))
      shapes['S'] = shape
      w = width/3
      shape = circle(w,w,w)
      shape = subtract(shape,circle(w,w,w-.9*line))
      shape = subtract(shape,rectangle(0,w,w,2*w))
      shape = add(shape,move(reflect_y(reflect_x(shape,2*w),2*w),0,2*w-.9*line))
      shape = scale_y(shape,0,(2*height/3)/(4*w-.9*line))
      shape = move(shape,(width/2)-w,0)
      shapes['s'] = shape
      shape = rectangle(width/2-line/2,width/2+line/2,0,height)
      shape = add(shape,rectangle(0,width,height-line,height))
      shapes['T'] = shape
      shape = circle(0,3*width/8,3*width/8)
      shape = subtract(shape,circle(0,3*width/8,3*width/8-line))
      shape = subtract(shape,rectangle(-width,width,3*width/8,height))
      shape = subtract(shape,rectangle(0,width,-height,height))
      shape = move(shape,width/2-line/2+3*width/8,0)
      shape = add(shape,rectangle(width/2-line/2,width/2+line/2,width/4,3*height/4))
      shape = add(shape,rectangle(width/5,4*width/5,height/2-line/2,height/2+line/2))
      shapes['t'] = 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(0,line,width/2,height))
      shape = add(shape,rectangle(width-line,width,width/2,height))
      shapes['U'] = 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(0,line,width/2,2*height/3))
      shape = add(shape,rectangle(width-line,width,0,2*height/3))
      shapes['u'] = shape
      shape = triangle(0,height,width,height,width/2,0)
      shape = subtract(shape,triangle(0,height+3*line,width,height+3*line,width/2,3*line))
      shapes['V'] = shape
      w = 2*height/3.0
      shape = triangle(0,w,width,w,width/2,0)
      shape = subtract(shape,triangle(0,w+2*line,width,w+2*line,width/2,2*line))
      shapes['v'] = shape
      shape = triangle(0,height,width,height,width/2,0)
      shape = add(shape,move(shape,.6*width,0))
      cutout = triangle(0,height+4*line,width,height+4*line,width/2,4*line)
      cutout = add(cutout,move(cutout,.6*width,0))
      shape = subtract(shape,cutout)
      shape = scale_x(shape,0,1/1.6)
      shapes['W'] = shape
      shape = scale_y(shapes['W'],0,width/height)
      shapes['w'] = shape
      shape = rectangle(0,width,0,height)
      shape = subtract(shape,triangle(0,0,0,height,width/2-.7*line,height/2))
      shape = subtract(shape,triangle(width,0,width/2+.7*line,height/2,width,height))
      shape = subtract(shape,triangle(1.1*line,height,width-1.1*line,height,width/2,height/2+line))
      shape = subtract(shape,triangle(1.1*line,0,width/2,height/2-line,width-1.1*line,0))
      shapes['X'] = shape
      w = 2*height/3.0
      shape = rectangle(0,width,0,w)
      shape = subtract(shape,triangle(0,0,0,w,width/2-.75*line,w/2))
      shape = subtract(shape,triangle(width,0,width/2+.75*line,w/2,width,w))
      shape = subtract(shape,triangle(1.25*line,0,width/2,w/2-.75*line,width-1.25*line,0))
      shape = subtract(shape,triangle(1.25*line,w,width-1.25*line,w,width/2,w/2+.75*line))
      shapes['x'] = shape
      w = height/2
      shape = rectangle(0,width,w,height)
      shape = subtract(shape,triangle(0,w,0,height,width/2-line/2,w))
      shape = subtract(shape,triangle(width/2+line/2,w,width,height,width,w))
      shape = subtract(shape,triangle(1.1*line,height,width-1.1*line,height,width/2,w+1.1*line))
      shape = add(shape,rectangle(width/2-line/2,width/2+line/2,0,w))
      shapes['Y'] = shape
      shape = rectangle(0,width,-height/3,width)
      shape = subtract(shape,triangle(0,-height/3,0,width,width/2-.9*line,0))
      shape = subtract(shape,triangle(1.1*line,width,width-1.1*line,width,width/2-.2*line,1.6*line))
      shape = subtract(shape,triangle(1.2*line,-height/3,width,width,width,-height/3))
      shapes['y'] = shape
      shape = rectangle(0,width,0,height)
      shape = subtract(shape,triangle(0,line,0,height-line,width-1.4*line,height-line))
      shape = subtract(shape,triangle(1.4*line,line,width,height-line,width,line))
      shapes['Z'] = shape
      w = 2*height/3
      shape = rectangle(0,width,0,w)
      shape = subtract(shape,triangle(0,line,0,w-line,width-1.6*line,w-line))
      shape = subtract(shape,triangle(width,line,1.6*line,line,width,w-line))
      shapes['z'] = shape
      shape = circle(width/2,width/2,width/2)
      shape = subtract(shape,circle(width/2,width/2,width/2-.9*line))
      shape = scale_y(shape,0,height/width)
      shapes['0'] = shape
      shape = rectangle(width/2-line/2,width/2+line/2,0,height)
      w = width/2-line/2
      cutout = circle(0,height,w)
      shape = add(shape,rectangle(0,width/2,height-w-line,height))
      shape = subtract(shape,cutout)
      shape = move(shape,(width/2+line/2)/4,0)
      shapes['1'] = shape
      shape = circle(width/2,height-width/2,width/2)
      shape = subtract(shape,circle(width/2,height-width/2,width/2-line))
      shape = subtract(shape,rectangle(0,width/2,0,height-width/2))
      shape = add(shape,rectangle(0,width,0,height-width/2))
      shape = subtract(shape,triangle(0,line,0,height-width/2,width-line,height-width/2))
      shape = subtract(shape,triangle(1.5*line,line,width,height-width/2-.5*line,width,line))
      shapes['2'] = shape
      shape = circle(width/2,width/2,width/2)
      shape = subtract(shape,circle(width/2,width/2,width/2-line))
      shape = scale_y(shape,0,(height/2+line/2)/width)
      shape = add(shape,move(shape,0,height/2-line/2))
      shape = subtract(shape,rectangle(0,width/2,height/4,3*height/4))
      shapes['3'] = shape
      shape = rectangle(width-line,width,0,height)
      shape = add(shape,triangle(0,height/3,width-line,height,width-line,height/3))
      shape = subtract(shape,triangle(1.75*line,height/3+line,width-line,height-1.5*line,width-line,height/3+line))
      shapes['4'] = 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/2,width/2,width))
      shape = add(shape,rectangle(0,width/2,width-line,width))
      shape = add(shape,rectangle(0,line,width-line,height))
      shape = add(shape,rectangle(0,width,height-line,height))
      shapes['5'] = shape
      shape = circle(width/2,height-width/2,width/2)
      shape = subtract(shape,circle(width/2,height-width/2,width/2-line))
      shape = subtract(shape,rectangle(0,width,0,height-width/2))
      shape = subtract(shape,triangle(width,height,width,height/2,width/2,height/2))
      shape = add(shape,circle(width/2,width/2,width/2))
      shape = subtract(shape,circle(width/2,width/2,width/2-line))
      shape = add(shape,rectangle(0,line,width/2,height-width/2))
      shapes['6'] = shape
      shape = rectangle(0,width,0,height)
      shape = subtract(shape,triangle(0,0,0,height-line,width-line,height-line))
      shape = subtract(shape,triangle(line,0,width,height-line,width,0))
      shapes['7'] = shape
      shape = circle(width/2,width/2,width/2)
      shape = subtract(shape,circle(width/2,width/2,width/2-line))
      shape = scale_y(shape,0,(height/2+line/2)/width)
      shape = add(shape,move(shape,0,height/2-line/2))
      shapes['8'] = 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 = subtract(shape,triangle(0,0,0,height/2,width/2,height/2))
      shape = add(shape,circle(width/2,height-width/2,width/2))
      shape = subtract(shape,circle(width/2,height-width/2,width/2-line))
      shape = add(shape,rectangle(width-line,width,width/2,height-width/2))
      shapes['9'] = shape
      w = width/2
      shape = circle(w,w,w)
      shape = subtract(shape,circle(w,w,w-line))
      shape = subtract(shape,rectangle(w,width,0,height))
      shape = scale_y(shape,0,height/width)
      shape = move(shape,w/2,0)
      shapes['('] = shape
      shape = reflect_x(shape,width)
      shapes[')'] = shape
      shapes[' '] = false
      shape = rectangle(width/2-width/3,width/2+width/3,height/2-line/2,height/2+line/2)
      shape = add(shape,rectangle(width/2-line/2,width/2+line/2,height/2-width/3,height/2+width/3))
      shapes['+'] = shape
      shape = rectangle(width/2-width/3,width/2+width/3,height/2-line/2,height/2+line/2)
      shapes['-'] = shape
      shape = circle(width/2,line,.75*line)
      shapes['.'] = shape
      shape = rectangle(0,width,0,height)
      d = .8*line
      shape = subtract(shape,triangle(d,0,width,height-d,width,0))
      shape = subtract(shape,triangle(0,d,0,height,width-d,height))
      shapes['/'] = shape
      #
      # to be done
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      shapes['*'] = shape
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      shapes['~'] = shape
      shapes['!'] = shape
      shapes['@'] = shape
      shapes['#'] = shape
      shapes['$'] = shape
      shapes['%'] = shape
      shapes['^'] = shape
      shapes['&'] = shape
      shapes['&'] = shape
      shapes['_'] = shape
      shapes['='] = shape
      shapes['['] = shape
      shapes['{'] = shape
      shapes[']'] = shape
      shapes['}'] = shape
      shapes[';'] = shape
      shapes[':'] = shape
      shapes["'"] = shape
      shapes['"'] = shape
      shapes[','] = shape
      shapes['<'] = shape
      shapes['>'] = shape
      shapes['?'] = shape
      #
      # add a line to text shape
      #
      def addline(lineshape):
         #
         # LR align
         #
         if (align[0] == 'C'):
            lineshape = move(lineshape,-self.width/2.0,0)
         elif (align[0] == 'R'):
            lineshape = move(lineshape,-self.width,0)
         #
         # add
         #
         self.shape = add(self.shape,lineshape)
      #
      # loop over chars
      #
      dx = 0
      dy = -height
      self.width = -space
      self.height = height
      lineshape = false
      self.shape = false
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      count = 0
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      for chr in text:
         if (chr == '\n'):
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
            count += 1
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
            addline(lineshape)
            dx = 0
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
            dy -= 1.5*self.height/(1+(count-1)*1.5)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
            self.width = -space
            self.height += 1.5*self.height
            lineshape = false
         else:
            lineshape = add(lineshape,move(shapes[chr],dx,dy))
            self.width += space + width
            dx += width + space
      addline(lineshape)
      #
      # UD align
      #
      if (align[1] == 'C'):
         self.shape = move(self.shape,0,self.height/2.0)
      elif (align[1] == 'B'):
         self.shape = move(self.shape,0,self.height)
      #
      # rotate
      #
      if (angle == 90):
         self.shape = rotate_90(self.shape)
      elif (angle == 180):
         self.shape = rotate_180(self.shape)
      elif ((angle == 270) | (angle == -90)):
         self.shape = rotate_270(self.shape)
      elif (angle != 0):
         self.shape = rotate(self.shape,angle)
      #
      # translate
      #
      self.shape = move(self.shape,x,y)
      #
      # color
      #
      self.shape = '('+str(color)+'*(('+self.shape+')!=0))'

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# PCB classes and definitions
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

class PCB:
   def __init__(self,x0,y0,width,height,mask):
      self.board = false
      self.labels = false
      self.interior = rectangle(x0,x0+width,y0,y0+height)
      self.exterior = subtract(true,rectangle(x0,x0+width,y0,y0+height))
      self.mask = false
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.holes = false
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.cutout = false
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   def add(self,part):
      self.board = add(self.board,part)
      self.mask = add(self.mask,move(part,-mask,mask))
      self.mask = add(self.mask,move(part,-mask,-mask))
      self.mask = add(self.mask,move(part,mask,mask))
      self.mask = add(self.mask,move(part,mask,-mask))
      return self

class point:
   def __init__(self,x,y,z=0):
      self.x = x
      self.y = y
      self.z = z

class part:
   class text:
      def __init__(self,x,y,z=0,text='',line=0.006,angle=0):
         self.x = x
         self.y = y
         self.z = z
         self.text = text
         self.line = line 
         self.angle = angle
   def add(self,pcb,x,y,z=0,angle=0,line=0.007):
      self.x = x
      self.y = y
      self.z = z
      self.angle = angle
      if (angle == 90):
         self.shape = rotate_90(self.shape)
      elif (angle == 180):
         self.shape = rotate_180(self.shape)
      elif ((angle == 270) | (angle == -90)):
         self.shape = rotate_270(self.shape)
      elif (angle != 0):
         self.shape = rotate(self.shape,angle)
      self.shape = translate(self.shape,x,y,z)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      if hasattr(self,'holes'):
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
         if (angle == 90):
            self.holes = rotate_90(self.holes)
         elif (angle == 180):
            self.holes = rotate_180(self.holes)
         elif ((angle == 270) | (angle == -90)):
            self.holes = rotate_270(self.holes)
         elif (angle != 0):
            self.holes = rotate(self.holes,angle)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
         self.holes = translate(self.holes,x,y,z)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      if hasattr(self,'cutout'):
         if (angle == 90):
            self.cutout = rotate_90(self.cutout)
         elif (angle == 180):
            self.cutout = rotate_180(self.cutout)
         elif ((angle == 270) | (angle == -90)):
            self.cutout = rotate_270(self.cutout)
         elif (angle != 0):
            self.cutout = rotate(self.cutout,angle)
         self.cutout = translate(self.cutout,x,y,z)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      deg_angle = angle
      angle = math.pi*angle/180
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      for i in range(len(self.pad)):
         xnew = math.cos(angle)*self.pad[i].x - math.sin(angle)*self.pad[i].y
         ynew = math.sin(angle)*self.pad[i].x + math.cos(angle)*self.pad[i].y
         self.pad[i].x = x + xnew
         self.pad[i].y = y + ynew
         self.pad[i].z += z
      pcb.labels = add(pcb.labels,text(self.value,x,y,z,line=line,color=Green).shape)
      for i in range(len(self.labels)):
         xnew = math.cos(angle)*self.labels[i].x - math.sin(angle)*self.labels[i].y
         ynew = math.sin(angle)*self.labels[i].x + math.cos(angle)*self.labels[i].y
         self.labels[i].x = x + xnew
         self.labels[i].y = y + ynew
         self.labels[i].z += z
         if ((-90 < deg_angle) & (deg_angle <= 90)):
            pcb.labels = add(pcb.labels,text(self.labels[i].text,self.labels[i].x,self.labels[i].y,self.labels[i].z,self.labels[i].line,color=Red,angle=deg_angle-self.labels[i].angle).shape)
         else:
            pcb.labels = add(pcb.labels,text(self.labels[i].text,self.labels[i].x,self.labels[i].y,self.labels[i].z,self.labels[i].line,color=Red,angle=(deg_angle-self.labels[i].angle-180)).shape)
      pcb = pcb.add(self.shape)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      if hasattr(self,'holes'):
         pcb.holes = add(pcb.holes,self.holes)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      if hasattr(self,'cutout'):
         pcb.interior = subtract(pcb.interior,self.cutout)
         pcb.exterior = add(pcb.exterior,self.cutout)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      return pcb

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def wire(pcb,width,*points):
   x0 = points[0].x
   y0 = points[0].y
   z0 = points[0].z
   pcb.board = add(pcb.board,cylinder(x0,y0,z0,z0,width/2))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   for i in range(1,len(points)):
      x0 = points[i-1].x
      y0 = points[i-1].y
      z0 = points[i-1].z
      x1 = points[i].x
      y1 = points[i].y
      z1 = points[i].z
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      pcb.board = add(pcb.board,line(x0,y0,x1,y1,z1,width))
      pcb.board = add(pcb.board,cylinder(x1,y1,z1,z1,width/2))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   return pcb

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
def wirer(pcb,width,*points):
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   for i in range(1,len(points)):
      x0 = points[i-1].x
      y0 = points[i-1].y
      z0 = points[i-1].z
      x1 = points[i].x
      y1 = points[i].y
      z1 = points[i].z
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      if (x0 < x1):
         pcb.board = add(pcb.board,cube(x0-width/2,x1+width/2,y0-width/2,y0+width/2,z0,z0))
      elif (x1 < x0):
         pcb.board = add(pcb.board,cube(x1-width/2,x0+width/2,y0-width/2,y0+width/2,z0,z0))
      if (y0 < y1):
         pcb.board = add(pcb.board,cube(x1-width/2,x1+width/2,y0-width/2,y1+width/2,z0,z0))
      elif (y1 < y0):
         pcb.board = add(pcb.board,cube(x1-width/2,x1+width/2,y1-width/2,y0+width/2,z0,z0))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   return pcb

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# PCB library
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class via(part):
   #
   # via
   #
   def __init__(self,zb,zt,rv,rp,value=''):
      self.value = value
      self.labels = []
      self.pad = [point(0,0,0)]
      self.shape = cylinder(0,0,zb,zt,rp)
      self.holes = cylinder(0,0,zb,zt,rv)
      self.pad.append(point(0,0,zt))
      self.pad.append(point(0,0,zb))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class SJ(part):
   #
   # solder jumper
   #
   def __init__(self,value=''):
      pad_SJ = cube(-.02,.02,-.03,.03,0,0)
      self.value = value
      self.labels = []
      self.pad = [point(0,0,0)]
      self.shape = translate(pad_SJ,-.029,0,0)
      self.pad.append(point(-.029,0,0))
      self.shape = add(self.shape,translate(pad_SJ,.029,0,0))
      self.pad.append(point(.029,0,0))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# discretes
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed

class ST4EB(part):
   #
   # Nidec Copal ST4ETB103 trimpot
   #
   def __init__(self,value=''):
      pad1 = cube(-.032,.032,-.039,.039,0,0)
      pad2 = cube(-.039,.039,-.039,.039,0,0)
      self.value = value
      self.labels = []
      self.pad = [point(0,0,0)]
      self.shape = translate(pad1,-.046,-.118,0)
      self.pad.append(point(-.046,-.118,0))
      self.shape = add(self.shape,translate(pad1,.046,-.118,0))
      self.pad.append(point(.046,-.118,0))
      self.shape = add(self.shape,translate(pad2,0,.118,0))
      self.pad.append(point(0,.118,0))

class C_FND(part):
   #
   # Panasonic FN series, size code D
   #    100uF: EEE-FN1E101UL
   #
   def __init__(self,value=''):
      pad = cube(-.032,.032,-.06,.06,0,0)
      self.value = value
      self.labels = []
      self.pad = [point(0,0,0)]
      self.shape = translate(pad,0,.11,0)
      self.pad.append(point(0,.11,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'+',angle=90))
      self.shape = add(self.shape,translate(pad,0,-.11,0))
      self.pad.append(point(0,-.11,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'-',angle=90))

Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
pad_0402 = cube(-.0175,.0175,-.014,.014,0,0)

class R_0402(part):
   #
   # 0402 resistor
   #
   def __init__(self,value=''):
      self.value = value
      self.labels = []
      self.pad = [point(0,0,0)]
      self.shape = translate(pad_0402,-.0265,0,0)
      self.pad.append(point(-.0265,0,0))
      self.shape = add(self.shape,translate(pad_0402,.0265,0,0))
      self.pad.append(point(.0265,0,0))

pad_1206 = cube(-.032,.032,-.034,.034,0,0)

class R_1206(part):
   #
   # 1206 resistor
   #
   def __init__(self,value=''):
      self.value = value
      self.labels = []
      self.pad = [point(0,0,0)]
      self.shape = translate(pad_1206,-.06,0,0)
      self.pad.append(point(-.06,0,0))
      self.shape = add(self.shape,translate(pad_1206,.06,0,0))
      self.pad.append(point(.06,0,0))

class C_1206(part):
   #
   # 1206 capacitor
   #
   def __init__(self,value=''):
      self.value = value
      self.labels = []
      self.pad = [point(0,0,0)]
      self.shape = translate(pad_1206,-.06,0,0)
      self.pad.append(point(-.06,0,0))
      self.shape = add(self.shape,translate(pad_1206,.06,0,0))
      self.pad.append(point(.06,0,0))

pad_1210 = cube(-.032,.032,-.048,.048,0,0)

class L_1210(part):
   #
   # 1210 inductor
   #
   def __init__(self,value=''):
      self.value = value
      self.labels = []
      self.pad = [point(0,0,0)]
      self.shape = translate(pad_1210,-.06,0,0)
      self.pad.append(point(-.06,0,0))
      self.shape = add(self.shape,translate(pad_1210,.06,0,0))
      self.pad.append(point(.06,0,0))

pad_choke = cube(-.06,.06,-.06,.06,0,0)

class choke(part):
   #
   # Panasonic ELLCTV
   #
   def __init__(self,value=''):
      self.value = value
      self.labels = []
      self.pad = [point(0,0,0)]
      self.shape = translate(pad_choke,-.177,-.177,0)
      self.pad.append(point(-.177,-.177,0))
      self.shape = add(self.shape,translate(pad_choke,.177,.177,0))
      self.pad.append(point(.177,.177,0))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# connectors
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class header_2H(part):
   #
   # 2x1x0.1 cable header
   #    Sullins GEC36SBSN-M89	
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,0,.05,0)
      self.pad.append(point(0,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,0,-.05,0))
      self.pad.append(point(0,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'2'))

class header_4H(part):
   #
   # 4x1x0.1 cable header
   #    Sullins GEC36SBSN-M89	
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,0,.15,0)
      self.pad.append(point(0,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,0,.05,0))
      self.pad.append(point(0,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'2'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,0,-.05,0))
      self.pad.append(point(0,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'3'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,0,-0.15,0))
      self.pad.append(point(0,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'4'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class header_NEO_6M(part):
   #
   # NEO_6M GPS module
   #
   def __init__(self,value=''):
      pad_header = cylinder(0,0,0,0,.03)
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,0,.2,0)
      self.pad.append(point(0,.2,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PPS'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,0,.1,0))
      self.pad.append(point(0,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'TXD'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,0,0,0))
      self.pad.append(point(0,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RXD'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,0,-.1,0))
      self.pad.append(point(0,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_header,0,-.2,0))
      self.pad.append(point(0,-.2,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))

class header_MFRC522(part):
   #
   # MFCR522 RFID module
   #
   def __init__(self,value=''):
      pad_header = cylinder(0,0,0,0,.03)
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,0,.35,0)
      self.pad.append(point(0,.35,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1SDA'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,0,.25,0))
      self.pad.append(point(0,.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCK'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,0,.15,0))
      self.pad.append(point(0,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'COPI'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,0,0.05,0))
      self.pad.append(point(0,0.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CIPO'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_header,0,-.05,0))
      self.pad.append(point(0,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IRQ'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad_header,0,-.15,0))
      self.pad.append(point(0,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad_header,0,-.25,0))
      self.pad.append(point(0,-.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST'))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad_header,0,-.35,0))
      self.pad.append(point(0,-.35,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'3.3V'))

class header_LSM6DS33_2736(part):
   #
   # LSD6DS33 carrier
   #    Pololu 2736
   #
   def __init__(self,value=''):
      pad_header = cylinder(0,0,0,0,.03)
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,0,.4,0)
      self.pad.append(point(0,.4,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1VDD'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,0,.3,0))
      self.pad.append(point(0,.3,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VIN'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,0,.2,0))
      self.pad.append(point(0,.2,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,0,0.1,0))
      self.pad.append(point(0,0.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDA'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_header,0,0,0))
      self.pad.append(point(0,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCL'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad_header,0,-.1,0))
      self.pad.append(point(0,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDO'))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad_header,0,-.2,0))
      self.pad.append(point(0,-.2,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CS'))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad_header,0,-.3,0))
      self.pad.append(point(0,-.3,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'INT2'))
      #
      # pin 9
      #
      self.shape = add(self.shape,translate(pad_header,0,-.4,0))
      self.pad.append(point(0,-.4,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'INT1'))

class header_VL53L1X_3415(part):
   #
   # VL53L1X carrier
   #    Pololu 3415
   #
   def __init__(self,value=''):
      pad_header = cylinder(0,0,0,0,.03)
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,0,.3,0)
      self.pad.append(point(0,.3,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1VDD'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,0,.2,0))
      self.pad.append(point(0,.2,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VIN'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,0,.1,0))
      self.pad.append(point(0,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,0,0,0))
      self.pad.append(point(0,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDA'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_header,0,-.1,0))
      self.pad.append(point(0,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCL'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad_header,0,-.2,0))
      self.pad.append(point(0,-.2,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'XSHUT'))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad_header,0,-.3,0))
      self.pad.append(point(0,-.3,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GPIO1'))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class ESP_WROOM_02D(part):
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   # ESP-WROOM-02D
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      pad = cube(-1/25.4,1/25.4,-.45/25.4,.45/25.4,0,0)
      width = 17.5/25.4
      pitch = 1.5/25.4
      #
      # pin 1
      #
      self.shape = translate(pad,-width/2,4*pitch,0)
      self.shape = add(self.shape,cylinder(-width/2-.75/25.4,4*pitch,0,0,.45/25.4))
      self.pad.append(point(-width/2,4*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'3V3'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad,-width/2,3*pitch,0))
      self.pad.append(point(-width/2,3*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'EN'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad,-width/2,2*pitch,0))
      self.pad.append(point(-width/2,2*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO14'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad,-width/2,1*pitch,0))
      self.pad.append(point(-width/2,1*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO12'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad,-width/2,0*pitch,0))
      self.pad.append(point(-width/2,0*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO13'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad,-width/2,-1*pitch,0))
      self.pad.append(point(-width/2,-1*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO15'))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad,-width/2,-2*pitch,0))
      self.pad.append(point(-width/2,-2*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO2'))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad,-width/2,-3*pitch,0))
      self.pad.append(point(-width/2,-3*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO0'))
      #
      # pin 9
      #
      self.shape = add(self.shape,translate(pad,-width/2,-4*pitch,0))
      self.pad.append(point(-width/2,-4*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 10
      #
      self.shape = add(self.shape,translate(pad,width/2,-4*pitch,0))
      self.pad.append(point(width/2,-4*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO4'))
      #
      # pin 11
      #
      self.shape = add(self.shape,translate(pad,width/2,-3*pitch,0))
      self.pad.append(point(width/2,-3*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RXD'))
      #
      # pin 12
      #
      self.shape = add(self.shape,translate(pad,width/2,-2*pitch,0))
      self.pad.append(point(width/2,-2*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'TXD'))
      #
      # pin 13
      #
      self.shape = add(self.shape,translate(pad,width/2,-1*pitch,0))
      self.pad.append(point(width/2,-1*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 14
      #
      self.shape = add(self.shape,translate(pad,width/2,0*pitch,0))
      self.pad.append(point(width/2,0*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO5'))
      #
      # pin 15
      #
      self.shape = add(self.shape,translate(pad,width/2,1*pitch,0))
      self.pad.append(point(width/2,1*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST'))
      #
      # pin 16
      #
      self.shape = add(self.shape,translate(pad,width/2,2*pitch,0))
      self.pad.append(point(width/2,2*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'TOUT'))
      #
      # pin 17
      #
      self.shape = add(self.shape,translate(pad,width/2,3*pitch,0))
      self.pad.append(point(width/2,3*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO16'))
      #
      # pin 18
      #
      self.shape = add(self.shape,translate(pad,width/2,4*pitch,0))
      self.pad.append(point(width/2,4*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 19
      #
      padg = cube(-2/25.4,2/25.4,-2/25.4,2/25.4,0,0)
      self.shape = add(self.shape,translate(padg,(1.5/2+7.1+2-17.5/2)/25.4,(4*1.5+7.1-20+4.29+2)/25.4,0))
      self.pad.append(point((1.5/2+7.1+2-17.5/2)/25.4,(4*1.5+7.1-20+4.29+2)/25.4,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))

class ESP_01(part):
   #
   # ESP-01 4x2 vertical
   #    Sullins NPTC042KFMS-RC	
   #
   def __init__(self,value=''):
      pad_header = cube(-.075/2,.075/2,-.04/2,.04/2,0,0)
      d = .305/2-.07/2
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,d,.15,0)
      self.shape = add(self.shape,cylinder(d+.061/2,.15,0,0,.039/2))
      self.pad.append(point(d,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,-d,.15,0))
      self.pad.append(point(-d,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Tx'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,d,.05,0))
      self.pad.append(point(d,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO2'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,-d,.05,0))
      self.pad.append(point(-d,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'EN'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_header,d,-.05,0))
      self.pad.append(point(d,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO0'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad_header,-d,-.05,0))
      self.pad.append(point(-d,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST'))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad_header,d,-.15,0))
      self.pad.append(point(d,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Rx'))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad_header,-d,-.15,0))
      self.pad.append(point(-d,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))

class header_serial_reverse_5V(part):
   #
   # serial cable header, reverse for female connector, 5V output
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   #    GCT BG300-06-A-L-A	
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,0,-.25,0)
      self.shape = add(self.shape,cylinder(-.05,-.25,0,0,.025))
      self.pad.append(point(0,-.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,0,-.15,0))
      self.pad.append(point(0,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CTS'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,0,-.05,0))
      self.pad.append(point(0,-.05,0))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'5V'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,0,0.05,0))
      self.pad.append(point(0,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Tx'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_header,0,.15,0))
      self.pad.append(point(0,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Rx'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad_header,0,.25,0))
      self.pad.append(point(0,.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RTS'))

class header_serial_reverse_3V3(part):
   #
   # serial cable header, reverse for female connector, 3.3V output
   #    GCT BG300-06-A-L-A	
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,0,-.25,0)
      self.shape = add(self.shape,cylinder(-.05,-.25,0,0,.025))
      self.pad.append(point(0,-.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,0,-.15,0))
      self.pad.append(point(0,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CTS'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,0,-.05,0))
      self.pad.append(point(0,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'3.3V'))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,0,0.05,0))
      self.pad.append(point(0,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Tx'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_header,0,.15,0))
      self.pad.append(point(0,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Rx'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad_header,0,.25,0))
      self.pad.append(point(0,.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RTS'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class TFT8x1v(part):
   #
   # TFT 8x1 vertical
   #    2x Sullins S5635-ND
   #
   def __init__(self,value=''):
      pad_header = cube(-.079/2,.079/2,-.039/2,.039/2,0,0)
      d = .209/2-.079/2
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,-d,-.35,0)
      self.pad.append(point(-d,-.35,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1LED'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,d,-.25,0))
      self.pad.append(point(d,-.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCK'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,-d,-.15,0))
      self.pad.append(point(-d,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'MOSI'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,d,-.05,0))
      self.pad.append(point(d,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DC'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_header,-d,.05,0))
      self.pad.append(point(-d,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad_header,d,.15,0))
      self.pad.append(point(d,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CS'))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad_header,-d,.25,0))
      self.pad.append(point(-d,.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad_header,d,.35,0))
      self.pad.append(point(d,.35,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class header_SWD_4_05(part):
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   #
   # 4-pin header
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   # Sullins GRPB022VWQS-RC 2x2x0.05"
   #
   def __init__(self,value=''):
      pad_header = cube(-.043,.043,-.015,.015,0,0)
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,-.072,.025,0)
      self.shape = add(self.shape,cylinder(-.116,.025,0,0,.015))
      self.pad.append(point(-.072,.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CLK'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,.072,.025,0))
      self.pad.append(point(.072,.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DIO'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,-.072,-.025,0))
      self.pad.append(point(-.072,-.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,.072,-.025,0))
      self.pad.append(point(.072,-.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))

class header_SWD_4_1(part):
   #
   # 4-pin header
   # FCI 95278-101a04lf Bergstik 2x2x0.1"
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   #
   pad_header = cube(-.05,.05,-.025,.025,0,0)
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,-.107,.05,0)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #self.shape = add(self.shape,cylinder(-.157,.05,0,0,.025))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.pad.append(point(-.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CLK'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,.107,.05,0))
      self.pad.append(point(.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DIO'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.05,0))
      self.pad.append(point(-.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,.107,-.05,0))
      self.pad.append(point(.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class header_UPDI(part):
   #
   # UPDI header
   #    Sullins GEC36SBSN-M89	
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: UPDI
      #
      self.shape = translate(pad_header,0,-.05,0)
      self.shape = add(self.shape,cylinder(.05,-.05,0,0,.025))
      self.pad.append(point(0,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'UPDI'))
      #
      # pin 2: GND
      #
      self.shape = add(self.shape,translate(pad_header,0,.05,0))
      self.pad.append(point(0,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))

class header_UPDI_reverse(part):
   #
   # UPDI header, reverse for female connector
   #    GCT BG300-03-A-L-A	
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: UPDI
      #
      self.shape = translate(pad_header,0,.05,0)
      self.shape = add(self.shape,cylinder(.05,.05,0,0,.025))
      self.pad.append(point(0,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'UPDI'))
      #
      # pin 2: GND
      #
      self.shape = add(self.shape,translate(pad_header,0,-.05,0))
      self.pad.append(point(0,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class USB_A_plug(part):
   #
   # USB type A PCB plug
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: 5V
      #
      self.shape = translate(cube(-.05,.242,-.02,.02,0,0),0,.138,0)
      self.pad.append(point(0,.138,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'5V'))
      #
      # pin 2: D-
      #
      self.shape = add(self.shape,translate(cube(-0.05,.202,-.02,.02,0,0),0,.039,0))
      self.pad.append(point(0,.039,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'D-'))
      #
      # pin 3: D+
      #
      self.shape = add(self.shape,translate(cube(-.05,.202,-.02,.02,0,0),0,-.039,0))
      self.pad.append(point(0,-.039,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'D+'))
      #
      # pin 4: GND
      #
      self.shape = add(self.shape,translate(cube(-.05,.242,-.02,.02,0,0),0,-.138,0))
      self.pad.append(point(0,-.138,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # plug cutout
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.cutout = cube(-.05,1,.24,10,zb,zt)
      self.cutout = add(self.cutout,cube(-.05,10,-10,-.24,zb,zt))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed

class header_SWD(part):
   #
   # Serial Wire Debug programming header
   # Amphenol 20021121-00010T1LF	2x5x0.05
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      d = 0.077
      w = 0.015
      h = .047
      pad = cube(-h,h,-w,w,0,0)
      #
      # pin 1: VCC
      #
      self.shape = translate(pad,d,-.1,0)
      self.shape = add(self.shape,cylinder(d+h,-.1,0,0,w))
      self.pad.append(point(d,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))
      #
      # pin 2: DIO
      #
      self.shape = add(self.shape,translate(pad,-d,-.1,0))
      self.pad.append(point(-d,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DIO'))
      #
      # pin 3: GND
      #
      self.shape = add(self.shape,translate(pad,d,-.05,0))
      self.pad.append(point(d,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 4: CLK
      #
      self.shape = add(self.shape,translate(pad,-d,-.05,0))
      self.pad.append(point(-d,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CLK'))
      #
      # pin 5: GND
      #
      self.shape = add(self.shape,translate(pad,d,0,0))
      self.pad.append(point(d,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 6: SWO
      #
      self.shape = add(self.shape,translate(pad,-d,0,0))
      self.pad.append(point(-d,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SWO'))
      #
      # pin 7: KEY
      #
      self.shape = add(self.shape,translate(pad,d,.05,0))
      self.pad.append(point(d,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'KEY'))
      #
      # pin 8: NC
      #
      self.shape = add(self.shape,translate(pad,-d,.05,0))
      self.pad.append(point(-d,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'NC'))
      #
      # pin 9: GND
      #
      self.shape = add(self.shape,translate(pad,d,.1,0))
      self.pad.append(point(d,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 10: nRESET
      #
      self.shape = add(self.shape,translate(pad,-d,.1,0))
      self.pad.append(point(-d,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class ESC(part):
   #
   # ESC 3x1
   # Sullins S1013E-36-ND
   #
   def __init__(self,value=''):
      pad_header = cube(-.1,.1,-.05/2,.05/2,0,0)
      d = .075
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: PWM
      #
      self.shape = translate(pad_header,-d,-.1,0)
      self.pad.append(point(-d,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PWM'))
      #
      # pin 2: 5V
      #
      self.shape = add(self.shape,translate(pad_header,d,0,0))
      self.pad.append(point(d,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'5V'))
      #
      # pin 3: GND 
      #
      self.shape = add(self.shape,translate(pad_header,-d,.1,0))
      self.pad.append(point(-d,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class I2C4x1h(part):
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   # I2C 4x1 horizontal female
   #    GCT BG300-03-A-L-A	
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: SCL
      #
      self.shape = translate(pad_header,0,-.15,0)
      #self.shape = cylinder(.05,.15,0,0,.025)
      self.pad.append(point(0,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCL'))
      #
      # pin 2: SDA
      #
      self.shape = add(self.shape,translate(pad_header,0,-.05,0))
      self.pad.append(point(0,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDA'))
      #
      # pin 3: VCC
      #
      self.shape = add(self.shape,translate(pad_header,0,.05,0))
      self.pad.append(point(0,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))
      #
      # pin 4: GND
      #
      self.shape = add(self.shape,translate(pad_header,0,.15,0))
      self.pad.append(point(0,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))

class I2C4x1v(part):
   #
   # I2C 4x1 vertical
   #    Sullins S5635-ND
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   #
   def __init__(self,value=''):
      pad_header = cube(-.079/2,.079/2,-.039/2,.039/2,0,0)
      d = .209/2-.079/2
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: VCC
      #
      self.shape = translate(pad_header,-d,-.15,0)
      self.pad.append(point(-d,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1VCC'))
      #
      # pin 2: GND
      #
      self.shape = add(self.shape,translate(pad_header,d,-.05,0))
      self.pad.append(point(d,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 3: SCL
      #
      self.shape = add(self.shape,translate(pad_header,-d,.05,0))
      self.pad.append(point(-d,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCL'))
      #
      # pin 4: SDA
      #
      self.shape = add(self.shape,translate(pad_header,d,.15,0))
      self.pad.append(point(d,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDA'))

class I2C4x1i(part):
   #
   # I2C 4x1 inline
   #
   def __init__(self,value=''):
      pad_header = cube(-.079/2,.079/2,-.039/2,.039/2,0,0)
      d = 0
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: VCC
      #
      self.shape = translate(pad_header,-d,-.15,0)
      self.pad.append(point(-d,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1VCC'))
      #
      # pin 2: GND
      #
      self.shape = add(self.shape,translate(pad_header,d,-.05,0))
      self.pad.append(point(d,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 3: SCL
      #
      self.shape = add(self.shape,translate(pad_header,-d,.05,0))
      self.pad.append(point(-d,.05,0))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCL'))
      #
      # pin 4: SDA
      #
      self.shape = add(self.shape,translate(pad_header,d,.15,0))
      self.pad.append(point(d,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDA'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class RCWL0516(part):
   #
   # RCWL-0516 Doppler radar
   #
   def __init__(self,value=''):
      pad_header = cube(-.065,.065,-.025,.025,0,0)
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: 3.3V
      #
      self.shape = translate(pad_header,.107,-.2,0)
      self.shape = add(self.shape,cylinder(.172,-.2,0,0,.025))
      self.pad.append(point(.107,-.2,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'3.3V'))
      #
      # pin 2: GND
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.1,0))
      self.pad.append(point(-.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 3: OUT
      #
      self.shape = add(self.shape,translate(pad_header,.107,0,0))
      self.pad.append(point(.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'OUT'))
      #
      # pin 4: VIN
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.1,0))
      self.pad.append(point(-.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VIN'))
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 5: CDS
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      self.shape = add(self.shape,translate(pad_header,.107,.2,0))
      self.pad.append(point(.107,.2,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CDS'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class microSD(part):
   #
   # microSD
   # Amphenol 114-00841-68
   # 
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(cube(-.0138,.0138,-.034,.034,0,0),-.177+7*.0433,-.304,0)
      self.pad.append(point(-.177+7*.0433,-.304,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1NC',angle=90))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(cube(-.0138,.0138,-.034,.034,0,0),-.177+6*.0433,-.304,0))
      self.pad.append(point(-.177+6*.0433,-.304,0))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SS',angle=90))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(cube(-.0138,.0138,-.034,.034,0,0),-.177+5*.0433,-.304,0))
      self.pad.append(point(-.177+5*.0433,-.304,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'MOSI',angle=90))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(cube(-.0138,.0138,-.034,.034,0,0),-.177+4*.0433,-.304,0))
      self.pad.append(point(-.177+4*.0433,-.304,0))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC',angle=90))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(cube(-.0138,.0138,-.034,.034,0,0),-.177+3*.0433,-.304,0))
      self.pad.append(point(-.177+3*.0433,-.304,0))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCK',angle=90))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(cube(-.0138,.0138,-.034,.034,0,0),-.177+2*.0433,-.304,0))
      self.pad.append(point(-.177+2*.0433,-.304,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',angle=90))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(cube(-.0138,.0138,-.034,.034,0,0),-.177+1*.0433,-.304,0))
      self.pad.append(point(-.177+1*.0433,-.304,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'MISO',angle=90))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(cube(-.0138,.0138,-.034,.034,0,0),-.177+0*.0433,-.304,0))
      self.pad.append(point(-.177+0*.0433,-.304,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'NC',angle=90))
      #
      # feet
      #
      self.shape = add(self.shape,translate(cube(-.021,.021,-.029,.029,0,0),-.228,-.299,0)) # leave extra space for 1/64 milling
      self.shape = add(self.shape,translate(cube(-.029,.029,-.029,.029,0,0),.222,-.299,0))
      self.shape = add(self.shape,translate(cube(-.015,.015,-.029,.025,0,0),-.232,0,0)) # leave extra space for 1/64 milling
      self.shape = add(self.shape,translate(cube(-.015,.015,-.029,.029,0,0),-.232+.47,.025,0))
      self.shape = add(self.shape,translate(cube(-.028,.028,-.019,.019,0,0),-.221,.059,0))
      self.shape = add(self.shape,translate(cube(-.019,.019,-.030,.030,0,0),.222,.121,0))

Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837
pad_USB_trace = cube(-.0075,.0075,-.04,.04,0,0)
pad_USB_feet = cube(-.049,.049,-.043,.043,0,0)

class USB_mini_B(part):
   #
   # USB mini B
   # Hirose UX60-MB-5ST
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_USB_trace,.063,.36,0)
      self.pad.append(point(.063,.36,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_USB_trace,.0315,.36,0))
      self.pad.append(point(.0315,.36,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_USB_trace,0,.36,0))
      self.pad.append(point(0,.36,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'+'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_USB_trace,-.0315,.36,0))
      self.pad.append(point(-.0315,.36,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'-'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_USB_trace,-.063,.36,0))
      self.pad.append(point(-.063,.36,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V'))
      #
      # feet
      #
      self.shape = add(self.shape,translate(pad_USB_feet,.165,.33,0))
      self.shape = add(self.shape,translate(pad_USB_feet,-.165,.33,0))
      self.shape = add(self.shape,translate(pad_USB_feet,.165,.12,0))
      self.shape = add(self.shape,translate(pad_USB_feet,-.165,.12,0))

pad_header = cube(-.05,.05,-.025,.025,0,0)

class header_4(part):
   #
   # 4-pin header
   # fci 95278-101a04lf bergstik 2x2x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,-.107,.05,0)
      self.shape = add(self.shape,cylinder(-.157,.05,0,0,.025))
      self.pad.append(point(-.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,.107,.05,0))
      self.pad.append(point(.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'2'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.05,0))
      self.pad.append(point(-.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'3'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,.107,-.05,0))
      self.pad.append(point(.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'4'))

class header_signal(part):
   #
   # signal header
   # FCI 95278-101A04LF Bergstik 2x2x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: Gnd
      #
      self.shape = translate(pad_header,.107,-.05,0)
      self.shape = add(self.shape,cylinder(.157,-.05,0,0,.025))
      self.pad.append(point(.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.05,0))
      self.pad.append(point(-.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))
      #
      # pin 3: signal
      #
      self.shape = add(self.shape,translate(pad_header,.107,.05,0))
      self.pad.append(point(.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'signal'))
      #
      # pin 4:
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.05,0))
      self.pad.append(point(-.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))


class header_power(part):
   #
   # power header
   # FCI 95278-101A04LF Bergstik 2x2x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: Gnd
      #
      self.shape = translate(pad_header,.107,-.05,0)
      self.shape = add(self.shape,cylinder(.157,-.05,0,0,.025))
      self.pad.append(point(.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.05,0))
      self.pad.append(point(-.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))
      #
      # pin 3: V
      #
      self.shape = add(self.shape,translate(pad_header,.107,.05,0))
      self.pad.append(point(.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V'))
      #
      # pin 4:
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.05,0))
      self.pad.append(point(-.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))

class header_i0(part):
   #
   # i0 header
   # FCI 95278-101A04LF Bergstik 2x2x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: Gnd
      #
      self.shape = translate(pad_header,.107,-.05,0)
      self.shape = add(self.shape,cylinder(.157,-.05,0,0,.025))
      self.pad.append(point(.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 2: data
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.05,0))
      self.pad.append(point(-.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'data'))
      #
      # pin 3: V
      #
      self.shape = add(self.shape,translate(pad_header,.107,.05,0))
      self.pad.append(point(.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V'))
      #
      # pin 4:
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.05,0))
      self.pad.append(point(-.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))

class header_serial(part):
   #
   # serial comm header
   # FCI 95278-101A04LF Bergstik 2x2x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: Gnd
      #
      self.shape = translate(pad_header,.107,-.05,0)
      self.shape = add(self.shape,cylinder(.157,-.05,0,0,.025))
      self.pad.append(point(.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 2:DTR
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.05,0))
      self.pad.append(point(-.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DTR'))
      #
      # pin 3: Tx
      #
      self.shape = add(self.shape,translate(pad_header,.107,.05,0))
      self.pad.append(point(.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Tx'))
      #
      # pin 4: Rx
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.05,0))
      self.pad.append(point(-.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Rx'))

class header_bus(part):
   #
   # bus header
   # FCI 95278-101A04LF Bergstik 2x2x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: Gnd
      #
      self.shape = translate(pad_header,.107,-.05,0)
      self.shape = add(self.shape,cylinder(.157,-.05,0,0,.025))
      self.pad.append(point(.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 2: Tx
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.05,0))
      self.pad.append(point(-.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Tx'))
      #
      # pin 3: V
      #
      self.shape = add(self.shape,translate(pad_header,.107,.05,0))
      self.pad.append(point(.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V'))
      #
      # pin 4: Rx
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.05,0))
      self.pad.append(point(-.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Rx'))

class header_I2C(part):
   #
   # I2C header
   # FCI 95278-101A04LF Bergstik 2x2x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: SCL
      #
      self.shape = translate(pad_header,.107,-.05,0)
      self.shape = add(self.shape,cylinder(.157,-.05,0,0,.025))
      self.pad.append(point(.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCL'))
      #
      # pin 2: G
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.05,0))
      self.pad.append(point(-.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G'))
      #
      # pin 3: SDA
      #
      self.shape = add(self.shape,translate(pad_header,.107,.05,0))
      self.pad.append(point(.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDA'))
      #
      # pin 4: V
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.05,0))
      self.pad.append(point(-.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V'))

class header_APA(part):
   #
   # APA header
   # FCI 95278-101A04LF Bergstik 2x2x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: Gnd
      #
      self.shape = translate(pad_header,.107,-.05,0)
      self.shape = add(self.shape,cylinder(.157,-.05,0,0,.025))
      self.pad.append(point(.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 2: in
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.05,0))
      self.pad.append(point(-.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'in'))
      #
      # pin 3: V
      #
      self.shape = add(self.shape,translate(pad_header,.107,.05,0))
      self.pad.append(point(.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V'))
      #
      # pin 4: out
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.05,0))
      self.pad.append(point(-.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'out'))

class header_6(part):
   #
   # 6-pin header
   # FCI 95278-101A06LF Bergstik 2x3x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,.107,-.1,0)
      self.shape = add(self.shape,cylinder(.157,-.1,0,0,.025))
      self.pad.append(point(.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.1,0))
      self.pad.append(point(-.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,.107,0,0))
      self.pad.append(point(.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,-.107,0,0))
      self.pad.append(point(-.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_header,.107,.1,0))
      self.pad.append(point(.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.1,0))
      self.pad.append(point(-.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))

class header_ATP(part):
   #
   # Asynchronous Token Protocol header
   # FCI 95278-101A06LF Bergstik 2x3x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,.107,-.1,0)
      self.shape = add(self.shape,cylinder(.157,-.1,0,0,.025))
      self.pad.append(point(.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'BI'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.1,0))
      self.pad.append(point(-.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'TI'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,.107,0,0))
      self.pad.append(point(.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,-.107,0,0))
      self.pad.append(point(-.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_header,.107,.1,0))
      self.pad.append(point(.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'TO'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.1,0))
      self.pad.append(point(-.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'BO'))

class header_PDI(part):
   #
   # in-circuit PDI programming header
   # FCI 95278-101A06LF Bergstik 2x3x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: Data
      #
      self.shape = translate(pad_header,.107,-.1,0)
      self.shape = add(self.shape,cylinder(.157,-.1,0,0,.025))
      self.pad.append(point(.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DAT'))
      #
      # pin 2: VCC
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.1,0))
      self.pad.append(point(-.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))
      #
      # pin 3: NC 
      #
      self.shape = add(self.shape,translate(pad_header,.107,0,0))
      self.pad.append(point(.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'NC'))
      #
      # pin 4: NC
      #
      self.shape = add(self.shape,translate(pad_header,-.107,0,0))
      self.pad.append(point(-.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'NC'))
      #
      # pin 5: Clock
      #
      self.shape = add(self.shape,translate(pad_header,.107,.1,0))
      self.pad.append(point(.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CLK'))
      #
      # pin 6: GND
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.1,0))
      self.pad.append(point(-.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))

class header_ISP(part):
   #
   # in-circuit ISP programming header
   # FCI 95278-101A06LF Bergstik 2x3x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: MISO
      #
      self.shape = translate(pad_header,.107,-.1,0)
      self.shape = add(self.shape,cylinder(.157,-.1,0,0,.025))
      self.pad.append(point(.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'MISO'))
      #
      # pin 2: V
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.1,0))
      self.pad.append(point(-.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V'))
      #
      # pin 3: SCK
      #
      self.shape = add(self.shape,translate(pad_header,.107,0,0))
      self.pad.append(point(.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCK'))
      #
      # pin 4: MOSI
      #
      self.shape = add(self.shape,translate(pad_header,-.107,0,0))
      self.pad.append(point(-.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'MOSI'))
      #
      # pin 5: RST
      #
      self.shape = add(self.shape,translate(pad_header,.107,.1,0))
      self.pad.append(point(.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST'))
      #
      # pin 6: GND
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.1,0))
      self.pad.append(point(-.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class header_nRF24L01(part):
   #
   # nRF24L01 module header
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1:
      #
      self.shape = translate(pad_header,.107,-.15,0)
      self.shape = add(self.shape,cylinder(.157,-.15,0,0,.025))
      self.pad.append(point(.107,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 2:
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.15,0))
      self.pad.append(point(-.107,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))
      #
      # pin 3:
      #
      self.shape = add(self.shape,translate(pad_header,.107,-.05,0))
      self.pad.append(point(.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CE'))
      #
      # pin 4:
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.05,0))
      self.pad.append(point(-.107,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CS'))
      #
      # pin 5:
      #
      self.shape = add(self.shape,translate(pad_header,.107,.05,0))
      self.pad.append(point(.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCK'))
      #
      # pin 6:
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.05,0))
      self.pad.append(point(-.107,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'MOSI'))
      #
      # pin 7:
      #
      self.shape = add(self.shape,translate(pad_header,.107,.15,0))
      self.pad.append(point(.107,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'MISO'))
      #
      # pin 8:
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.15,0))
      self.pad.append(point(-.107,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IRQ'))

Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
class header_servo(part):
   #
   # servo motor header
   # FCI 95278-101A06LF Bergstik 2x3x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: ground
      #
      self.shape = translate(pad_header,.107,-.1,0)
      self.shape = add(self.shape,cylinder(.157,-.1,0,0,.025))
      self.pad.append(point(.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G/blk'))
      #
      # pin 2: ground
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.1,0))
      self.pad.append(point(-.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G/blk'))
      #
      # pin 3: power
      #
      self.shape = add(self.shape,translate(pad_header,.107,0,0))
      self.pad.append(point(.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V/red'))
      #
      # pin 4: power
      #
      self.shape = add(self.shape,translate(pad_header,-.107,0,0))
      self.pad.append(point(-.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V/red'))
      #
      # pin 5: signal 0
      #
      self.shape = add(self.shape,translate(pad_header,.107,.1,0))
      self.pad.append(point(.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'S0/wht'))
      #
      # pin 6: signal 1
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.1,0))
      self.pad.append(point(-.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'S1/wht'))

class header_unipolar_stepper(part):
   #
   # unipolar stepper header
   # FCI 95278-101A06LF Bergstik 2x3x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,.107,-.1,0)
      self.shape = add(self.shape,cylinder(.157,-.1,0,0,.025))
      self.pad.append(point(.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'red'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.1,0))
      self.pad.append(point(-.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'green'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,.107,0,0))
      self.pad.append(point(.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'black'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,-.107,0,0))
      self.pad.append(point(-.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'brown'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_header,.107,.1,0))
      self.pad.append(point(.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'orange'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.1,0))
      self.pad.append(point(-.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'yellow'))

class header_LCD(part):
   #
   # LCD interface header
   # FCI 95278-101A10LF Bergstik 2x3x0.1"
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1:
      #
      self.shape = translate(pad_header,.107,-.2,0)
      self.shape = add(self.shape,cylinder(.157,-.2,0,0,.025))
      self.pad.append(point(.107,-.2,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DB7\n14'))
      #
      # pin 2:
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.2,0))
      self.pad.append(point(-.107,-.2,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DB6\n13'))
      #
      # pin 3:
      #
      self.shape = add(self.shape,translate(pad_header,.107,-.1,0))
      self.pad.append(point(.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DB5\n12'))
      #
      # pin 4:
      #
      self.shape = add(self.shape,translate(pad_header,-.107,-.1,0))
      self.pad.append(point(-.107,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DB4\n11'))
      #
      # pin 5:
      #
      self.shape = add(self.shape,translate(pad_header,.107,0,0))
      self.pad.append(point(.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'E\n6'))
      #
      # pin 6:
      #
      self.shape = add(self.shape,translate(pad_header,-.107,0,0))
      self.pad.append(point(-.107,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'R/W\n5'))
      #
      # pin 7:
      #
      self.shape = add(self.shape,translate(pad_header,.107,.1,0))
      self.pad.append(point(.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RS\n4'))
      #
      # pin 8:
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.1,0))
      self.pad.append(point(-.107,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Vee\n3'))
      #
      # pin 9:
      #
      self.shape = add(self.shape,translate(pad_header,.107,.2,0))
      self.pad.append(point(.107,.2,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Vcc\n2'))
      #
      # pin 10:
      #
      self.shape = add(self.shape,translate(pad_header,-.107,.2,0))
      self.pad.append(point(-.107,.2,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND\n1'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class header_serial_reverse(part):
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   # serial cable header, reverse for female connector
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   #    GCT BG300-06-A-L-A	
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 1: GND
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      self.shape = translate(pad_header,0,-.25,0)
      self.shape = add(self.shape,cylinder(-.05,-.25,0,0,.025))
      self.pad.append(point(0,-.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 2: CTS (brown)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      self.shape = add(self.shape,translate(pad_header,0,-.15,0))
      self.pad.append(point(0,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CTS'))
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 3: VCC (red)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      self.shape = add(self.shape,translate(pad_header,0,-.05,0))
      self.pad.append(point(0,-.05,0))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 4: Tx (orange)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      self.shape = add(self.shape,translate(pad_header,0,0.05,0))
      self.pad.append(point(0,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Tx'))
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 5: Rx (yellow)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      self.shape = add(self.shape,translate(pad_header,0,.15,0))
      self.pad.append(point(0,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Rx'))
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 6: RTS (green)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      self.shape = add(self.shape,translate(pad_header,0,.25,0))
      self.pad.append(point(0,.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RTS'))

Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
class header_FTDI(part):
   #
   # FTDI cable header
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   #    Sullins GEC36SBSN-M89	
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 1: GND
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
      self.shape = translate(pad_header,0,.25,0)
      self.shape = add(self.shape,cylinder(-.05,.25,0,0,.025))
      self.pad.append(point(0,.25,0))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
      # pin 2: CTS (brown)
      #
      self.shape = add(self.shape,translate(pad_header,0,.15,0))
      self.pad.append(point(0,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CTS'))
      #
      # pin 3: VCC (red)
      #
      self.shape = add(self.shape,translate(pad_header,0,.05,0))
      self.pad.append(point(0,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))
      #
      # pin 4: Tx (orange)
      #
      self.shape = add(self.shape,translate(pad_header,0,-0.05,0))
      self.pad.append(point(0,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Tx'))
      #
      # pin 5: Rx (yellow)
      #
      self.shape = add(self.shape,translate(pad_header,0,-.15,0))
      self.pad.append(point(0,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Rx'))
      #
      # pin 6: RTS (green)
      #
      self.shape = add(self.shape,translate(pad_header,0,-.25,0))
      self.pad.append(point(0,-.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RTS'))

class HCSR04(part):
   #
   # HC-SR04 sonar header
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: GND
      #
      self.shape = translate(pad_header,0,.15,0)
      self.shape = add(self.shape,cylinder(-.05,.15,0,0,.025))
      self.pad.append(point(0,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 2: echo
      #
      self.shape = add(self.shape,translate(pad_header,0,.05,0))
      self.pad.append(point(0,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'echo'))
      #
      # pin 3: trig
      #
      self.shape = add(self.shape,translate(pad_header,0,-.05,0))
      self.pad.append(point(0,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'trig'))
      #
      # pin 4: Vcc
      #
      self.shape = add(self.shape,translate(pad_header,0,-0.15,0))
      self.pad.append(point(0,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Vcc'))

class HCSR501(part):
   #
   # HC-SR501 motion detector header
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: Vcc
      #
      self.shape = translate(pad_header,0,.1,0)
      self.shape = add(self.shape,cylinder(-.05,.1,0,0,.025))
      self.pad.append(point(0,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Vcc'))
      #
      # pin 2: out
      #
      self.shape = add(self.shape,translate(pad_header,0,0,0))
      self.pad.append(point(0,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'out'))
      #
      # pin 3: GND
      #
      self.shape = add(self.shape,translate(pad_header,0,-.1,0))
      self.pad.append(point(0,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
pad_RN4871_left = cube(-0.5/25.4,1/25.4,-0.7/2/25.4,0.7/2/25.4,0,0)
pad_RN4871_right = cube(-1/25.4,0.5/25.4,-0.7/2/25.4,0.7/2/25.4,0,0)
pad_RN4871_bot = cube(-0.7/2/25.4,0.7/2/25.4,-0.5/25.4,1/25.4,0,0)

class RN4871(part):
   #
   # RN4871
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      width = 9/25.4
      height = 7.5/25.4
      bottom = 1.9/25.4
      left = 1.5/25.4
      pitch = 1.2/25.4
      size = .004
      #
      # pin 1:
      #
      self.shape = translate(pad_RN4871_left,-width/2.0,-height+bottom+4*pitch,0)
      self.pad.append(point(-width/2.0,-height+bottom+4*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'BT_RF',line=size))
      #
      # pin 2: 
      #
      self.shape = add(self.shape,translate(pad_RN4871_left,-width/2.0,-height+bottom+3*pitch,0))
      self.pad.append(point(-width/2.0,-height+bottom+3*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=size))
      #
      # pin 3: 
      #
      self.shape = add(self.shape,translate(pad_RN4871_left,-width/2.0,-height+bottom+2*pitch,0))
      self.pad.append(point(-width/2.0,-height+bottom+2*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'P1_2',line=size))
      #
      # pin 4: 
      #
      self.shape = add(self.shape,translate(pad_RN4871_left,-width/2.0,-height+bottom+1*pitch,0))
      self.pad.append(point(-width/2.0,-height+bottom+1*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'P1_3',line=size))
      #
      # pin 5: 
      #
      self.shape = add(self.shape,translate(pad_RN4871_left,-width/2.0,-height+bottom+0*pitch,0))
      self.pad.append(point(-width/2.0,-height+bottom+0*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'P1_7',line=size))
      #
      # pin 6: 
      #
      self.shape = add(self.shape,translate(pad_RN4871_bot,-width/2.0+left+0*pitch,-height,0))
      self.pad.append(point(-width/2.0+left+0*pitch,-height,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'P1_6',line=size,angle=90))
      #
      # pin 7: 
      #
      self.shape = add(self.shape,translate(pad_RN4871_bot,-width/2.0+left+1*pitch,-height,0))
      self.pad.append(point(-width/2.0+left+1*pitch,-height,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RX',line=size,angle=90))
      #
      # pin 8: 
      #
      self.shape = add(self.shape,translate(pad_RN4871_bot,-width/2.0+left+2*pitch,-height,0))
      self.pad.append(point(-width/2.0+left+2*pitch,-height,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'TX',line=size,angle=90))
      #
      # pin 9: 
      #
      self.shape = add(self.shape,translate(pad_RN4871_bot,-width/2.0+left+3*pitch,-height,0))
      self.pad.append(point(-width/2.0+left+3*pitch,-height,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'P3_6',line=size,angle=90))
      #
      # pin 10: 
      #
      self.shape = add(self.shape,translate(pad_RN4871_bot,-width/2.0+left+4*pitch,-height,0))
      self.pad.append(point(-width/2.0+left+4*pitch,-height,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST_N',line=size,angle=90))
      #
      # pin 11: 
      #
      self.shape = add(self.shape,translate(pad_RN4871_bot,-width/2.0+left+5*pitch,-height,0))
      self.pad.append(point(-width/2.0+left+5*pitch,-height,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'P0_0',line=size,angle=90))
      #
      # pin 12:
      #
      self.shape = add(self.shape,translate(pad_RN4871_right,width/2.0,-height+bottom+0*pitch,0))
      self.pad.append(point(width/2.0,-height+bottom+0*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'P0_2',line=size))
      #
      # pin 13:
      #
      self.shape = add(self.shape,translate(pad_RN4871_right,width/2.0,-height+bottom+1*pitch,0))
      self.pad.append(point(width/2.0,-height+bottom+1*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=size))
      #
      # pin 14:
      #
      self.shape = add(self.shape,translate(pad_RN4871_right,width/2.0,-height+bottom+2*pitch,0))
      self.pad.append(point(width/2.0,-height+bottom+2*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VBAT',line=size))
      #
      # pin 15:
      #
      self.shape = add(self.shape,translate(pad_RN4871_right,width/2.0,-height+bottom+3*pitch,0))
      self.pad.append(point(width/2.0,-height+bottom+3*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'P2_7',line=size))
      #
      # pin 16:
      #
      self.shape = add(self.shape,translate(pad_RN4871_right,width/2.0,-height+bottom+4*pitch,0))
      self.pad.append(point(width/2.0,-height+bottom+4*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'P2_0',line=size))

pad_HM11 = cube(-.047,.047,-.0177,.0177,0,0)

class HM11(part):
   #
   # HM-11
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      height = 18.5/25.4 
      width = 13.5/25.4
      pitch = 1.5/25.4
      bottom = 1/25.4
      offset = 0
      size = .004
      #
      # pin 1:
      #
      self.shape = translate(pad_HM11,-width/2.0+offset,-height/2.0+bottom+7*pitch,0)
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+7*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RTS',line=size))
      #
      # pin 2: 
      #
      self.shape = add(self.shape,translate(pad_HM11,-width/2.0+offset,-height/2.0+bottom+6*pitch,0))
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+6*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'TX',line=size))
      #
      # pin 3: 
      #
      self.shape = add(self.shape,translate(pad_HM11,-width/2.0+offset,-height/2.0+bottom+5*pitch,0))
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+5*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CTS',line=size))
      #
      # pin 4: 
      #
      self.shape = add(self.shape,translate(pad_HM11,-width/2.0+offset,-height/2.0+bottom+4*pitch,0))
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+4*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RX',line=size))
      #
      # pin 5: 
      #
      self.shape = add(self.shape,translate(pad_HM11,-width/2.0+offset,-height/2.0+bottom+3*pitch,0))
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+3*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'NC',line=size))
      #
      # pin 6: 
      #
      self.shape = add(self.shape,translate(pad_HM11,-width/2.0+offset,-height/2.0+bottom+2*pitch,0))
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+2*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'NC',line=size))
      #
      # pin 7: 
      #
      self.shape = add(self.shape,translate(pad_HM11,-width/2.0+offset,-height/2.0+bottom+1*pitch,0))
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+1*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'NC',line=size))
      #
      # pin 8:
      #
      self.shape = add(self.shape,translate(pad_HM11,-width/2.0+offset,-height/2.0+bottom+0*pitch,0))
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+0*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'NC',line=size))
      #
      # pin 9:
      #
      self.shape = add(self.shape,translate(pad_HM11,width/2.0-offset,-height/2.0+bottom+0*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+0*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC',line=size))
      #
      # pin 10:
      #
      self.shape = add(self.shape,translate(pad_HM11,width/2.0-offset,-height/2.0+bottom+1*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+1*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'NC',line=size))
      #
      # pin 11:
      #
      self.shape = add(self.shape,translate(pad_HM11,width/2.0-offset,-height/2.0+bottom+2*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+2*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST',line=size))
      #
      # pin 12:
      #
      self.shape = add(self.shape,translate(pad_HM11,width/2.0-offset,-height/2.0+bottom+3*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+3*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=size))
      #
      # pin 13:
      #
      self.shape = add(self.shape,translate(pad_HM11,width/2.0-offset,-height/2.0+bottom+4*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+4*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO3',line=size))
      #
      # pin 14:
      #
      self.shape = add(self.shape,translate(pad_HM11,width/2.0-offset,-height/2.0+bottom+5*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+5*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO2',line=size))
      #
      # pin 15:
      #
      self.shape = add(self.shape,translate(pad_HM11,width/2.0-offset,-height/2.0+bottom+6*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+6*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO1',line=size))
      #
      # pin 16:
      #
      self.shape = add(self.shape,translate(pad_HM11,width/2.0-offset,-height/2.0+bottom+7*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+7*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO0',line=size))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class ESP32_WROOM(part):
   #
   # ESP32-WROOM
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      pad = cube(-1/25.4,1/25.4,-.4/25.4,.4/25.4,0,0)
      padb = cube(-.4/25.4,.4/25.4,-1/25.4,1/25.4,0,0)
      width = 17/25.4
      height = 25.5/25.4
      pitch = 1.27/25.4
      #
      # pin 1
      #
      self.shape = translate(pad,-width/2,6*pitch,0)
      self.pad.append(point(-width/2,6*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad,-width/2,5*pitch,0))
      self.pad.append(point(-width/2,5*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'3V3'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad,-width/2,4*pitch,0))
      self.pad.append(point(-width/2,4*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'EN'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad,-width/2,3*pitch,0))
      self.pad.append(point(-width/2,3*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VP'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad,-width/2,2*pitch,0))
      self.pad.append(point(-width/2,2*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VN'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad,-width/2,1*pitch,0))
      self.pad.append(point(-width/2,1*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO34'))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad,-width/2,0*pitch,0))
      self.pad.append(point(-width/2,0*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO35'))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad,-width/2,-1*pitch,0))
      self.pad.append(point(-width/2,-1*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO32'))
      #
      # pin 9
      #
      self.shape = add(self.shape,translate(pad,-width/2,-2*pitch,0))
      self.pad.append(point(-width/2,-2*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO33'))
      #
      # pin 10
      #
      self.shape = add(self.shape,translate(pad,-width/2,-3*pitch,0))
      self.pad.append(point(-width/2,-3*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO25'))
      #
      # pin 11
      #
      self.shape = add(self.shape,translate(pad,-width/2,-4*pitch,0))
      self.pad.append(point(-width/2,-4*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO26'))
      #
      # pin 12
      #
      self.shape = add(self.shape,translate(pad,-width/2,-5*pitch,0))
      self.pad.append(point(-width/2,-5*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO27'))
      #
      # pin 13
      #
      self.shape = add(self.shape,translate(pad,-width/2,-6*pitch,0))
      self.pad.append(point(-width/2,-6*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO14'))
      #
      # pin 14
      #
      self.shape = add(self.shape,translate(pad,-width/2,-7*pitch,0))
      self.pad.append(point(-width/2,-7*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO12'))
      #
      # pin 15
      #
      self.shape = add(self.shape,translate(padb,-4.5*pitch,-7*pitch-1/25.4,0))
      self.pad.append(point(-4.5*pitch,-7*pitch-1/25.4,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',angle=90))
      #
      # pin 16
      #
      self.shape = add(self.shape,translate(padb,-3.5*pitch,-7*pitch-1/25.4,0))
      self.pad.append(point(-3.5*pitch,-7*pitch-1/25.4,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO13',angle=90))
      #
      # pin 17
      #
      self.shape = add(self.shape,translate(padb,-2.5*pitch,-7*pitch-1/25.4,0))
      self.pad.append(point(-2.5*pitch,-7*pitch-1/25.4,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SHD',angle=90))
      #
      # pin 18
      #
      self.shape = add(self.shape,translate(padb,-1.5*pitch,-7*pitch-1/25.4,0))
      self.pad.append(point(-1.5*pitch,-7*pitch-1/25.4,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SWP',angle=90))
      #
      # pin 19
      #
      self.shape = add(self.shape,translate(padb,-0.5*pitch,-7*pitch-1/25.4,0))
      self.pad.append(point(-0.5*pitch,-7*pitch-1/25.4,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCS',angle=90))
      #
      # pin 20
      #
      self.shape = add(self.shape,translate(padb,0.5*pitch,-7*pitch-1/25.4,0))
      self.pad.append(point(0.5*pitch,-7*pitch-1/25.4,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCK',angle=90))
      #
      # pin 21
      #
      self.shape = add(self.shape,translate(padb,1.5*pitch,-7*pitch-1/25.4,0))
      self.pad.append(point(1.5*pitch,-7*pitch-1/25.4,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDO',angle=90))
      #
      # pin 22
      #
      self.shape = add(self.shape,translate(padb,2.5*pitch,-7*pitch-1/25.4,0))
      self.pad.append(point(2.5*pitch,-7*pitch-1/25.4,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDI',angle=90))
      #
      # pin 23
      #
      self.shape = add(self.shape,translate(padb,3.5*pitch,-7*pitch-1/25.4,0))
      self.pad.append(point(3.5*pitch,-7*pitch-1/25.4,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO15',angle=90))
      #
      # pin 24
      #
      self.shape = add(self.shape,translate(padb,4.5*pitch,-7*pitch-1/25.4,0))
      self.pad.append(point(4.5*pitch,-7*pitch-1/25.4,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO2',angle=90))
      #
      # pin 25
      #
      self.shape = add(self.shape,translate(pad,width/2,-7*pitch,0))
      self.pad.append(point(width/2,-7*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO0'))
      #
      # pin 26
      #
      self.shape = add(self.shape,translate(pad,width/2,-6*pitch,0))
      self.pad.append(point(width/2,-6*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO4'))
      #
      # pin 27
      #
      self.shape = add(self.shape,translate(pad,width/2,-5*pitch,0))
      self.pad.append(point(width/2,-5*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO16'))
      #
      # pin 28
      #
      self.shape = add(self.shape,translate(pad,width/2,-4*pitch,0))
      self.pad.append(point(width/2,-4*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO17'))
      #
      # pin 29
      #
      self.shape = add(self.shape,translate(pad,width/2,-3*pitch,0))
      self.pad.append(point(width/2,-3*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO5'))
      #
      # pin 30
      #
      self.shape = add(self.shape,translate(pad,width/2,-2*pitch,0))
      self.pad.append(point(width/2,-2*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO18'))
      #
      # pin 31
      #
      self.shape = add(self.shape,translate(pad,width/2,-1*pitch,0))
      self.pad.append(point(width/2,-1*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO19'))
      #
      # pin 32
      #
      self.shape = add(self.shape,translate(pad,width/2,0*pitch,0))
      self.pad.append(point(width/2,0*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'NC'))
      #
      # pin 33
      #
      self.shape = add(self.shape,translate(pad,width/2,1*pitch,0))
      self.pad.append(point(width/2,1*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO21'))
      #
      # pin 34
      #
      self.shape = add(self.shape,translate(pad,width/2,2*pitch,0))
      self.pad.append(point(width/2,2*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RX0'))
      #
      # pin 35
      #
      self.shape = add(self.shape,translate(pad,width/2,3*pitch,0))
      self.pad.append(point(width/2,3*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'TX0'))
      #
      # pin 36
      #
      self.shape = add(self.shape,translate(pad,width/2,4*pitch,0))
      self.pad.append(point(width/2,4*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO22'))
      #
      # pin 37
      #
      self.shape = add(self.shape,translate(pad,width/2,5*pitch,0))
      self.pad.append(point(width/2,5*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO23'))
      #
      # pin 38
      #
      self.shape = add(self.shape,translate(pad,width/2,6*pitch,0))
      self.pad.append(point(width/2,6*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class ESP32_CAM(part):
   #
   # ESP32-CAM
   # Sullins S5635-ND
   #
   def __init__(self,value=''):
      pad_header = cube(-.079/2,.079/2,-.039/2,.039/2,0,0)
      d = .209/2-.079/2
      w = 0.9
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_header,+d-w/2,.35,0)
      self.pad.append(point(+d-w/2,.35,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'+5V'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_header,-d-w/2,.25,0))
      self.pad.append(point(-d-w/2,.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_header,+d-w/2,.15,0))
      self.pad.append(point(+d-w/2,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO12'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_header,-d-w/2,.05,0))
      self.pad.append(point(-d-w/2,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO13'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_header,+d-w/2,-.05,0))
      self.pad.append(point(+d-w/2,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO15'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad_header,-d-w/2,-.15,0))
      self.pad.append(point(-d-w/2,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO14'))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad_header,+d-w/2,-.25,0))
      self.pad.append(point(+d-w/2,-.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO2'))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad_header,-d-w/2,-.35,0))
      self.pad.append(point(-d-w/2,-.35,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO4'))
      #
      # pin 9
      #
      self.shape = add(self.shape,translate(pad_header,-d+w/2,-.35,0))
      self.pad.append(point(-d+w/2,-.35,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 10
      #
      self.shape = add(self.shape,translate(pad_header,+d+w/2,-.25,0))
      self.pad.append(point(+d+w/2,-.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'U0T'))
      #
      # pin 11
      #
      self.shape = add(self.shape,translate(pad_header,-d+w/2,-.15,0))
      self.pad.append(point(-d+w/2,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'U0R'))
      #
      # pin 12
      #
      self.shape = add(self.shape,translate(pad_header,+d+w/2,-.05,0))
      self.pad.append(point(+d+w/2,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))
      #
      # pin 13
      #
      self.shape = add(self.shape,translate(pad_header,-d+w/2,.05,0))
      self.pad.append(point(-d+w/2,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 14
      #
      self.shape = add(self.shape,translate(pad_header,+d+w/2,.15,0))
      self.pad.append(point(+d+w/2,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO0'))
      #
      # pin 15
      #
      self.shape = add(self.shape,translate(pad_header,-d+w/2,.25,0))
      self.pad.append(point(-d+w/2,.25,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO16'))
      #
      # pin 16
      #
      self.shape = add(self.shape,translate(pad_header,+d+w/2,.35,0))
      self.pad.append(point(+d+w/2,.35,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'3V3'))


Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
class ESP8266_12E(part):
   #
   # ESP8266 12E
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      height = 24/25.4 
      width = 16/25.4
      pitch = 2/25.4
      bottom = 1.8/25.4
      left = 3/25.4
      offset = .4/25.4 - .01
      size = .004
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      pad_ESP8266 = cube(-.0493,.0493,-.0197,.0197,0,0)
      pad_ESP8266_bot = cube(-.0197,.0197,-.0415,.0415,0,0)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200
      #
      # pin 1:
      #
      self.shape = translate(pad_ESP8266,-width/2.0+offset,-height/2.0+bottom+7*pitch,0)
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+7*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST',line=size))
      #
      # pin 2: 
      #
      self.shape = add(self.shape,translate(pad_ESP8266,-width/2.0+offset,-height/2.0+bottom+6*pitch,0))
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+6*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'ADC',line=size))
      #
      # pin 3: 
      #
      self.shape = add(self.shape,translate(pad_ESP8266,-width/2.0+offset,-height/2.0+bottom+5*pitch,0))
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+5*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'EN',line=size))
      #
      # pin 4: 
      #
      self.shape = add(self.shape,translate(pad_ESP8266,-width/2.0+offset,-height/2.0+bottom+4*pitch,0))
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+4*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GPIO16',line=size))
      #
      # pin 5: 
      #
      self.shape = add(self.shape,translate(pad_ESP8266,-width/2.0+offset,-height/2.0+bottom+3*pitch,0))
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+3*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GPIO14',line=size))
      #
      # pin 6: 
      #
      self.shape = add(self.shape,translate(pad_ESP8266,-width/2.0+offset,-height/2.0+bottom+2*pitch,0))
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+2*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GPIO12',line=size))
      #
      # pin 7: 
      #
      self.shape = add(self.shape,translate(pad_ESP8266,-width/2.0+offset,-height/2.0+bottom+1*pitch,0))
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+1*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GPIO13',line=size))
      #
      # pin 8: 
      #
      self.shape = add(self.shape,translate(pad_ESP8266,-width/2.0+offset,-height/2.0+bottom+0*pitch,0))
      self.pad.append(point(-width/2.0+offset,-height/2.0+bottom+0*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VDD',line=size))
      #
      # pin 9: 
      #
      self.shape = add(self.shape,translate(pad_ESP8266_bot,-width/2.0+left+0*pitch,-height/2.0+offset,0))
      self.pad.append(point(-width/2.0+left+0*pitch,-height/2.0+offset,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CS',line=size,angle=90))
      #
      # pin 10: 
      #
      self.shape = add(self.shape,translate(pad_ESP8266_bot,-width/2.0+left+1*pitch,-height/2.0+offset,0))
      self.pad.append(point(-width/2.0+left+1*pitch,-height/2.0+offset,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'MISO',line=size,angle=90))
      #
      # pin 11: 
      #
      self.shape = add(self.shape,translate(pad_ESP8266_bot,-width/2.0+left+2*pitch,-height/2.0+offset,0))
      self.pad.append(point(-width/2.0+left+2*pitch,-height/2.0+offset,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GPIO9',line=size,angle=90))
      #
      # pin 12: 
      #
      self.shape = add(self.shape,translate(pad_ESP8266_bot,-width/2.0+left+3*pitch,-height/2.0+offset,0))
      self.pad.append(point(-width/2.0+left+3*pitch,-height/2.0+offset,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GPIO10',line=size,angle=90))
      #
      # pin 13: 
      #
      self.shape = add(self.shape,translate(pad_ESP8266_bot,-width/2.0+left+4*pitch,-height/2.0+offset,0))
      self.pad.append(point(-width/2.0+left+4*pitch,-height/2.0+offset,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'MOSI',line=size,angle=90))
      #
      # pin 14: 
      #
      self.shape = add(self.shape,translate(pad_ESP8266_bot,-width/2.0+left+5*pitch,-height/2.0+offset,0))
      self.pad.append(point(-width/2.0+left+5*pitch,-height/2.0+offset,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCLK',line=size,angle=90))
      #
      # pin 15:
      #
      self.shape = add(self.shape,translate(pad_ESP8266,width/2.0-offset,-height/2.0+bottom+0*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+0*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=size))
      #
      # pin 16:
      #
      self.shape = add(self.shape,translate(pad_ESP8266,width/2.0-offset,-height/2.0+bottom+1*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+1*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GPIO15',line=size))
      #
      # pin 17:
      #
      self.shape = add(self.shape,translate(pad_ESP8266,width/2.0-offset,-height/2.0+bottom+2*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+2*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GPIO2',line=size))
      #
      # pin 18:
      #
      self.shape = add(self.shape,translate(pad_ESP8266,width/2.0-offset,-height/2.0+bottom+3*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+3*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GPIO0',line=size))
      #
      # pin 19:
      #
      self.shape = add(self.shape,translate(pad_ESP8266,width/2.0-offset,-height/2.0+bottom+4*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+4*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GPIO4',line=size))
      #
      # pin 20:
      #
      self.shape = add(self.shape,translate(pad_ESP8266,width/2.0-offset,-height/2.0+bottom+5*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+5*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GPIO5',line=size))
      #
      # pin 21:
      #
      self.shape = add(self.shape,translate(pad_ESP8266,width/2.0-offset,-height/2.0+bottom+6*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+6*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RXD',line=size))
      #
      # pin 22:
      #
      self.shape = add(self.shape,translate(pad_ESP8266,width/2.0-offset,-height/2.0+bottom+7*pitch,0))
      self.pad.append(point(width/2.0-offset,-height/2.0+bottom+7*pitch,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'TXD',line=size))

pad_MTA = cube(-.021,.021,-.041,.041,0,0)
pad_MTA_solder = cube(-.071,.071,-.041,.041,0,0)

class MTA_2(part):
   #
   # AMP 1445121-2
   # MTA .050 SMT 2-pin vertical
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_MTA,-.025,-.1,0)
      self.pad.append(point(-.025,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_MTA,.025,.1,0))
      self.pad.append(point(.025,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'2'))
      #
      # solder pads
      #
      self.shape = add(self.shape,translate(pad_MTA_solder,-.187,0,0))
      self.shape = add(self.shape,translate(pad_MTA_solder,.187,0,0))

class MTA_power(part):
   #
   # AMP 1445121-2
   # MTA .050 SMT 2-pin vertical
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: Gnd
      #
      self.shape = translate(pad_MTA,-.025,-.1,0)
      self.pad.append(point(-.025,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1\nGND'))
      #
      # pin 2: Vcc
      #
      self.shape = add(self.shape,translate(pad_MTA,.025,.1,0))
      self.pad.append(point(.025,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Vcc'))
      #
      # solder pads
      #
      self.shape = add(self.shape,translate(pad_MTA_solder,-.187,0,0))
      self.shape = add(self.shape,translate(pad_MTA_solder,.187,0,0))

class MTA_3(part):
   #
   # AMP 1445121-3
   # MTA .050 SMT 3-pin vertical
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: GND
      #
      self.shape = translate(pad_MTA,.05,.1,0)
      self.pad.append(point(.05,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1'))
      #
      # pin 2: power 
      #
      self.shape = add(self.shape,translate(pad_MTA,-.05,.1,0))
      self.pad.append(point(-.05,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'2'))
      #
      # pin 3: data
      #
      self.shape = add(self.shape,translate(pad_MTA,0,-.1,0))
      self.pad.append(point(0,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'3'))
      #
      # solder pads
      #
      self.shape = add(self.shape,translate(pad_MTA_solder,-.212,0,0))
      self.shape = add(self.shape,translate(pad_MTA_solder,.212,0,0))

class MTA_i0(part):
   #
   # AMP 1445121-3
   # MTA .050 SMT 3-pin vertical
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: GND
      #
      self.shape = translate(pad_MTA,.05,.1,0)
      self.pad.append(point(.05,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1\nGND'))
      #
      # pin 2: power 
      #
      self.shape = add(self.shape,translate(pad_MTA,-.05,.1,0))
      self.pad.append(point(-.05,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V'))
      #
      # pin 3: data
      #
      self.shape = add(self.shape,translate(pad_MTA,0,-.1,0))
      self.pad.append(point(0,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'data'))
      #
      # solder pads
      #
      self.shape = add(self.shape,translate(pad_MTA_solder,-.212,0,0))
      self.shape = add(self.shape,translate(pad_MTA_solder,.212,0,0))

class MTA_4(part):
   #
   # AMP 1445121-4
   # MTA .050 SMT 4-pin vertical
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_MTA,-.075,-.1,0)
      self.pad.append(point(-.075,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_MTA,.025,-.1,0))
      self.pad.append(point(.025,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'2'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_MTA,.075,.1,0))
      self.pad.append(point(.075,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'3'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_MTA,-.025,.1,0))
      self.pad.append(point(-.025,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'4'))
      #
      # solder pads
      #
      self.shape = add(self.shape,translate(pad_MTA_solder,-.237,0,0))
      self.shape = add(self.shape,translate(pad_MTA_solder,.237,0,0))

class MTA_serial(part):
   #
   # AMP 1445121-4
   # MTA .050 SMT 4-pin vertical
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: Gnd
      #
      self.shape = translate(pad_MTA,-.075,-.1,0)
      self.pad.append(point(-.075,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1'))
      #
      # pin 2: Tx
      #
      self.shape = add(self.shape,translate(pad_MTA,.025,-.1,0))
      self.pad.append(point(.025,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Tx'))
      #
      # pin 3: Rx
      #
      self.shape = add(self.shape,translate(pad_MTA,.075,.1,0))
      self.pad.append(point(.075,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Rx'))
      #
      # pin 4: DTR
      #
      self.shape = add(self.shape,translate(pad_MTA,-.025,.1,0))
      self.pad.append(point(-.025,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DTR'))
      #
      # solder pads
      #
      self.shape = add(self.shape,translate(pad_MTA_solder,-.237,0,0))
      self.shape = add(self.shape,translate(pad_MTA_solder,.237,0,0))

class MTA_PS2(part):
   #
   # AMP 1445121-4
   # MTA .050 SMT 4-pin vertical
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: GND
      #
      self.shape = translate(pad_MTA,-.075,-.1,0)
      self.pad.append(point(-.075,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1\nGND'))
      #
      # pin 2: data
      #
      self.shape = add(self.shape,translate(pad_MTA,.025,-.1,0))
      self.pad.append(point(.025,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'data'))
      #
      # pin 3: clock
      #
      self.shape = add(self.shape,translate(pad_MTA,.075,.1,0))
      self.pad.append(point(.075,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'clock'))
      #
      # pin 4: 5V
      #
      self.shape = add(self.shape,translate(pad_MTA,-.025,.1,0))
      self.pad.append(point(-.025,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'5V'))
      #
      # solder pads
      #
      self.shape = add(self.shape,translate(pad_MTA_solder,-.237,0,0))
      self.shape = add(self.shape,translate(pad_MTA_solder,.237,0,0))

class MTA_5(part):
   #
   # AMP 1445121-5
   # MTA .050 SMT 5-pin vertical
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_MTA,-.1,-.1,0)
      self.pad.append(point(-.1,-.1,0))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_MTA,0,-.1,0))
      self.pad.append(point(0,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'2'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_MTA,.1,-.1,0))
      self.pad.append(point(.1,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'3'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_MTA,.05,.1,0))
      self.pad.append(point(.05,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'4'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_MTA,-.05,.1,0))
      self.pad.append(point(-.05,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'5'))
      #
      # solder pads
      #
      self.shape = add(self.shape,translate(pad_MTA_solder,-.262,0,0))
      self.shape = add(self.shape,translate(pad_MTA_solder,.262,0,0))

class MTA_ICP(part):
   #
   # AMP 1445121-5
   # MTA .050 SMT 5-pin vertical
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: MISO
      #
      self.shape = translate(pad_MTA,-.1,-.1,0)
      self.pad.append(point(-.1,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'MISO'))
      #
      # pin 2: GND
      #
      self.shape = add(self.shape,translate(pad_MTA,0,-.1,0))
      self.pad.append(point(0,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 3: MOSI
      #
      self.shape = add(self.shape,translate(pad_MTA,.1,-.1,0))
      self.pad.append(point(.1,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'MOSI'))
      #
      # pin 4: -RESET
      #
      self.shape = add(self.shape,translate(pad_MTA,.05,.1,0))
      self.pad.append(point(.05,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'-RESET'))
      #
      # pin 5: SCK
      #
      self.shape = add(self.shape,translate(pad_MTA,-.05,.1,0))
      self.pad.append(point(-.05,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCK'))
      #
      # solder pads
      #
      self.shape = add(self.shape,translate(pad_MTA_solder,-.262,0,0))
      self.shape = add(self.shape,translate(pad_MTA_solder,.262,0,0))

pad_screw_terminal = cylinder(0,0,0,0,.047)
hole_screw_terminal = circle(0,0,.025)

class screw_terminal_2(part):
   #
   # On Shore ED555/2DS
   # two position screw terminal
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_screw_terminal,-.069,0,0)
      self.pad.append(point(-.069,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_screw_terminal,.069,0,0))
      self.pad.append(point(.069,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'2'))
      #
      # holes
      #
      self.shape = add(self.shape,translate(hole_screw_terminal,-.069,0,0))
      self.shape = add(self.shape,translate(hole_screw_terminal,.069,0,0))

class screw_terminal_power(part):
   #
   # On Shore ED555/2DS
   # power screw terminal
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_screw_terminal,-.069,0,0)
      self.pad.append(point(-.069,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_screw_terminal,.069,0,0))
      self.pad.append(point(.069,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V'))
      #
      # holes
      #
      self.shape = add(self.shape,translate(hole_screw_terminal,-.069,0,0))
      self.shape = add(self.shape,translate(hole_screw_terminal,.069,0,0))

class screw_terminal_i0(part):
   #
   # On Shore ED555/3DS
   # i0 screw terminal
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: Gnd
      #
      self.shape = translate(pad_screw_terminal,-.138,0,0)
      self.pad.append(point(-.138,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Gnd\n1'))
      #
      # pin 2: data
      #
      self.shape = add(self.shape,pad_screw_terminal)
      self.pad.append(point(0,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'data'))
      #
      # pin 3: V
      #
      self.shape = add(self.shape,translate(pad_screw_terminal,.138,0,0))
      self.pad.append(point(.138,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V'))
      #
      # holes
      #
      self.shape = add(self.shape,translate(hole_screw_terminal,-.138,0,0))
      self.shape = add(self.shape,hole_screw_terminal)
      self.shape = add(self.shape,translate(hole_screw_terminal,.138,0,0))

class power_65mm(part):
   #
   # CUI PJ1-023-SMT
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: power
      #
      self.shape = cube(.433,.512,-.047,.047,0,0)
      self.pad.append(point(.467,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'P'))
      #
      # pin 2: ground
      #
      self.shape = add(self.shape,cube(.285,.423,-.189,-.098,0,0))
      self.pad.append(point(.354,-.144,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G'))
      #
      # pin 3: contact
      #
      self.shape = add(self.shape,cube(.325,.463,.098,.189,0,0))
      self.pad.append(point(.394,.144,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'C'))
      #
      # solder pads
      #
      self.shape = add(self.shape,cube(.108,.246,-.169,-.110,0,0))
      self.shape = add(self.shape,cube(.069,.207,.110,.169,0,0))

pad_stereo_2_5mm = cube(-.03,.03,-.05,.05,0,0)

class stereo_2_5mm(part):
   #
   # CUI SJ1-2533-SMT
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: base
      #
      self.shape = translate(pad_stereo_2_5mm,-.130,-.16,0)
      self.pad.append(point(-.130,-.149,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'base'))
      #
      # pin 2: tip
      #
      self.shape = add(self.shape,translate(pad_stereo_2_5mm,.197,.15,0))
      self.pad.append(point(.197,.141,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'tip'))
      #
      # pin 3: middle
      #
      self.shape = add(self.shape,translate(pad_stereo_2_5mm,-.012,-.16,0))
      self.pad.append(point(-.012,-.149,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'middle'))

pad_Molex = cube(-.0155,.0155,-.0265,.0265,0,0)
pad_Molex_solder = cube(-.055,.055,-.065,.065,0,0)

class Molex_serial(part):
   #
   # Molex 53261-0471
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: Rx
      #
      self.shape = translate(pad_Molex,-.075,.064,0)
      self.pad.append(point(-.075,.064,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Rx'))
      #
      # pin 2: Tx
      #
      self.shape = add(self.shape,translate(pad_Molex,-.025,.064,0))
      self.pad.append(point(-.025,.064,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Tx'))
      #
      # pin 3: DTR
      #
      self.shape = add(self.shape,translate(pad_Molex,.025,.064,0))
      self.pad.append(point(.025,.064,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DTR'))
      #
      # pin 4: GND
      #
      self.shape = add(self.shape,translate(pad_Molex,.075,.064,0))
      self.pad.append(point(.075,.064,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # solder pads
      #
      self.shape = add(self.shape,translate(pad_Molex_solder,-.16,-.065,0))
      self.shape = add(self.shape,translate(pad_Molex_solder,.16,-.065,0))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# switches
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class slide_switch(part):
   # 
   # slide switch
   # C&K AYZ0102AGRLC
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      pad = cube(-.039/2,.039/2,-.047/2,.047/2,0,0)
      #
      # pad 1
      #
      self.shape = translate(pad,-.098,.1,0)
      self.pad.append(point(-.098,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))
      #
      # pad 2
      #
      self.shape = add(self.shape,translate(pad,0,.1,0))
      self.pad.append(point(0,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))
      #
      # pad 3
      #
      self.shape = add(self.shape,translate(pad,.098,.1,0))
      self.pad.append(point(.098,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,''))
      #
      # holes
      #
      self.holes = cylinder(-.118/2,0,zb,zt,.034/2)
      self.holes = add(self.holes,cylinder(.118/2,0,zb,zt,.034/2))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

class button_6mm(part):
   # 
   # Omron 6mm pushbutton
   # B3SN-3112P
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      pad_button_6mm = cube(-.04,.04,-.03,.03,0,0)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
      # left 1
      #
      self.shape = translate(pad_button_6mm,-.125,.08,0)
      self.pad.append(point(-.125,.08,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'L1'))
      #
      # right 1
      #
      self.shape = add(self.shape,translate(pad_button_6mm,-.125,-.08,0))
      self.pad.append(point(-.125,-.08,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'R1'))
      #
      # right 2
      #
      self.shape = add(self.shape,translate(pad_button_6mm,.125,-.08,0))
      self.pad.append(point(.125,-.08,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'R2'))
      #
      # left 2
      #
      self.shape = add(self.shape,translate(pad_button_6mm,.125,.08,0))
      self.pad.append(point(.125,.08,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'L2'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# crystals and resonators
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

pad_XTAL_EFOBM = cube(-.016,.016,-.085,.085,0,0)

class XTAL_EFOBM(part):
   #
   # Panasonic EFOBM series
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # left
      #
      self.shape = translate(pad_XTAL_EFOBM,-.053,0,0)
      self.pad.append(point(-.053,0,0))
      #
      # ground
      #
      self.shape = add(self.shape,translate(pad_XTAL_EFOBM,0,0,0))
      self.pad.append(point(0,0,0))
      #
      # right
      #
      self.shape = add(self.shape,translate(pad_XTAL_EFOBM,.053,0,0))
      self.pad.append(point(.053,0,0))

pad_XTAL_NX5032GA = cube(-.039,.039,-.047,.047,0,0)
.079

class XTAL_NX5032GA(part):
   #
   # NDK NX5032GA
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # left
      #
      self.shape = translate(pad_XTAL_NX5032GA,-.079,0,0)
      self.pad.append(point(-.079,0,0))
      #
      # right
      #
      self.shape = add(self.shape,translate(pad_XTAL_NX5032GA,.079,0,0))
      self.pad.append(point(.079,0,0))

pad_XTAL_CSM_7 = cube(-.108,.108,-.039,.039,0,0)

class XTAL_CSM_7(part):
   #
   # ECS CSM-7 series
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # left
      #
      self.shape = translate(pad_XTAL_CSM_7,-.187,0,0)
      self.pad.append(point(-.187,0,0))
      #
      # right
      #
      self.shape = add(self.shape,translate(pad_XTAL_CSM_7,.187,0,0))
      self.pad.append(point(.187,0,0))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# diodes, transistors, regulators, sensors
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class DRV8428_HTSSOP(part):
   #
   # TI DRV8428PWPR stepper driver
   #    HTSSOP package
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      d = 0.12
      w = 0.029
      h = 0.0053
      p = 0.02559
      pad = cube(-w,w,-h,h,0,0)
      s = 0.003
      #
      # pin 1
      #
      self.shape = translate(pad,-d,3.5*p,0)
      self.shape = add(self.shape,cylinder(-d-w,3.5*p,0,0,h))
      self.pad.append(point(-d,3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'.VM',line=s))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad,-d,2.5*p,0))
      self.pad.append(point(-d,2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PGND',line=s))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad,-d,1.5*p,0))
      self.pad.append(point(-d,1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'AOUT1',line=s))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad,-d,.5*p,0))
      self.pad.append(point(-d,.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'AOUT2',line=s))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad,-d,-.5*p,0))
      self.pad.append(point(-d,-.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'BOUT2',line=s))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad,-d,-1.5*p,0))
      self.pad.append(point(-d,-1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'BOUT1',line=s))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad,-d,-2.5*p,0))
      self.pad.append(point(-d,-2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=s))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad,-d,-3.5*p,0))
      self.pad.append(point(-d,-3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DVDD',line=s))
      #
      # pin 9
      #
      self.shape = add(self.shape,translate(pad,d,-3.5*p,0))
      self.pad.append(point(d,-3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VREF',line=s))
      #
      # pin 10
      #
      self.shape = add(self.shape,translate(pad,d,-2.5*p,0))
      self.pad.append(point(d,-2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'M0',line=s))
      #
      # pin 11
      #
      self.shape = add(self.shape,translate(pad,d,-1.5*p,0))
      self.pad.append(point(d,-1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DECAY',line=s))
      #
      # pin 12
      #
      self.shape = add(self.shape,translate(pad,d,-.5*p,0))
      self.pad.append(point(d,-.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'M1',line=s))
      #
      # pin 13
      #
      self.shape = add(self.shape,translate(pad,d,.5*p,0))
      self.pad.append(point(d,.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'STEP',line=s))
      #
      # pin 14
      #
      self.shape = add(self.shape,translate(pad,d,1.5*p,0))
      self.pad.append(point(d,1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DIR',line=s))
      #
      # pin 15
      #
      self.shape = add(self.shape,translate(pad,d,2.5*p,0))
      self.pad.append(point(d,2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'EN',line=s))
      #
      # pin 16
      #
      self.shape = add(self.shape,translate(pad,d,3.5*p,0))
      self.pad.append(point(d,3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SLEEP',line=s))
      #
      # pin 17
      #
      self.shape = add(self.shape,translate(cube(-.06,.06,-.09,.09,0,0),0,0,0))
      self.pad.append(point(0,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=s))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class LED_3014_1100(part):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   # Luminus MP-3014-1100-50-80
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   #
   def __init__(self,value=''):
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      anode = cube(-.011,.011,-.027,.027,0,0)
      cathode = cube(-.036,.036,-.027,.027,0,0)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # anode
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.shape = translate(anode,-.047,0,0)
      self.pad.append(point(-.047,0,0))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A'))
      #
      # cathode
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.shape = add(self.shape,translate(cathode,.022,0,0))
      self.pad.append(point(.022,0,0))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'C'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class CMM4030D261I2STR(part):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   # CUI CMM-4030D-261-I2S-TR I2S microphone
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   #
   def __init__(self,value=''):
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      pad = cube(-.018,.018,-.011,.011,0,0)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      self.value = value
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.x = 0
      self.y = 0
      self.z = 0
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      self.pad = [point(0,0,0)]
      self.labels = []
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      s = 0.004
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 1
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.shape = translate(pad,.037,-.059,0)
      self.pad.append(point(.037,-.059,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND.',line=s))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 2
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.shape = add(self.shape,translate(pad,.037,-.019,0))
      self.pad.append(point(.037,-.019,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'N/C',line=s))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad,.037,.019,0))
      self.pad.append(point(.037,.019,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'WS',line=s))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad,.037,.059,0))
      self.pad.append(point(.037,.059,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'EN',line=s))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad,-.037,.059,0))
      self.pad.append(point(-.037,.059,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'L/R',line=s))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad,-.037,.019,0))
      self.pad.append(point(-.037,.019,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCK',line=s))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad,-.037,-.019,0))
      self.pad.append(point(-.037,-.019,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SD',line=s))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad,-.037,-.059,0))
      self.pad.append(point(-.037,-.059,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VDD',line=s))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class SPG08P4HM4H(part):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   # Knowles SPG08P4HM4H-1 PDM microphone
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   #
   def __init__(self,value=''):
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      pad = cube(-.011,.011,-.011,.011,0,0)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      self.value = value
      self.x = 0
      self.y = 0
      self.z = 0
      self.pad = [point(0,0,0)]
      self.labels = []
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      s = 0.004
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 1
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.shape = translate(pad,.023,-.037,0)
      self.pad.append(point(.023,-.037,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V.',line=s))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 2
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.shape = add(self.shape,translate(pad,.023,0,0))
      self.pad.append(point(.023,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G',line=s))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 3
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.shape = add(self.shape,translate(pad,.023,.037,0))
      self.pad.append(point(.023,.037,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DAT',line=s))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 4
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.shape = add(self.shape,translate(pad,-.023,.037,0))
      self.pad.append(point(-.023,.037,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CK',line=s))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad,-.023,0,0))
      self.pad.append(point(-.023,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G',line=s))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad,-.023,-.037,0))
      self.pad.append(point(-.023,-.037,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SEL',line=s))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class VEML6040(part):
   #
   # Vishay VEML6040 color sensor 
   #
   def __init__(self,value=''):
      pad12 = cube(-.016,.019,-.006,.006,0,0)
      pad3 = cube(-.023,.016,-.006,.006,0,0)
      pad4 = cube(-.019,.016,-.006,.006,0,0)
      self.value = value
      self.x = 0
      self.y = 0
      self.z = 0
      self.pad = [point(0,0,0)]
      self.labels = []
      s = 0.004
      #
      # pin 1
      #
      self.shape = translate(pad12,-.039,.014,0)
      self.pad.append(point(-.039,.014,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1GND',line=s))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad12,-.039,-.014,0))
      self.pad.append(point(-.039,-.014,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDA',line=s))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad3,.039,-.014,0))
      self.pad.append(point(.039,-.014,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCL',line=s))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad4,.039,.014,0))
      self.pad.append(point(.039,.014,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VDD',line=s))

class D_1206(part):
   #
   # 1206 diode
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # anode
      #
      self.shape = translate(pad_1206,-.06,0,0)
      self.pad.append(point(-.055,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A'))
      #
      # cathode
      #
      self.shape = add(self.shape,translate(pad_1206,.06,0,0))
      self.pad.append(point(.055,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'C'))

class LED_1206(part):
   #
   # 1206 LED
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # anode
      #
      self.shape = translate(pad_1206,-.06,0,0)
      self.pad.append(point(-.055,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A'))
      #
      # cathode
      #
      self.shape = add(self.shape,translate(pad_1206,.06,0,0))
      self.pad.append(point(.055,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'C'))

pad_RGB = cube(-.02,.02,-.029,.029,0,0)

class LED_RGB(part):
   #
   # CREE CLV1A-FKB
   #
   def __init__(self,value=''):
      self.value = value
      self.x = 0
      self.y = 0
      self.z = 0
      self.pad = [point(0,0,0)]
      self.labels = []
      dx = .029
      dy = .059
      #
      # pin 1: red
      #
      self.shape = translate(pad_RGB,-dx,-dy,0)
      self.shape = add(self.shape,cylinder(-dx,-dy-.029,0,0,.02))
      self.pad.append(point(-dx,-dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'R'))
      #
      # pin 2: anode
      #
      self.shape = add(self.shape,translate(pad_RGB,dx,-dy,0))
      self.pad.append(point(dx,-dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A'))
      #
      # pin 3: blue
      #
      self.shape = add(self.shape,translate(pad_RGB,dx,dy,0))
      self.pad.append(point(dx,dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'B'))
      #
      # pin 4: green
      #
      self.shape = add(self.shape,translate(pad_RGB,-dx,dy,0))
      self.pad.append(point(-dx,dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G'))

class phototransistor_1206(part):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   #
   # 1206 phototransistor
   # OPTEK 520,521
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # collector
      #
      self.shape = translate(pad_1206,-.06,0,0)
      self.pad.append(point(-.055,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'C'))
      #
      # emitter
      #
      self.shape = add(self.shape,translate(pad_1206,.06,0,0))
      self.pad.append(point(.055,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'E'))

pad_PLCC2 = cube(-.029,.029,-.059,.059,0,0)

class phototransistor_PLCC2(part):
   #
   # PLCC2 phototransistor
   # Optek OP580
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # collector
      #
      self.shape = translate(pad_PLCC2,-.065,0,0)
      self.pad.append(point(-.065,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'C'))
      #
      # emitter
      #
      self.shape = add(self.shape,translate(pad_PLCC2,.065,0,0))
      self.pad.append(point(.065,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'E'))

pad_SOD_123 = cube(-.02,.02,-.024,.024,0,0)

class D_SOD_123(part):
   #
   # SOD-123 diode
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # anode
      #
      self.shape = translate(pad_SOD_123,-.07,0,0)
      self.pad.append(point(-.07,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A'))
      #
      # cathode
      #
      self.shape = add(self.shape,translate(pad_SOD_123,.07,0,0))
      self.pad.append(point(.07,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'C'))

pad_SOT23 = cube(-.02,.02,-.012,.012,0,0)

class NMOSFET_SOT23(part):
   #
   # Fairchild NDS355AN
   #
   def __init__(self,value=''):
      self.value = value
      self.x = 0
      self.y = 0
      self.z = 0
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: gate
      #
      self.shape = translate(pad_SOT23,.045,-.0375,0)
      self.pad.append(point(.045,-.0375,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G'))
      #
      # pin 2: source
      #
      self.shape = add(self.shape,translate(pad_SOT23,.045,.0375,0))
      self.pad.append(point(.045,.0375,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'S'))
      #
      # pin 3: drain
      #
      self.shape = add(self.shape,translate(pad_SOT23,-.045,0,0))
      self.pad.append(point(-.045,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'D'))

class PMOSFET_SOT23(part):
   #
   # Fairchild NDS356AP
   #
   def __init__(self,value=''):
      self.value = value
      self.x = 0
      self.y = 0
      self.z = 0
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: gate
      #
      self.shape = translate(pad_SOT23,.045,-.0375,0)
      self.pad.append(point(.045,-.0375,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G'))
      #
      # pin 2: source
      #
      self.shape = add(self.shape,translate(pad_SOT23,.045,.0375,0))
      self.pad.append(point(.045,.0375,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'S'))
      #
      # pin 3: drain
      #
      self.shape = add(self.shape,translate(pad_SOT23,-.045,0,0))
      self.pad.append(point(-.045,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'D'))

class NMOSFET_TO252AA(part):
   #
   # Fairchild RFD16N05LSM
   #
   def __init__(self,value=''):
      self.value = value
      self.x = 0
      self.y = 0
      self.z = 0
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: gate
      #
      self.shape = translate(cube(-.031,.031,-.059,.059,0,0),-.090,0,0)
      self.pad.append(point(-.090,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G 1'))
      #
      # pin 2: source
      #
      self.shape = add(self.shape,translate(cube(-.031,.031,-.059,.059,0,0),.090,0,0))
      self.pad.append(point(.090,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'S'))
      #
      # pin 3: drain
      #
      self.shape = add(self.shape,translate(cube(-.132,.132,-.132,.132,0,0),0,.261,0))
      self.pad.append(point(0,.261,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'D'))

class Hall_SOT23(part):
   #
   # Allegro A1324
   #
   def __init__(self,value=''):
      self.value = value
      self.x = 0
      self.y = 0
      self.z = 0
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: output
      #
      self.shape = translate(pad_SOT23,-.045,.0375,0)
      self.pad.append(point(-.045,.0375,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Vcc'))
      #
      # pin 2: input
      #
      self.shape = add(self.shape,translate(pad_SOT23,-.045,-.0375,0))
      self.pad.append(point(-.045,-.0375,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'out'))
      #
      # pin 3: ground
      #
      self.shape = add(self.shape,translate(pad_SOT23,.045,0,0))
      self.pad.append(point(.045,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'gnd'))

class regulator_SOT23(part):
   #
   # TI LM3480IM3
   #
   def __init__(self,value=''):
      self.value = value
      self.x = 0
      self.y = 0
      self.z = 0
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: output
      #
      self.shape = translate(pad_SOT23,-.045,.0375,0)
      self.pad.append(point(-.045,.0375,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'out'))
      #
      # pin 2: input
      #
      self.shape = add(self.shape,translate(pad_SOT23,-.045,-.0375,0))
      self.pad.append(point(-.045,-.0375,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'in'))
      #
      # pin 3: ground
      #
      self.shape = add(self.shape,translate(pad_SOT23,.045,0,0))
      self.pad.append(point(.045,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'gnd'))

class regulator_SOT223(part):
   #
   # Zetex ZLDO1117
   #
   def __init__(self,value=''):
      self.value = value
      self.x = 0
      self.y = 0
      self.z = 0
      self.pad = [point(0,0,0)]
      self.labels = []
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      pad_SOT223 = cube(-.02,.02,-.03,.03,0,0)
      pad_SOT223_ground = cube(-.065,.065,-.03,.03,0,0)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625
      #
      # pin 1: GND
      #
      self.shape = translate(pad_SOT223,-.09,-.12,0)
      self.pad.append(point(-.09,-.12,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1G'))
      #
      # pin 2: output
      #
      self.shape = add(self.shape,translate(pad_SOT223,0,-.12,0))
      self.pad.append(point(0,-.12,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'O'))
      #
      # pin 3: input
      #
      self.shape = add(self.shape,translate(pad_SOT223,.09,-.12,0))
      self.pad.append(point(.09,-.12,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'I'))
      #
      # pin 4: output
      #
      self.shape = add(self.shape,translate(pad_SOT223_ground,0,.12,0))
      self.pad.append(point(0,.12,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'out'))

class A4953_SOICN(part):
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: GND
      #
      self.shape = translate(pad_SOIC,-.11,.075,0)
      self.shape = add(self.shape,cylinder(-.153,.075,0,0,.015))
      self.pad.append(point(-.11,.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 2: IN2
      #
      self.shape = add(self.shape,translate(pad_SOIC,-.11,.025,0))
      self.pad.append(point(-.11,.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IN2'))
      #
      # pin 3: IN1
      #
      self.shape = add(self.shape,translate(pad_SOIC,-.11,-.025,0))
      self.pad.append(point(-.11,-.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IN1'))
      #
      # pin 4: VREF
      #
      self.shape = add(self.shape,translate(pad_SOIC,-.11,-.075,0))
      self.pad.append(point(-.11,-.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VREF'))
      #
      # pin 5: VBB
      #
      self.shape = add(self.shape,translate(pad_SOIC,.11,-.075,0))
      self.pad.append(point(.11,-.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VBB'))
      #
      # pin 6: OUT1
      #
      self.shape = add(self.shape,translate(pad_SOIC,.11,-.025,0))
      self.pad.append(point(.11,-.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'OUT1'))
      #
      # pin 7: LSS
      #
      self.shape = add(self.shape,translate(pad_SOIC,.11,.025,0))
      self.pad.append(point(.11,.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'LSS'))
      #
      # pin 8: OUT2
      #
      self.shape = add(self.shape,translate(pad_SOIC,.11,.075,0))
      self.pad.append(point(.11,.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'OUT2'))
      #
      # thermal pad
      #
      self.shape = add(self.shape,rectangle(-.04,.04,-.075,.075))

pad_SM8 = cube(-.035,.035,-.016,.016,0,0)

class H_bridge_SM8(part):
   #
   # Zetex ZXMHC3A01T8
   #
   def __init__(self,value=''):
      self.value = value
      self.x = 0
      self.y = 0
      self.z = 0
      self.pad = [point(0,0,0)]
      self.labels = []
      d = .13
      #
      # pin 1: G3 (right N gate)
      #
      self.shape = translate(pad_SM8,-d,.09,0)
      self.shape = add(self.shape,cylinder(-d-.035,.09,0,0,.016))
      self.pad.append(point(-d,.09,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GRN'))
      #
      # pin 2: S2 S3 (N source)
      #
      self.shape = add(self.shape,translate(pad_SM8,-d,.03,0))
      self.pad.append(point(-d,.03,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SN'))
      #
      # pin 3: G2 (left N gate)
      #
      self.shape = add(self.shape,translate(pad_SM8,-d,-.03,0))
      self.pad.append(point(-d,-.03,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GLN'))
      #
      # pin 4: G1 (left P gate)
      #
      self.shape = add(self.shape,translate(pad_SM8,-d,-.09,0))
      self.pad.append(point(-d,-.09,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GLP'))
      #
      # pin 5: D1 D2 (left drain)
      #
      self.shape = add(self.shape,translate(pad_SM8,d,-.09,0))
      self.pad.append(point(d,-.09,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DL'))
      #
      # pin 6: S1 S4 (P source)
      #
      self.shape = add(self.shape,translate(pad_SM8,d,-.03,0))
      self.pad.append(point(d,-.03,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SP'))
      #
      # pin 7: D3 D4 (right drain)
      #
      self.shape = add(self.shape,translate(pad_SM8,d,.03,0))
      self.pad.append(point(d,.03,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DR'))
      #
      # pin 8: G4 (right N gate)
      #
      self.shape = add(self.shape,translate(pad_SM8,d,.09,0))
      self.pad.append(point(d,.09,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GRP'))

pad_mic = cylinder(0,0,0,0,.02)

class mic_SPU0414HR5H(part):
   #
   # Knowles SPU0414HR5H-SB
   #
   def __init__(self,value=''):
      s = 0.004
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: Vdd
      #
      self.shape = translate(pad_mic,.033,.048,0)
      self.pad.append(point(.033,.048,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V1',line=s))
      #
      # pin 2: GND
      #
      self.shape = add(self.shape,translate(pad_mic,.033,-.048,0))
      self.pad.append(point(.033,-.048,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=s))
      #
      # pin 3: gain
      #
      self.shape = add(self.shape,translate(pad_mic,-.033,-.048,0))
      self.pad.append(point(-.033,-.048,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'gain',line=s))
      #
      # pin 4: out
      #
      self.shape = add(self.shape,translate(pad_mic,-.033,.048,0))
      self.pad.append(point(-.033,.048,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'out',line=s))

class mic_SPM1437(part):
   #
   # Knowles SPM1437HM4H-B
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_mic,-.046,.065,0)
      #self.shape = add(self.shape,cylinder(-.183,.075,0,0,.015))
      self.pad.append(point(-.046,.065,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_mic,-.046,0,0))
      self.pad.append(point(-.046,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SEL'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_mic,-.046,-.065,0))
      self.pad.append(point(-.046,-.065,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_mic,.046,-.065,0))
      self.pad.append(point(.046,-.065,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CLK'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_mic,.046,0,0))
      self.pad.append(point(.046,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DAT'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad_mic,.046,.065,0))
      self.shape = add(self.shape,translate(pad_mic,.038,.057,0))
      self.pad.append(point(.046,.065,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V'))

pad_accel = cube(-.03,.03,-.0125,.0125,0,0)
pad_accel90 = cube(-.0125,.0125,-.03,.03,0,0)

class accel_MXD6235M(part):
   #
   # MEMSIC MXD6235M
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_accel,-.1,.05,0)
      self.shape = add(self.shape,cylinder(-.13,.05,0,0,.0125))
      self.pad.append(point(-.1,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_accel,-.1,0,0))
      self.pad.append(point(-.1,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'TP'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_accel,-.1,-.05,0))
      self.pad.append(point(-.1,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_accel90,0,-.1,0))
      self.pad.append(point(0,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'NC'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_accel,.1,-.05,0))
      self.pad.append(point(.1,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'NC'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad_accel,.1,0,0))
      self.pad.append(point(.1,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Y'))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad_accel,.1,.05,0))
      self.pad.append(point(.1,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'X'))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad_accel90,0,.1,0))
      self.pad.append(point(0,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V'))
      #
      # ground plane
      #
      self.shape = add(self.shape,cube(-.05,.05,-.05,.05,0,0))

pad_cc_14_1 = cube(-.014,.014,-.0075,.0075,0,0)
pad_cc_14_1_90 = cube(-.0075,.0075,-.014,.014,0,0)

class ADXL343(part):
   #
   # ADI ADXL343 accelerometer
   #
   def __init__(self,value=''):
      d = 0.8/25.4
      w = 1.01/25.4
      s = 0.004
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad_cc_14_1,-w,2.5*d,0)
      self.pad.append(point(-w,2.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,"VD1",line=s))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad_cc_14_1,-w,1.5*d,0))
      self.pad.append(point(-w,1.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=s))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad_cc_14_1,-w,.5*d,0))
      self.pad.append(point(-w,.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RSV',line=s))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad_cc_14_1,-w,-.5*d,0))
      self.pad.append(point(-w,-.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=s))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad_cc_14_1,-w,-1.5*d,0))
      self.pad.append(point(-w,-1.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=s))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad_cc_14_1,-w,-2.5*d,0))
      self.pad.append(point(-w,-2.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VS',line=s))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad_cc_14_1_90,0,-2.5*d,0))
      self.pad.append(point(0,-2.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'-CS',angle=90,line=s))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad_cc_14_1,w,-2.5*d,0))
      self.pad.append(point(w,-2.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'INT1',line=s))
      #
      # pin 9
      #
      self.shape = add(self.shape,translate(pad_cc_14_1,w,-1.5*d,0))
      self.pad.append(point(w,-1.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'INT2',line=s))
      #
      # pin 10
      #
      self.shape = add(self.shape,translate(pad_cc_14_1,w,-.5*d,0))
      self.pad.append(point(w,-.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'NC',line=s))
      #
      # pin 11
      #
      self.shape = add(self.shape,translate(pad_cc_14_1,w,.5*d,0))
      self.pad.append(point(w,.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RSV',line=s))
      #
      # pin 12
      #
      self.shape = add(self.shape,translate(pad_cc_14_1,w,1.5*d,0))
      self.pad.append(point(w,1.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'ALT',line=s))
      #
      # pin 13
      #
      self.shape = add(self.shape,translate(pad_cc_14_1,w,2.5*d,0))
      self.pad.append(point(w,2.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDA',line=s))
      #
      # pin 14
      #
      self.shape = add(self.shape,translate(pad_cc_14_1_90,0,2.5*d,0))
      self.pad.append(point(0,2.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCL',angle=90,line=s))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class VL53L1X(part):
   #
   # ST VL53L1X time of flight sensor 
   #
   def __init__(self,value=''):
      pad = cube(-.0075,.0075,-.0075,.0075,0,0)
      d = 0.8/25.4
      w = 0.8/25.4
      s = 0.004
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1
      #
      self.shape = translate(pad,-w,-2*d,0)
      self.pad.append(point(-w,-2*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,"1V",line=s))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad,-w,-1*d,0))
      self.pad.append(point(-w,-1*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G',line=s))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad,-w,0*d,0))
      self.pad.append(point(-w,0*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G',line=s))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad,-w,1*d,0))
      self.pad.append(point(-w,1*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G',line=s))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad,-w,2*d,0))
      self.pad.append(point(-w,2*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'XS',line=s))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad,0,2*d,0))
      self.pad.append(point(0,2*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G',line=s))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad,w,2*d,0))
      self.pad.append(point(w,2*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IO',line=s))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad,w,1*d,0))
      self.pad.append(point(w,1*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'NC',line=s))
      #
      # pin 9
      #
      self.shape = add(self.shape,translate(pad,w,0*d,0))
      self.pad.append(point(w,0*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDA',line=s))
      #
      # pin 10
      #
      self.shape = add(self.shape,translate(pad,w,-1*d,0))
      self.pad.append(point(w,-1*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCL',line=s))
      #
      # pin 11
      #
      self.shape = add(self.shape,translate(pad,w,-2*d,0))
      self.pad.append(point(w,-2*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V',line=s))
      #
      # pin 12
      #
      self.shape = add(self.shape,translate(pad,0,-2*d,0))
      self.pad.append(point(0,-2*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'G',line=s))

############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# ICs
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################

class AVRDB28(part):
   #
   # AVR*DB28
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      d = 9.01/2/25.4 # spacing
      w = 0.4/2/25.4 # width
      h = 1.4/2/25.4 # height
      p = 0.8/25.4 # pitch
      l = 0.004 # text
      pad = cube(-h,h,-w,w,0,0)
      padv = cube(-w,w,-h,h,0,0)
      #
      # pin 1
      #
      self.shape = translate(pad,-d,3.5*p,0)
      self.shape = add(self.shape,cylinder(-d-h,3.5*p,0,0,w))
      self.pad.append(point(-d,3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'.PA3',line=l))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad,-d,2.5*p,0))
      self.pad.append(point(-d,2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA4',line=l))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad,-d,1.5*p,0))
      self.pad.append(point(-d,1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA5',line=l))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad,-d,.5*p,0))
      self.pad.append(point(-d,.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA6',line=l))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad,-d,-.5*p,0))
      self.pad.append(point(-d,-.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA7',line=l))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad,-d,-1.5*p,0))
      self.pad.append(point(-d,-1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC0',line=l))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad,-d,-2.5*p,0))
      self.pad.append(point(-d,-2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC1',line=l))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad,-d,-3.5*p,0))
      self.pad.append(point(-d,-3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC2',line=l))
      #
      # pin 9
      #
      self.shape = add(self.shape,translate(padv,-3.5*p,-d,0))
      self.pad.append(point(-3.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC3',line=l,angle=-90))
      #
      # pin 10
      #
      self.shape = add(self.shape,translate(padv,-2.5*p,-d,0))
      self.pad.append(point(-2.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VIO2',line=l,angle=-90))
      #
      # pin 11
      #
      self.shape = add(self.shape,translate(padv,-1.5*p,-d,0))
      self.pad.append(point(-1.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD1',line=l,angle=-90))
      #
      # pin 12
      #
      self.shape = add(self.shape,translate(padv,-.5*p,-d,0))
      self.pad.append(point(-.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD2',line=l,angle=-90))
      #
      # pin 13
      #
      self.shape = add(self.shape,translate(padv,.5*p,-d,0))
      self.pad.append(point(.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD3',line=l,angle=-90))
      #
      # pin 14
      #
      self.shape = add(self.shape,translate(padv,1.5*p,-d,0))
      self.pad.append(point(1.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD4',line=l,angle=-90))
      #
      # pin 15
      #
      self.shape = add(self.shape,translate(padv,2.5*p,-d,0))
      self.pad.append(point(2.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD5',line=l,angle=-90))
      #
      # pin 16
      #
      self.shape = add(self.shape,translate(padv,3.5*p,-d,0))
      self.pad.append(point(3.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD6',line=l,angle=-90))
      #
      # pin 17
      #
      self.shape = add(self.shape,translate(pad,d,-3.5*p,0))
      self.pad.append(point(d,-3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD7',line=l))
      #
      # pin 18
      #
      self.shape = add(self.shape,translate(pad,d,-2.5*p,0))
      self.pad.append(point(d,-2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'AVDD',line=l))
      #
      # pin 19
      #
      self.shape = add(self.shape,translate(pad,d,-1.5*p,0))
      self.pad.append(point(d,-1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=l))
      #
      # pin 20
      #
      self.shape = add(self.shape,translate(pad,d,-.5*p,0))
      self.pad.append(point(d,-.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PF0',line=l))
      #
      # pin 21
      #
      self.shape = add(self.shape,translate(pad,d,.5*p,0))
      self.pad.append(point(d,.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PF1',line=l))
      #
      # pin 22
      #
      self.shape = add(self.shape,translate(pad,d,1.5*p,0))
      self.pad.append(point(d,1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PF2',line=l))
      #
      # pin 23
      #
      self.shape = add(self.shape,translate(pad,d,2.5*p,0))
      self.pad.append(point(d,2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PF3',line=l))
      #
      # pin 24
      #
      self.shape = add(self.shape,translate(pad,d,3.5*p,0))
      self.pad.append(point(d,3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PF4',line=l))
      #
      # pin 25
      #
      self.shape = add(self.shape,translate(padv,3.5*p,d,0))
      self.pad.append(point(3.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PF5',line=l,angle=-90))
      #
      # pin 26
      #
      self.shape = add(self.shape,translate(padv,2.5*p,d,0))
      self.pad.append(point(2.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PF6',line=l,angle=-90))
      #
      # pin 27
      #
      self.shape = add(self.shape,translate(padv,1.5*p,d,0))
      self.pad.append(point(1.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'UPDI',line=l,angle=-90))
      #
      # pin 28
      #
      self.shape = add(self.shape,translate(padv,.5*p,d,0))
      self.pad.append(point(.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VDD',line=l,angle=-90))
      #
      # pin 29
      #
      self.shape = add(self.shape,translate(padv,-.5*p,d,0))
      self.pad.append(point(-.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=l,angle=-90))
      #
      # pin 30
      #
      self.shape = add(self.shape,translate(padv,-1.5*p,d,0))
      self.pad.append(point(-1.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA0',line=l,angle=-90))
      #
      # pin 31
      #
      self.shape = add(self.shape,translate(padv,-2.5*p,d,0))
      self.pad.append(point(-2.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA1',line=l,angle=-90))
      #
      # pin 32
      #
      self.shape = add(self.shape,translate(padv,-3.5*p,d,0))
      self.pad.append(point(-3.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA2',line=l,angle=-90))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class ATtiny3216(part):
   #
   # SOIC-20
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      d = 9.82/2/25.4
      w = .63/2/25.4
      h = 1.9/2/25.4
      pad = cube(-h,h,-w,w,0,0)
      #
      # pin 1
      #
      self.shape = translate(pad,-d,.225,0)
      self.shape = add(self.shape,cylinder(-d-h,.225,0,0,w))
      self.pad.append(point(-d,.225,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1VCC'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad,-d,.175,0))
      self.pad.append(point(-d,.175,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA4'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad,-d,.125,0))
      self.pad.append(point(-d,.125,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA5'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad,-d,.075,0))
      self.pad.append(point(-d,.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA6'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad,-d,.025,0))
      self.pad.append(point(-d,.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA7'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad,-d,-.025,0))
      self.pad.append(point(-d,-.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB5'))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad,-d,-.075,0))
      self.pad.append(point(-d,-.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB4'))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad,-d,-.125,0))
      self.pad.append(point(-d,-.125,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RB3'))
      #
      # pin 9
      #
      self.shape = add(self.shape,translate(pad,-d,-.175,0))
      self.pad.append(point(-d,-.175,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'TB2'))
      #
      # pin 10
      #
      self.shape = add(self.shape,translate(pad,-d,-.225,0))
      self.pad.append(point(-d,-.225,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB1'))
      #
      # pin 11
      #
      self.shape = add(self.shape,translate(pad,d,-.225,0))
      self.pad.append(point(d,-.225,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB0'))
      #
      # pin 12
      #
      self.shape = add(self.shape,translate(pad,d,-.175,0))
      self.pad.append(point(d,-.175,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC0'))
      #
      # pin 13
      #
      self.shape = add(self.shape,translate(pad,d,-.125,0))
      self.pad.append(point(d,-.125,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC1'))
      #
      # pin 14
      #
      self.shape = add(self.shape,translate(pad,d,-.075,0))
      self.pad.append(point(d,-.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC2'))
      #
      # pin 15
      #
      self.shape = add(self.shape,translate(pad,d,-.025,0))
      self.pad.append(point(d,-.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC3'))
      #
      # pin 16
      #
      self.shape = add(self.shape,translate(pad,d,.025,0))
      self.pad.append(point(d,.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'UPDI'))
      #
      # pin 17
      #
      self.shape = add(self.shape,translate(pad,d,.075,0))
      self.pad.append(point(d,.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA1'))
      #
      # pin 18
      #
      self.shape = add(self.shape,translate(pad,d,.125,0))
      self.pad.append(point(d,.125,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA2'))
      #
      # pin 19
      #
      self.shape = add(self.shape,translate(pad,d,.175,0))
      self.pad.append(point(d,.175,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA3'))
      #
      # pin 20
      #
      self.shape = add(self.shape,translate(pad,d,.225,0))
      self.pad.append(point(d,.225,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class SAMD21E(part):
   #
   # TQFP
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      d = 9.01/2/25.4 # spacing
      w = 0.4/2/25.4 # width
      h = 1.4/2/25.4 # height
      p = 0.8/25.4 # pitch
      l = 0.004 # text
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      pad = cube(-h,h,-w,w,0,0)
      padv = cube(-w,w,-h,h,0,0)
      #
      # pin 1
      #
      self.shape = translate(pad,-d,3.5*p,0)
      self.shape = add(self.shape,cylinder(-d-h,3.5*p,0,0,w))
      self.pad.append(point(-d,3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1A0',line=l))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad,-d,2.5*p,0))
      self.pad.append(point(-d,2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A01',line=l))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad,-d,1.5*p,0))
      self.pad.append(point(-d,1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A02',line=l))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad,-d,.5*p,0))
      self.pad.append(point(-d,.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A03',line=l))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad,-d,-.5*p,0))
      self.pad.append(point(-d,-.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A04',line=l))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad,-d,-1.5*p,0))
      self.pad.append(point(-d,-1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A05',line=l))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad,-d,-2.5*p,0))
      self.pad.append(point(-d,-2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A06',line=l))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad,-d,-3.5*p,0))
      self.pad.append(point(-d,-3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A07',line=l))
      #
      # pin 9
      #
      self.shape = add(self.shape,translate(padv,-3.5*p,-d,0))
      self.pad.append(point(-3.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VAN',line=l,angle=-90))
      #
      # pin 10
      #
      self.shape = add(self.shape,translate(padv,-2.5*p,-d,0))
      self.pad.append(point(-2.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=l,angle=-90))
      #
      # pin 11
      #
      self.shape = add(self.shape,translate(padv,-1.5*p,-d,0))
      self.pad.append(point(-1.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A08',line=l,angle=-90))
      #
      # pin 12
      #
      self.shape = add(self.shape,translate(padv,-.5*p,-d,0))
      self.pad.append(point(-.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A09',line=l,angle=-90))
      #
      # pin 13
      #
      self.shape = add(self.shape,translate(padv,.5*p,-d,0))
      self.pad.append(point(.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A10',line=l,angle=-90))
      #
      # pin 14
      #
      self.shape = add(self.shape,translate(padv,1.5*p,-d,0))
      self.pad.append(point(1.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A11',line=l,angle=-90))
      #
      # pin 15
      #
      self.shape = add(self.shape,translate(padv,2.5*p,-d,0))
      self.pad.append(point(2.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A14',line=l,angle=-90))
      #
      # pin 16
      #
      self.shape = add(self.shape,translate(padv,3.5*p,-d,0))
      self.pad.append(point(3.5*p,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A15',line=l,angle=-90))
      #
      # pin 17
      #
      self.shape = add(self.shape,translate(pad,d,-3.5*p,0))
      self.pad.append(point(d,-3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A16',line=l))
      #
      # pin 18
      #
      self.shape = add(self.shape,translate(pad,d,-2.5*p,0))
      self.pad.append(point(d,-2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A17',line=l))
      #
      # pin 19
      #
      self.shape = add(self.shape,translate(pad,d,-1.5*p,0))
      self.pad.append(point(d,-1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A18',line=l))
      #
      # pin 20
      #
      self.shape = add(self.shape,translate(pad,d,-.5*p,0))
      self.pad.append(point(d,-.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A19',line=l))
      #
      # pin 21
      #
      self.shape = add(self.shape,translate(pad,d,.5*p,0))
      self.pad.append(point(d,.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A22',line=l))
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 22
      #
      self.shape = add(self.shape,translate(pad,d,1.5*p,0))
      self.pad.append(point(d,1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A23',line=l))
      #
      # pin 23
      #
      self.shape = add(self.shape,translate(pad,d,2.5*p,0))
      self.pad.append(point(d,2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'24-',line=l))
      #
      # pin 24
      #
      self.shape = add(self.shape,translate(pad,d,3.5*p,0))
      self.pad.append(point(d,3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'25+',line=l))
      #
      # pin 25
      #
      self.shape = add(self.shape,translate(padv,3.5*p,d,0))
      self.pad.append(point(3.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A27',line=l,angle=-90))
      #
      # pin 26
      #
      self.shape = add(self.shape,translate(padv,2.5*p,d,0))
      self.pad.append(point(2.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST',line=l,angle=-90))
      #
      # pin 27
      #
      self.shape = add(self.shape,translate(padv,1.5*p,d,0))
      self.pad.append(point(1.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A28',line=l,angle=-90))
      #
      # pin 28
      #
      self.shape = add(self.shape,translate(padv,.5*p,d,0))
      self.pad.append(point(.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=l,angle=-90))
      #
      # pin 29
      #
      self.shape = add(self.shape,translate(padv,-.5*p,d,0))
      self.pad.append(point(-.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCR',line=l,angle=-90))
      #
      # pin 30
      #
      self.shape = add(self.shape,translate(padv,-1.5*p,d,0))
      self.pad.append(point(-1.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VIN',line=l,angle=-90))
      #
      # pin 31
      #
      self.shape = add(self.shape,translate(padv,-2.5*p,d,0))
      self.pad.append(point(-2.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CLK',line=l,angle=-90))
      #
      # pin 32
      #
      self.shape = add(self.shape,translate(padv,-3.5*p,d,0))
      self.pad.append(point(-3.5*p,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DIO',line=l,angle=-90))

class SAMD11D(part):
   #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   # SOIC-20
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      d = 9.82/2/25.4
      w = .63/2/25.4
      h = 1.9/2/25.4
      pad = cube(-h,h,-w,w,0,0)
      #
      # pin 1
      #
      self.shape = translate(pad,-d,.225,0)
      self.shape = add(self.shape,cylinder(-d-h,.225,0,0,w))
      self.pad.append(point(-d,.225,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1A05'))
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad,-d,.175,0))
      self.pad.append(point(-d,.175,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A06'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad,-d,.125,0))
      self.pad.append(point(-d,.125,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A07'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad,-d,.075,0))
      self.pad.append(point(-d,.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A08'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad,-d,.025,0))
      self.pad.append(point(-d,.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A09'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad,-d,-.025,0))
      self.pad.append(point(-d,-.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A14'))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad,-d,-.075,0))
      self.pad.append(point(-d,-.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A15'))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad,-d,-.125,0))
      self.pad.append(point(-d,-.125,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A16'))
      #
      # pin 9
      #
      self.shape = add(self.shape,translate(pad,-d,-.175,0))
      self.pad.append(point(-d,-.175,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A22'))
      #
      # pin 10
      #
      self.shape = add(self.shape,translate(pad,-d,-.225,0))
      self.pad.append(point(-d,-.225,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A23'))
      #
      # pin 11
      #
      self.shape = add(self.shape,translate(pad,d,-.225,0))
      self.pad.append(point(d,-.225,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST'))
      #
      # pin 12
      #
      self.shape = add(self.shape,translate(pad,d,-.175,0))
      self.pad.append(point(d,-.175,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CLK'))
      #
      # pin 13
      #
      self.shape = add(self.shape,translate(pad,d,-.125,0))
      self.pad.append(point(d,-.125,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DIO'))
      #
      # pin 14
      #
      self.shape = add(self.shape,translate(pad,d,-.075,0))
      self.pad.append(point(d,-.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'24-'))
      #
      # pin 15
      #
      self.shape = add(self.shape,translate(pad,d,-.025,0))
      self.pad.append(point(d,-.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'25+'))
      #
      # pin 16
      #
      self.shape = add(self.shape,translate(pad,d,.025,0))
      self.pad.append(point(d,.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 17
      #
      self.shape = add(self.shape,translate(pad,d,.075,0))
      self.pad.append(point(d,.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))
      #
      # pin 18
      #
      self.shape = add(self.shape,translate(pad,d,.125,0))
      self.pad.append(point(d,.125,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A02'))
      #
      # pin 19
      #
      self.shape = add(self.shape,translate(pad,d,.175,0))
      self.pad.append(point(d,.175,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A03'))
      #
      # pin 20
      #
      self.shape = add(self.shape,translate(pad,d,.225,0))
      self.pad.append(point(d,.225,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A04'))

class ATtiny1614(part):
   #
   # SOIC
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      d = 0.11
      w = 0.015
      h = .03
      pad = cube(-h,h,-w,w,0,0)
      #
      # pin 1
      #
      self.shape = translate(pad,-d,.15,0)
      self.shape = add(self.shape,cylinder(-d-h,.15,0,0,w))
      self.pad.append(point(-d,.15,0))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'.VCC'))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad,-d,.1,0))
      self.pad.append(point(-d,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA4'))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad,-d,.050,0))
      self.pad.append(point(-d,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA5'))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad,-d,0,0))
      self.pad.append(point(-d,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA6'))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad,-d,-.05,0))
      self.pad.append(point(-d,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA7'))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad,-d,-.1,0))
      self.pad.append(point(-d,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RB3'))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad,-d,-.15,0))
      self.pad.append(point(-d,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'TB2'))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad,d,-.15,0))
      self.pad.append(point(d,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB1'))
      #
      # pin 9
      #
      self.shape = add(self.shape,translate(pad,d,-.1,0))
      self.pad.append(point(d,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB0'))
      #
      # pin 10
      #
      self.shape = add(self.shape,translate(pad,d,-.05,0))
      self.pad.append(point(d,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'UPDI'))
      #
      # pin 11
      #
      self.shape = add(self.shape,translate(pad,d,0,0))
      self.pad.append(point(d,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA1'))
      #
      # pin 12
      #
      self.shape = add(self.shape,translate(pad,d,.050,0))
      self.pad.append(point(d,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA2'))
      #
      # pin 13
      #
      self.shape = add(self.shape,translate(pad,d,.1,0))
      self.pad.append(point(d,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA3'))
      #
      # pin 14
      self.shape = add(self.shape,translate(pad,d,.15,0))
      self.pad.append(point(d,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class FT230XS(part):
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      d = 0.11
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      w = 0.0053
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      h = .03
      p = .65/25.4
      l = 0.004
      pad = cube(-h,h,-w,w,0,0)
      #
      # pin 1
      #
      self.shape = translate(pad,-d,3.5*p,0)
      self.shape = add(self.shape,cylinder(-d-h,3.5*p,0,0,w))
      self.pad.append(point(-d,3.5*p,0))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1TXD',line=l))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      # pin 2
      #
      self.shape = add(self.shape,translate(pad,-d,2.5*p,0))
      self.pad.append(point(-d,2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RTS',line=l))
      #
      # pin 3
      #
      self.shape = add(self.shape,translate(pad,-d,1.5*p,0))
      self.pad.append(point(-d,1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VIO',line=l))
      #
      # pin 4
      #
      self.shape = add(self.shape,translate(pad,-d,.5*p,0))
      self.pad.append(point(-d,.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RXD',line=l))
      #
      # pin 5
      #
      self.shape = add(self.shape,translate(pad,-d,-.5*p,0))
      self.pad.append(point(-d,-.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=l))
      #
      # pin 6
      #
      self.shape = add(self.shape,translate(pad,-d,-1.5*p,0))
      self.pad.append(point(-d,-1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CTS',line=l))
      #
      # pin 7
      #
      self.shape = add(self.shape,translate(pad,-d,-2.5*p,0))
      self.pad.append(point(-d,-2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CB2',line=l))
      #
      # pin 8
      #
      self.shape = add(self.shape,translate(pad,-d,-3.5*p,0))
      self.pad.append(point(-d,-3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'USP',line=l))
      #
      # pin 9
      #
      self.shape = add(self.shape,translate(pad,d,-3.5*p,0))
      self.pad.append(point(d,-3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'USM',line=l))
      #
      # pin 10
      #
      self.shape = add(self.shape,translate(pad,d,-2.5*p,0))
      self.pad.append(point(d,-2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'3V3',line=l))
      #
      # pin 11
      #
      self.shape = add(self.shape,translate(pad,d,-1.5*p,0))
      self.pad.append(point(d,-1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST',line=l))
      #
      # pin 12
      #
      self.shape = add(self.shape,translate(pad,d,-.5*p,0))
      self.pad.append(point(d,-.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC',line=l))
      #
      # pin 13
      #
      self.shape = add(self.shape,translate(pad,d,.5*p,0))
      self.pad.append(point(d,.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=l))
      #
      # pin 14
      self.shape = add(self.shape,translate(pad,d,1.5*p,0))
      self.pad.append(point(d,1.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CB1',line=l))
      #
      # pin 15
      #
      self.shape = add(self.shape,translate(pad,d,2.5*p,0))
      self.pad.append(point(d,2.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CB0',line=l))
      #
      # pin 16
      self.shape = add(self.shape,translate(pad,d,3.5*p,0))
      self.pad.append(point(d,3.5*p,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CB3',line=l))


Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class ATtiny412(part):
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   #
   # SOIC150
   #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      d = 0.11
      w = 0.015
      h = .03
      pad = cube(-h,h,-w,w,0,0)
      #
      # pin 1: VCC
      #
      self.shape = translate(pad,-d,.075,0)
      self.shape = add(self.shape,cylinder(-d-h,.075,0,0,w))
      self.pad.append(point(-d,.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))
      #
      # pin 2: PA6
      #
      self.shape = add(self.shape,translate(pad,-d,.025,0))
      self.pad.append(point(-d,.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA6'))
      #
      # pin 3: PA7
      #
      self.shape = add(self.shape,translate(pad,-d,-.025,0))
      self.pad.append(point(-d,-.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA7'))
      #
      # pin 4: PA1
      #
      self.shape = add(self.shape,translate(pad,-d,-.075,0))
      self.pad.append(point(-d,-.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA1'))
      #
      # pin 5: PA2
      #
      self.shape = add(self.shape,translate(pad,d,-.075,0))
      self.pad.append(point(d,-.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA2'))
      #
      # pin 6: UPDI
      #
      self.shape = add(self.shape,translate(pad,d,-.025,0))
      self.pad.append(point(d,-.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'UPDI'))
      #
      # pin 7: PA3
      #
      self.shape = add(self.shape,translate(pad,d,.025,0))
      self.pad.append(point(d,.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA3'))
      #
      # pin 8: GND
      #
      self.shape = add(self.shape,translate(pad,d,.075,0))
      self.pad.append(point(d,.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
class SAMD11C(part):
   #
   # SOIC
   #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      d = 0.11
      w = 0.015
      h = .03
      pad = cube(-h,h,-w,w,0,0)
      #
      # pin 1: PA05
      #
      self.shape = translate(pad,-d,.15,0)
      self.shape = add(self.shape,cylinder(-d-h,.15,0,0,w))
      self.pad.append(point(-d,.15,0))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1A05'))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      # pin 2: PA08
      #
      self.shape = add(self.shape,translate(pad,-d,.1,0))
      self.pad.append(point(-d,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A08'))
      #
      # pin 3: PA09
      #
      self.shape = add(self.shape,translate(pad,-d,.050,0))
      self.pad.append(point(-d,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A09'))
      #
      # pin 4: PA14
      #
      self.shape = add(self.shape,translate(pad,-d,0,0))
      self.pad.append(point(-d,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A14'))
      #
      # pin 5: PA15
      #
      self.shape = add(self.shape,translate(pad,-d,-.05,0))
      self.pad.append(point(-d,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A15'))
      #
      # pin 6: nRESET
      #
      self.shape = add(self.shape,translate(pad,-d,-.1,0))
      self.pad.append(point(-d,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST'))
      #
      # pin 7: CLK
      #
      self.shape = add(self.shape,translate(pad,-d,-.15,0))
      self.pad.append(point(-d,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CLK'))
      #
      # pin 8: DIO
      #
      self.shape = add(self.shape,translate(pad,d,-.15,0))
      self.pad.append(point(d,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DIO'))
      #
      # pin 9: PA24/D-
      #
      self.shape = add(self.shape,translate(pad,d,-.1,0))
      self.pad.append(point(d,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'24-'))
      #
      # pin 10: PA25/D+
      #
      self.shape = add(self.shape,translate(pad,d,-.05,0))
      self.pad.append(point(d,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'25+'))
      #
      # pin 11: GND
      #
      self.shape = add(self.shape,translate(pad,d,0,0))
      self.pad.append(point(d,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      # pin 12: VDD
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      self.shape = add(self.shape,translate(pad,d,.050,0))
      self.pad.append(point(d,.05,0))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VDD'))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
      # pin 13: PA02
      #
      self.shape = add(self.shape,translate(pad,d,.1,0))
      self.pad.append(point(d,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A02'))
      #
      # pin 14: PA04
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      #
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      self.shape = add(self.shape,translate(pad,d,.15,0))
      self.pad.append(point(d,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A04'))
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943

pad_SOT23_5 = cube(-.01,.01,-.02,.02,0,0)

class op_amp_SOT23_5(part):
   def __init__(self,value=''):
      self.value = value
      self.x = 0
      self.y = 0
      self.z = 0
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: output
      #
      self.shape = translate(pad_SOT23_5,-.0375,-.045,0)
      self.pad.append(point(-.0375,-.045,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'O'))
      #
      # pin 2: V-
      #
      self.shape = add(self.shape,translate(pad_SOT23_5,0,-.045,0))
      self.pad.append(point(0,-.045,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V-'))
      #
      # pin 3: I+
      #
      self.shape = add(self.shape,translate(pad_SOT23_5,.0375,-.045,0))
      self.pad.append(point(.0375,-.045,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'I+'))
      #
      # pin 4: I-
      #
      self.shape = add(self.shape,translate(pad_SOT23_5,.0375,.045,0))
      self.pad.append(point(.0375,.045,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'I-'))
      #
      # pin 5: V+
      #
      self.shape = add(self.shape,translate(pad_SOT23_5,-.0375,.045,0))
      self.pad.append(point(-.0375,.045,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V+'))

pad_SOICN = cube(-.035,.035,-.015,.015,0,0)

class op_amp_SOICN(part):
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: A out
      #
      self.shape = translate(pad_SOICN,-.12,.075,0)
      self.pad.append(point(-.12,.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1 Ao'))
      #
      # pin 2: A-
      #
      self.shape = add(self.shape,translate(pad_SOICN,-.12,.025,0))
      self.pad.append(point(-.12,.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A-'))
      #
      # pin 3: A+
      #
      self.shape = add(self.shape,translate(pad_SOICN,-.12,-.025,0))
      self.pad.append(point(-.12,-.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'A+'))
      #
      # pin 4: V-
      #
      self.shape = add(self.shape,translate(pad_SOICN,-.12,-.075,0))
      self.pad.append(point(-.12,-.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V-'))
      #
      # pin 5: B+
      #
      self.shape = add(self.shape,translate(pad_SOICN,.12,-.075,0))
      self.pad.append(point(.12,-.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'B+'))
      #
      # pin 6: B-
      #
      self.shape = add(self.shape,translate(pad_SOICN,.12,-.025,0))
      self.pad.append(point(.12,-.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'B-'))
      #
      # pin 7: B out
      #
      self.shape = add(self.shape,translate(pad_SOICN,.12,.025,0))
      self.pad.append(point(.12,.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Bo'))
      #
      # pin 8: V+
      #
      self.shape = add(self.shape,translate(pad_SOICN,.12,.075,0))
      self.pad.append(point(.12,.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'V+'))

TSSOP_pad_width = 0.040
TSSOP_pad_height = 0.011
TSSOP_pad_dy = 0.026
TSSOP_pad_dx = 0.120
pad_TSSOP = cube(-TSSOP_pad_width/2.0,TSSOP_pad_width/2.0,-TSSOP_pad_height/2.0,TSSOP_pad_height/2.0,0,0)

class TRC102(part):
   #
   # RFM TRC102 ISM transceiver
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: SDI
      #
      self.shape = translate(pad_TSSOP,-TSSOP_pad_dx,3.5*TSSOP_pad_dy,0)
      self.pad.append(point(-TSSOP_pad_dx,3.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1 SDI'))
      #
      # pin 2: SCK
      #
      self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,2.5*TSSOP_pad_dy,0))
      self.pad.append(point(-TSSOP_pad_dx,2.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCK'))
      #
      # pin 3: nCS
      #
      self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,1.5*TSSOP_pad_dy,0))
      self.pad.append(point(-TSSOP_pad_dx,1.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'nCS'))
      #
      # pin 4: SDO
      #
      self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,0.5*TSSOP_pad_dy,0))
      self.pad.append(point(-TSSOP_pad_dx,0.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDO'))
      #
      # pin 5: IRQ
      #
      self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,-0.5*TSSOP_pad_dy,0))
      self.pad.append(point(-TSSOP_pad_dx,-0.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IRQ'))
      #
      # pin 6: DATA/nFSEL
      #
      self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,-1.5*TSSOP_pad_dy,0))
      self.pad.append(point(-TSSOP_pad_dx,-1.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DATA'))
      #
      # pin 7: CR
      #
      self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,-2.5*TSSOP_pad_dy,0))
      self.pad.append(point(-TSSOP_pad_dx,-2.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CR'))
      #
      # pin 8: CLKOUT
      #
      self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,-3.5*TSSOP_pad_dy,0))
      self.pad.append(point(-TSSOP_pad_dx,-3.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CLKOUT'))
      #
      # pin 9: Xtal/Ref
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,-3.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,-3.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Xtal'))
      #
      # pin 10: RESET
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,-2.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,-2.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RESET'))
      #
      # pin 11: GND
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,-1.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,-1.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 12: RF_P
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,-0.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,-0.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RF_P'))
      #
      # pin 13: RF_N
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,0.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,0.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RF_N'))
      #
      # pin 14: VDD
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,1.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,1.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VDD'))
      #
      # pin 15: RSSIA
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,2.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,2.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RSSIA'))
      #
      # pin 16: nINT/DDET
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,3.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,3.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'nINT'))

pad_SOIC = cube(-.041,.041,-.015,.015,0,0)

class ATtiny45_SOIC(part):
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: PB5/dW/ADC0/-RESET/PCINT5
      #
      self.shape = translate(pad_SOIC,-.14,.075,0)
      self.shape = add(self.shape,cylinder(-.183,.075,0,0,.015))
      self.pad.append(point(-.14,.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST'))
      #
      # pin 2: PB3/ADC3/-OC1B/CLKI/XTAL1/PCINT3
      #
      self.shape = add(self.shape,translate(pad_SOIC,-.14,.025,0))
      self.pad.append(point(-.14,.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB3'))
      #
      # pin 3: PB4/ADC2/OC1B/CLKO/XTAL2/PCINT4
      #
      self.shape = add(self.shape,translate(pad_SOIC,-.14,-.025,0))
      self.pad.append(point(-.14,-.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB4'))
      #
      # pin 4: GND
      #
      self.shape = add(self.shape,translate(pad_SOIC,-.14,-.075,0))
      self.pad.append(point(-.14,-.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 5: PB0/MOSI/DI/SDA/AIN0/OC0A/-OC1A/AREF/PCINT0
      #
      self.shape = add(self.shape,translate(pad_SOIC,.14,-.075,0))
      self.pad.append(point(.14,-.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB0'))
      #
      # pin 6: PB1/MISO/DO/AIN1/OC0B/OC1A/PCINT1
      #
      self.shape = add(self.shape,translate(pad_SOIC,.14,-.025,0))
      self.pad.append(point(.14,-.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB1'))
      #
      # pin 7: PB2/SCK/USCK/SCL/ADC1/T0/INT0/PCINT2
      #
      self.shape = add(self.shape,translate(pad_SOIC,.14,.025,0))
      self.pad.append(point(.14,.025,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB2'))
      #
      # pin 8: VCC
      #
      self.shape = add(self.shape,translate(pad_SOIC,.14,.075,0))
      self.pad.append(point(.14,.075,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))

class ATtiny44_SOICN(part):
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: VCC
      #
      self.shape = translate(pad_SOICN,-.12,.15,0)
      self.shape = add(self.shape,cylinder(-.155,.15,0,0,.015))
      self.pad.append(point(-.12,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))
      #
      # pin 2: PB0/XTAL1/PCINT8
      #
      self.shape = add(self.shape,translate(pad_SOICN,-.12,.1,0))
      self.pad.append(point(-.12,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB0'))
      #
      # pin 3: PB1/XTAL2/PCINT9
      #
      self.shape = add(self.shape,translate(pad_SOICN,-.12,.050,0))
      self.pad.append(point(-.12,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB1'))
      #
      # pin 4: PB3/dW/-RESET/PCINT11
      #
      self.shape = add(self.shape,translate(pad_SOICN,-.12,0,0))
      self.pad.append(point(-.12,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB3'))
      #
      # pin 5: PB2/CKOUT/OC0A/INT0/PCINT10
      #
      self.shape = add(self.shape,translate(pad_SOICN,-.12,-.05,0))
      self.pad.append(point(-.12,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB2'))
      #
      # pin 6: PA7/ADC7/OC0B/ICP/PCINT7
      #
      self.shape = add(self.shape,translate(pad_SOICN,-.12,-.1,0))
      self.pad.append(point(-.12,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA7'))
      #
      # pin 7: PA6/ADC6/MOSI/SDA/OC1A/PCINT6
      #
      self.shape = add(self.shape,translate(pad_SOICN,-.12,-.15,0))
      self.pad.append(point(-.12,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA6'))
      #
      # pin 8: PA5/ADC5/DO/MISO/OC1B/PCINT5
      #
      self.shape = add(self.shape,translate(pad_SOICN,.12,-.15,0))
      self.pad.append(point(.12,-.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA5'))
      #
      # pin 9: PA4/ADC4/USCK/SCL/T1/PCINT4
      #
      self.shape = add(self.shape,translate(pad_SOICN,.12,-.1,0))
      self.pad.append(point(.12,-.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA4'))
      #
      # pin 10: PA3/ADC3/T0/PCINT3
      #
      self.shape = add(self.shape,translate(pad_SOICN,.12,-.05,0))
      self.pad.append(point(.12,-.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA3'))
      #
      # pin 11: PA2/ADC2/AIN1/PCINT2
      #
      self.shape = add(self.shape,translate(pad_SOICN,.12,0,0))
      self.pad.append(point(.12,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA2'))
      #
      # pin 12: PA1/ADC1/AIN0/PCINT1
      #
      self.shape = add(self.shape,translate(pad_SOICN,.12,.050,0))
      self.pad.append(point(.12,.05,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA1'))
      #
      # pin 13: PA0/ADC0/AREF/PCINT0
      #
      self.shape = add(self.shape,translate(pad_SOICN,.12,.1,0))
      self.pad.append(point(.12,.1,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA0'))
      #
      # pin 14: GND
      #
      self.shape = add(self.shape,translate(pad_SOICN,.12,.15,0))
      self.pad.append(point(.12,.15,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))

pad_TQFP_h = cube(-.025,.025,-.007,.007,0,0)
pad_TQFP_v = cube(-.007,.007,-.025,.025,0,0)

class ATxmegaE5_TQFP(part):
   def __init__(self,value=''):
      c = .18
      d = 0.8/25.4
      s = 0.004
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: GND
      #
      self.shape = translate(pad_TQFP_h,-c,3.5*d,0)
      self.pad.append(point(-c,3.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1 GND',line=s))
      #
      # pin 2: PA4
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,2.5*d,0))
      self.pad.append(point(-c,2.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA4',line=s))
      #
      # pin 3: PA3
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,1.5*d,0))
      self.pad.append(point(-c,1.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA3',line=s))
      #
      # pin 4: PA2
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,.5*d,0))
      self.pad.append(point(-c,.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA2',line=s))
      #
      # pin 5: PA1
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,-.5*d,0))
      self.pad.append(point(-c,-.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA1',line=s))
      #
      # pin 6: PA0
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,-1.5*d,0))
      self.pad.append(point(-c,-1.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA0',line=s))
      #
      # pin 7: PDI/DATA
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,-2.5*d,0))
      self.pad.append(point(-c,-2.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PDI/DATA',line=s))
      #
      # pin 8: RST/CLOCK
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,-3.5*d,0))
      self.pad.append(point(-c,-3.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST/CLOCK',line=s))
      #
      # pin 9: PC7
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-3.5*d,-c,0))
      self.pad.append(point(-3.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC7',angle=90,line=s))
      #
      # pin 10: PC6
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-2.5*d,-c,0))
      self.pad.append(point(-2.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC6',angle=90,line=s))
      #
      # pin 11: PC5
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-1.5*d,-c,0))
      self.pad.append(point(-1.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC5',angle=90,line=s))
      #
      # pin 12: PC4
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-.5*d,-c,0))
      self.pad.append(point(-.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC4',angle=90,line=s))
      #
      # pin 13: PC3
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,.5*d,-c,0))
      self.pad.append(point(.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC3',angle=90,line=s))
      #
      # pin 14: PC2
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,1.5*d,-c,0))
      self.pad.append(point(1.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC2',angle=90,line=s))
      #
      # pin 15: PC1
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,2.5*d,-c,0))
      self.pad.append(point(2.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC1',angle=90,line=s))
      #
      # pin 16: PC0
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,3.5*d,-c,0))
      self.pad.append(point(3.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC0',angle=90,line=s))
      #
      # pin 17: VCC
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,-3.5*d,0))
      self.pad.append(point(c,-3.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC',line=s))
      #
      # pin 18: GND
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,-2.5*d,0))
      self.pad.append(point(c,-2.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=s))
      #
      # pin 19: PR1
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,-1.5*d,0))
      self.pad.append(point(c,-1.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PR1',line=s))
      #
      # pin 20: PR0
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,-.5*d,0))
      self.pad.append(point(c,-.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PR0',line=s))
      #
      # pin 21: PD7
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,.5*d,0))
      self.pad.append(point(c,.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD7',line=s))
      #
      # pin 22: PD6
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,1.5*d,0))
      self.pad.append(point(c,1.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD6',line=s))
      #
      # pin 23: PD5
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,2.5*d,0))
      self.pad.append(point(c,2.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD5',line=s))
      #
      # pin 24: PD4
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,3.5*d,0))
      self.pad.append(point(c,3.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD4',line=s))
      #
      # pin 25: PD3
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,3.5*d,c,0))
      self.pad.append(point(3.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD3',angle=90,line=s))
      #
      # pin 26: PD2
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,2.5*d,c,0))
      self.pad.append(point(2.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD2',angle=90,line=s))
      #
      # pin 27: PD1
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,1.5*d,c,0))
      self.pad.append(point(1.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD1',angle=90,line=s))
      #
      # pin 28: PD0
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,.5*d,c,0))
      self.pad.append(point(.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD0',angle=90,line=s))
      #
      # pin 29: PA7
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-.5*d,c,0))
      self.pad.append(point(-.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA7',angle=90,line=s))
      #
      # pin 30: PA6
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-1.5*d,c,0))
      self.pad.append(point(-1.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA6',angle=90,line=s))
      #
      # pin 31: PA5
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-2.5*d,c,0))
      self.pad.append(point(-2.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA5',angle=90,line=s))
      #
      # pin 32: AVCC
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-3.5*d,c,0))
      self.pad.append(point(-3.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'AVCC',angle=90,line=s))

class ATmega88_TQFP(part):
   def __init__(self,value=''):
      c = .18
      d = .031
      s = 0.004
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: PD3/PCINT19/OC2B/INT1
      #
      self.shape = translate(pad_TQFP_h,-c,3.5*d,0)
      self.pad.append(point(-c,3.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1 PD3',line=s))
      #
      # pin 2: PD4/PCINT20/XCK/T0
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,2.5*d,0))
      self.pad.append(point(-c,2.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD4',line=s))
      #
      # pin 3: GND
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,1.5*d,0))
      self.pad.append(point(-c,1.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=s))
      #
      # pin 4: VCC
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,.5*d,0))
      self.pad.append(point(-c,.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC',line=s))
      #
      # pin 5: GND
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,-.5*d,0))
      self.pad.append(point(-c,-.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=s))
      #
      # pin 6: VCC
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,-1.5*d,0))
      self.pad.append(point(-c,-1.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC',line=s))
      #
      # pin 7: PB6/PCINT6/XTAL1/TOSC1
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,-2.5*d,0))
      self.pad.append(point(-c,-2.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB6',line=s))
      #
      # pin 8: PB7/PCINT7/XTAL2/TOSC2
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,-3.5*d,0))
      self.pad.append(point(-c,-3.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB7',line=s))
      #
      # pin 9: PD5/PCINT21/OC0B/T1
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-3.5*d,-c,0))
      self.pad.append(point(-3.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD5',angle=90,line=s))
      #
      # pin 10: PD6/PCINT22/OC0A/AIN0
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-2.5*d,-c,0))
      self.pad.append(point(-2.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD6',angle=90,line=s))
      #
      # pin 11: PD7/PCINT23/AIN1
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-1.5*d,-c,0))
      self.pad.append(point(-1.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD7',angle=90,line=s))
      #
      # pin 12: PB0/PCINT0/CLKO/ICP1
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-.5*d,-c,0))
      self.pad.append(point(-.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB0',angle=90,line=s))
      #
      # pin 13: PB1/PCINT1/OC1A
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,.5*d,-c,0))
      self.pad.append(point(.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB1',angle=90,line=s))
      #
      # pin 14: PB2/PCINT2/-SS/OC1B
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,1.5*d,-c,0))
      self.pad.append(point(1.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB2',angle=90,line=s))
      #
      # pin 15: PB3/PCINT3/OC2A/MOSI
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,2.5*d,-c,0))
      self.pad.append(point(2.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB3',angle=90,line=s))
      #
      # pin 16: PB4/PCINT4/MISO
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,3.5*d,-c,0))
      self.pad.append(point(3.5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB4',angle=90,line=s))
      #
      # pin 17: PB5/SCK/PCINT5
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,-3.5*d,0))
      self.pad.append(point(c,-3.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB5',line=s))
      #
      # pin 18: AVCC
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,-2.5*d,0))
      self.pad.append(point(c,-2.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'AVCC',line=s))
      #
      # pin 19: ADC6
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,-1.5*d,0))
      self.pad.append(point(c,-1.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'ADC6',line=s))
      #
      # pin 20: AREF
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,-.5*d,0))
      self.pad.append(point(c,-.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'AREF',line=s))
      #
      # pin 21: GND
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,.5*d,0))
      self.pad.append(point(c,.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND',line=s))
      #
      # pin 22: ADC7
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,1.5*d,0))
      self.pad.append(point(c,1.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'ADC7',line=s))
      #
      # pin 23: PC0/ADC0/PCINT8
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,2.5*d,0))
      self.pad.append(point(c,2.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC0',line=s))
      #
      # pin 24: PC1/ADC1/PCINT9
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,3.5*d,0))
      self.pad.append(point(c,3.5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC1',line=s))
      #
      # pin 25: PC2/ADC2/PCINT10
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,3.5*d,c,0))
      self.pad.append(point(3.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC2',angle=90,line=s))
      #
      # pin 26: PC3/ADC3/PCINT11
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,2.5*d,c,0))
      self.pad.append(point(2.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC3',angle=90,line=s))
      #
      # pin 27: PC4/ADC4/SDA/PCINT12
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,1.5*d,c,0))
      self.pad.append(point(1.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC4',angle=90,line=s))
      #
      # pin 28: PC5/ADC5/SCL/PCINT13
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,.5*d,c,0))
      self.pad.append(point(.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC5',angle=90,line=s))
      #
      # pin 29: PC6/-RESET/PCINT14
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-.5*d,c,0))
      self.pad.append(point(-.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC6',angle=90,line=s))
      #
      # pin 30: PD0/RXD/PCINT16
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-1.5*d,c,0))
      self.pad.append(point(-1.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD0',angle=90,line=s))
      #
      # pin 31: PD1/TXD/PCINT17
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-2.5*d,c,0))
      self.pad.append(point(-2.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD1',angle=90,line=s))
      #
      # pin 32: PD2/INT0/PCINT18
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-3.5*d,c,0))
      self.pad.append(point(-3.5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD2',angle=90,line=s))

class ATmega644_TQFP(part):
   def __init__(self,value=''):
      c = .235
      d = .031
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: PB5/PCINT13/MOSI
      #
      self.shape = translate(pad_TQFP_h,-c,5*d,0)
      self.pad.append(point(-c,5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'*MOSI (1)'))
      #
      # pin 2: PB6/PCINT14/MISO
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,4*d,0))
      self.pad.append(point(-c,4*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'MISO'))
      #
      # pin 3: PB7/PCINT15/SCK
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,3*d,0))
      self.pad.append(point(-c,3*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCK'))
      #
      # pin 4: -RESET
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,2*d,0))
      self.pad.append(point(-c,2*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'-RESET'))
      #
      # pin 5: VCC
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,d,0))
      self.pad.append(point(-c,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))
      #
      # pin 6: GND
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,0,0))
      self.pad.append(point(-c,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 7: XTAL2
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,-d,0))
      self.pad.append(point(-c,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'XTAL2'))
      #
      # pin 8: XTAL1
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,-2*d,0))
      self.pad.append(point(-c,-2*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'XTAL1'))
      #
      # pin 9: PD0/PCINT24/RXD0
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,-3*d,0))
      self.pad.append(point(-c,-3*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RXD0'))
      #
      # pin 10: PD1/PCINT25/TXD0
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,-4*d,0))
      self.pad.append(point(-c,-4*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'TXD0'))
      #
      # pin 11: PD2/PCINT26/INT0
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,-c,-5*d,0))
      self.pad.append(point(-c,-5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD2'))
      #
      # pin 12: PD3/PCINT27/INT1
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-5*d,-c,0))
      self.pad.append(point(-5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD3'))
      #
      # pin 13: PD4/PCINT28/OC1B
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-4*d,-c,0))
      self.pad.append(point(-4*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD4'))
      #
      # pin 14: PD5/PCINT28/OC1A
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-3*d,-c,0))
      self.pad.append(point(-3*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD5'))
      #
      # pin 15: PD6/PCINT30/OC2B/ICP
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-2*d,-c,0))
      self.pad.append(point(-2*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD6'))
      #
      # pin 16: PD7/PCINT31/OC2A
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-d,-c,0))
      self.pad.append(point(-d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PD7'))
      #
      # pin 17: VCC
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,0,-c,0))
      self.pad.append(point(0,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))
      #
      # pin 18: GND
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,d,-c,0))
      self.pad.append(point(d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 19: PC0/PCINT16/SCL
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,2*d,-c,0))
      self.pad.append(point(2*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC0'))
      #
      # pin 20: PC1/PCINT17/SDA
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,3*d,-c,0))
      self.pad.append(point(3*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC1'))
      #
      # pin 21: PC2/PCINT18/TCK
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,4*d,-c,0))
      self.pad.append(point(4*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC2'))
      #
      # pin 22: PC3/PCINT19/TMS
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,5*d,-c,0))
      self.pad.append(point(5*d,-c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC3'))
      #
      # pin 23: PC4/TDO/PCINT20
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,-5*d,0))
      self.pad.append(point(c,-5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC4'))
      #
      # pin 24: PC5/TDI/PCINT21
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,-4*d,0))
      self.pad.append(point(c,-4*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC5'))
      #
      # pin 25: PC6/TOSC1/PCINT22
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,-3*d,0))
      self.pad.append(point(c,-3*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC6'))
      #
      # pin 26: PC7/TOSC2/PCINT23
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,-2*d,0))
      self.pad.append(point(c,-2*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PC7'))
      #
      # pin 27: AVCC
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,-d,0))
      self.pad.append(point(c,-d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'AVCC'))
      #
      # pin 28: GND
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,0,0))
      self.pad.append(point(c,0,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 29: AREF
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,d,0))
      self.pad.append(point(c,d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'AREF'))
      #
      # pin 30: PA7/ADC7/PCINT7
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,2*d,0))
      self.pad.append(point(c,2*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA7'))
      #
      # pin 31: PA6/ADC6/PCINT6
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,3*d,0))
      self.pad.append(point(c,3*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA6'))
      #
      # pin 32: PA5/ADC5/PCINT5
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,4*d,0))
      self.pad.append(point(c,4*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA5'))
      #
      # pin 33: PA4/ADC4/PCINT4
      #
      self.shape = add(self.shape,translate(pad_TQFP_h,c,5*d,0))
      self.pad.append(point(c,5*d,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA4'))
      #
      # pin 34: PA3/ADC3/PCINT3
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,5*d,c,0))
      self.pad.append(point(5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA3'))
      #
      # pin 35: PA2/ADC2/PCINT2
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,4*d,c,0))
      self.pad.append(point(4*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA2'))
      #
      # pin 36: PA1/ADC1/PCINT1
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,3*d,c,0))
      self.pad.append(point(3*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA1'))
      #
      # pin 37: PA0/ADC0/PCINT0
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,2*d,c,0))
      self.pad.append(point(2*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PA0'))
      #
      # pin 38: VCC
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,d,c,0))
      self.pad.append(point(d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VCC'))
      #
      # pin 39: GND
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,0,c,0))
      self.pad.append(point(0,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 40: PB0/XCK0/T0/PCINT8
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-d,c,0))
      self.pad.append(point(-d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB0'))
      #
      # pin 41: PB1/T1/CLKO/PCINT9
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-2*d,c,0))
      self.pad.append(point(-2*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB1'))
      #
      # pin 42: PB2/AIN0/INT2/PCINT10
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-3*d,c,0))
      self.pad.append(point(-3*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB2'))
      #
      # pin 43: PB3/AIN1/OC0A/PCINT11
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-4*d,c,0))
      self.pad.append(point(-4*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB2'))
      #
      # pin 44: PB4/-SS/OC0B/PCINT12
      #
      self.shape = add(self.shape,translate(pad_TQFP_v,-5*d,c,0))
      self.pad.append(point(-5*d,c,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'PB4'))

TSSOP_pad_width = 0.040
TSSOP_pad_height = 0.011
TSSOP_pad_dy = 0.026
TSSOP_pad_dx = 0.120
pad_TSSOP = cube(-TSSOP_pad_width/2.0,TSSOP_pad_width/2.0,-TSSOP_pad_height/2.0,TSSOP_pad_height/2.0,0,0)

class TRC102(part):
   #
   # RFM TRC102 ISM transceiver
   #
   def __init__(self,value=''):
      self.value = value
      self.pad = [point(0,0,0)]
      self.labels = []
      #
      # pin 1: SDI
      #
      self.shape = translate(pad_TSSOP,-TSSOP_pad_dx,3.5*TSSOP_pad_dy,0)
      self.pad.append(point(-TSSOP_pad_dx,3.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1 SDI'))
      #
      # pin 2: SCK
      #
      self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,2.5*TSSOP_pad_dy,0))
      self.pad.append(point(-TSSOP_pad_dx,2.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCK'))
      #
      # pin 3: nCS
      #
      self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,1.5*TSSOP_pad_dy,0))
      self.pad.append(point(-TSSOP_pad_dx,1.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'nCS'))
      #
      # pin 4: SDO
      #
      self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,0.5*TSSOP_pad_dy,0))
      self.pad.append(point(-TSSOP_pad_dx,0.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDO'))
      #
      # pin 5: IRQ
      #
      self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,-0.5*TSSOP_pad_dy,0))
      self.pad.append(point(-TSSOP_pad_dx,-0.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IRQ'))
      #
      # pin 6: DATA/nFSEL
      #
      self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,-1.5*TSSOP_pad_dy,0))
      self.pad.append(point(-TSSOP_pad_dx,-1.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DATA'))
      #
      # pin 7: CR
      #
      self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,-2.5*TSSOP_pad_dy,0))
      self.pad.append(point(-TSSOP_pad_dx,-2.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CR'))
      #
      # pin 8: CLKOUT
      #
      self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,-3.5*TSSOP_pad_dy,0))
      self.pad.append(point(-TSSOP_pad_dx,-3.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CLKOUT'))
      #
      # pin 9: Xtal/Ref
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,-3.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,-3.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Xtal'))
      #
      # pin 10: RESET
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,-2.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,-2.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RESET'))
      #
      # pin 11: GND
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,-1.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,-1.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
      #
      # pin 12: RF_P
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,-0.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,-0.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RF_P'))
      #
      # pin 13: RF_N
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,0.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,0.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RF_N'))
      #
      # pin 14: VDD
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,1.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,1.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VDD'))
      #
      # pin 15: RSSIA
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,2.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,2.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RSSIA'))
      #
      # pin 16: nINT/DDET
      #
      self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,3.5*TSSOP_pad_dy,0))
      self.pad.append(point(TSSOP_pad_dx,3.5*TSSOP_pad_dy,0))
      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'nINT'))

class CBA(part):
   #
   # CBA logo
   #
   def __init__(self,r=.02):
      self.value = ''
      self.pad = [point(0,0,0)]
      self.labels = []
      d = 3*r
      self.shape = cylinder(0,0,0,0,r)
      self.shape = add(self.shape,translate(cylinder(0,0,0,0,r),-d,d,0))
      self.shape = add(self.shape,translate(cube(-r,r,-r,r,0,0),-d,0,0))
      self.shape = add(self.shape,translate(cube(-r,r,-r,r,0,0),-d,-d,0))
      self.shape = add(self.shape,translate(cube(-r,r,-r,r,0,0),0,-d,0))
      self.shape = add(self.shape,translate(cube(-r,r,-r,r,0,0),d,-d,0))
      self.shape = add(self.shape,translate(cube(-r,r,-r,r,0,0),d,0,0))
      self.shape = add(self.shape,translate(cube(-r,r,-r,r,0,0),d,d,0))
      self.shape = add(self.shape,translate(cube(-r,r,-r,r,0,0),0,d,0))

class fab(part):
   def __init__(self,r=.05):
      self.value = ''
      self.pad = [point(0,0,0)]
      self.labels = []
      d = 1.8*r
      l = 3.5*r
      h = r/2.
      self.shape = rectangle(-d,d,-d,d)
      self.shape = subtract(self.shape,circle(0,0,r))
      self.shape = subtract(self.shape,rectangle(-l,0,-h,h))
      self.shape = add(self.shape,rectangle(d,l,-h,h))
      self.shape = add(self.shape,circle(l,0,r))
      self.shape = add(self.shape,circle(-l,0,r))

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# define board
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
width = 1.02 # board width
height = .87 # board height
x = 1 # x origin
y = 1 # y origin
zt = 0 # top z
zb = -0.06 # bottom z
w = .015 # wire width
rv = 0.016 # via size
rp = 0.03 # pad size
mask = .004 # solder mask size
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

pcb = PCB(x,y,width,height,mask)

IC1 = ATtiny44_SOICN('IC1\nt44')
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
pcb = IC1.add(pcb,x+.49,y+.56)

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
V1 = via(zb,zt,rv,rp,'V1')
pcb = V1.add(pcb,IC1.pad[14].x+.08,IC1.pad[14].y+.02)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed

pcb = wire(pcb,w,
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   V1.pad[1],
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   IC1.pad[14])
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

J1 = header_ISP('J1\nISP')
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
pcb = J1.add(pcb,IC1.x+.05,IC1.pad[7].y-.22,angle=90)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

pcb = wire(pcb,w,
   IC1.pad[8],
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   point(J1.pad[1].x,IC1.pad[8].y),
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   J1.pad[1])

pcb = wire(pcb,w,
   IC1.pad[9],
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   point(J1.pad[3].x,IC1.pad[9].y),
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   J1.pad[3])
   
pcb = wire(pcb,w,
   IC1.pad[7],
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   point(IC1.pad[7].x,J1.y+.02),
   point(IC1.pad[7].x+.04,J1.y-.02),
   point(J1.pad[4].x,J1.y-.02),
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   J1.pad[4])
   
pcb = wire(pcb,w,
   IC1.pad[4],
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   point(J1.pad[5].x,IC1.pad[4].y),
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   J1.pad[5])

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
V2 = via(zb,zt,rv,rp,'V2')
pcb = V2.add(pcb,J1.pad[2].x+.075,J1.pad[2].y)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
pcb = wire(pcb,w,
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   V2.pad[1],
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   J1.pad[2])
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
V3 = via(zb,zt,rv,rp,'V3')
pcb = V3.add(pcb,J1.pad[6].x-.075,J1.pad[6].y)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

pcb = wire(pcb,w,
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   V3.pad[1],
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   J1.pad[6])

pcb = wire(pcb,w,
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   V3.pad[2],
   V1.pad[2])
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed

J2 = header_FTDI('J2 FTDI')
pcb = J2.add(pcb,x+width-.22,IC1.y-.0,angle=0)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

pcb = wire(pcb,w,
   IC1.pad[13],
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   point(IC1.pad[13].x+.105,IC1.pad[13].y),
   point(IC1.pad[13].x+.105,J2.pad[4].y),
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   J2.pad[4])

pcb = wire(pcb,w,
   IC1.pad[12],
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   point(IC1.pad[12].x+.07,IC1.pad[12].y),
   point(IC1.pad[12].x+.07,J2.pad[5].y+.04),
   point(IC1.pad[12].x+.11,J2.pad[5].y),
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   J2.pad[5])

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
V4 = via(zb,zt,rv,rp,'V4')
pcb = V4.add(pcb,J2.pad[3].x+.1,J2.pad[3].y)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed

pcb = wire(pcb,w,
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   V4.pad[1],
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   J2.pad[3])

pcb = wire(pcb,w,
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   V2.pad[2],
   V4.pad[2])
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
XTAL1 = XTAL_EFOBM('XTAL1\n20 MHz')
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
pcb = XTAL1.add(pcb,IC1.pad[4].x-.2,IC1.pad[13].y+.003,angle=-90)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

pcb = wire(pcb,w,
   IC1.pad[2],
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   point(XTAL1.x+.12,IC1.pad[2].y),
   point(XTAL1.x+.12,XTAL1.pad[1].y),
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   XTAL1.pad[1])

pcb = wire(pcb,w,
   IC1.pad[3],
   XTAL1.pad[3])

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
V5 = via(zb,zt,rv,rp,'V5')
pcb = V5.add(pcb,XTAL1.x-.12,XTAL1.y)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed

pcb = wire(pcb,w,
   XTAL1.pad[2],
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   V5.pad[1])
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed

pcb = wire(pcb,w,
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   V3.pad[2],
   V5.pad[2])
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
R1 = R_1206('R1\n10k');
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
pcb = R1.add(pcb,IC1.pad[1].x,IC1.pad[1].y+.1)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

pcb = wire(pcb,w,
   R1.pad[1],
   IC1.pad[1])

pcb = wire(pcb,w,
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   R1.pad[2],
   point(J1.pad[5].x,R1.y),
   J1.pad[5])

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
V6 = via(zb,zt,rv,rp,'V6')
pcb = V6.add(pcb,R1.pad[1].x-.08,R1.y)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed

pcb = wire(pcb,w,
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   V6.pad[1],
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   R1.pad[1])

pcb = wire(pcb,w,
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   V4.pad[2],
   point(V4.x,V6.y,zb),
   V6.pad[2])
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

C1 = C_1206('C1\n1uF');
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
pcb = C1.add(pcb,IC1.pad[14].x,R1.y)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

pcb = wire(pcb,w,
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   J2.pad[1],
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   C1.pad[2])

pcb = wire(pcb,w,
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   C1.pad[2],
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   V1.pad[1])
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
V7 = via(zb,zt,rv,rp,'V7')
pcb = V7.add(pcb,C1.pad[1].x-.025,C1.y-.06)
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

pcb = wire(pcb,w,
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   V7.pad[1],
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   C1.pad[1])

pcb = wire(pcb,w,
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   V6.pad[2],
   point(V7.x,V6.y,zb),
   V7.pad[2])
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# select output
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

outputs = {}
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
if (output == "top, labels, and exterior"):
   outputs["function"] = add(add(color(Tan,pcb.board),pcb.labels),
      color(White,pcb.exterior))
   outputs["layers"] = [zt]
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
elif (output == "top, labels, holes, and exterior"):
   outputs["function"] = add(add(color(Tan,pcb.board),pcb.labels),
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
      add(color(White,pcb.exterior),color(Blue,pcb.holes)))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   outputs["layers"] = [zt]
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
elif (output == "top, bottom, labels, and exterior"):
   outputs["function"] = add(add(color(Tan,pcb.board),pcb.labels),
      color(White,pcb.exterior))
   outputs["layers"] = [zb,zt]
elif (output == "top, bottom, labels, holes, and exterior"):
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   outputs["function"] = add(add(color(Tan,pcb.board),pcb.labels),
      add(color(White,pcb.exterior),color(Blue,pcb.holes)))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   outputs["layers"] = [zb,zt]
elif (output == "top traces"):
   outputs["function"] = color(White,pcb.board)
   outputs["layers"] = [zt]
elif (output == "top traces and exterior"):
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
   outputs["function"] = color(White,add(pcb.board,pcb.exterior))
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   outputs["layers"] = [zt]
elif (output == "bottom traces reversed"):
   outputs["function"] = color(White,
      reflect_x(pcb.board,2*x+width))
   outputs["layers"] = [zb]
elif (output == "bottom traces reversed and exterior"):
   outputs["function"] = color(White,
      reflect_x(add(pcb.board,pcb.exterior),2*x+width))
   outputs["layers"] = [zb]
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
elif (output == "interior"):
   outputs["function"] = color(White,pcb.interior)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   outputs["layers"] = [zt]
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
elif (output == "exterior"):
   outputs["function"] = color(White,pcb.exterior)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   outputs["layers"] = [zt]
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
elif (output == "holes"):
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   outputs["function"] = color(White,
      subtract(add(pcb.exterior,pcb.interior),pcb.holes))
   outputs["layers"] = [zb]
elif (output == "holes and interior"):
   outputs["function"] = color(White,
      subtract(pcb.interior,pcb.holes))
   outputs["layers"] = [zb]
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
elif (output == "solder mask"):
   outputs["function"] = color(White,pcb.mask)
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
   outputs["layers"] = [zt]
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
else:
   print("oops -- don't recognize output")

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# set limits and parameters
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

border = 0.05
outputs["xmin"] = x-border # min x to render
outputs["xmax"] = x+width+border # max x to render
outputs["ymin"] = y-border # min y to render
outputs["ymax"] = y+height+border # max y to render
outputs["mm_per_unit"] = 25.4 # use inch units
outputs["type"] = "RGB" # use RGB color

Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed
# send output
Neil Gershenfeld (test)'s avatar
Neil Gershenfeld (test) committed
############################################################
Neil Gershenfeld (test)'s avatar
wip
Neil Gershenfeld (test) committed

json.dump(outputs,sys.stdout)