def generate_parts(prefix,base_name,no_silk=False): for num in range(2,12+1): A=(num * .118+.144) * 1000 B=((num -1) * .118) *1000 C=(num * .118 + .051) * 1000 print "A=" + repr(A) print "-B/2=" + repr(-B/2) print "C=" + repr(C) c=Component(length=A*100, width=390,no_silk=no_silk) p=Pad(height=115,width=50, clearance=12 , mask=50+30) h=Pin(thickness=95+30,drill=95, clearance=12 , mask=95+12+3) y0=0 c.add_array(PinArray(pin=p, x0=-B/2, y0=y0, spacing=118, num=num, direction=1, prefix="", start_num=1)) c.add_array(PinArray(pin=h, x0= -C/2 , y0= y0- (273 -118/2) , spacing=C, num=2, direction=1, prefix="h")) elmstr= c.generate() write(name=base_name +repr(num) + ".fp", prefix=prefix, elmstr=elmstr)
string += "\tElementLine [" + repr(int( floor(100 * self.length))) + " 0 " + repr( int(floor(100 * self.length))) + " " + repr( int(-100 * floor(self.width))) + " 600]\n" string += "\tElementLine [0 " + repr(int( -100 * floor(self.width))) + " " + repr( int(floor(100 * self.length))) + " " + repr( int(-100 * floor(self.width))) + " 600]\n" string += "\tElementLine [0 " + "-1000" + " " + repr( int(floor(100 * self.length))) + " " + "-1000" + " 600]\n" for a in self.arrays: string += (a.generate()) return string + "\n)" if __name__ == "__main__": prefix = argv[1] for num in range(2, 10 + 1): c = Component(length=(num - 1) * 100 + 95, width=250) p = Pin(thickness=40 + 30, drill=40, clearance=12, mask=40 + 12 + 3) c.add_array( PinArray(pin=p, x0=95 / 2, y0=123, spacing=100, num=num, direction=1, prefix="")) elmstr = c.generate() write(name="KK-100-" + repr(num) + ".fp", prefix=prefix, elmstr=elmstr)
for a in self.arrays: string += (a.generate()) return string + "\n)" if __name__ == "__main__": prefix = argv[1] for num in range(2, 24 + 1, 2): # even pin numbers from 2 to 24 A = (num / 2 * .118 + .144) * 1000 B = ((num / 2 - 1) * .118) * 1000 C = ((num / 2 - 3) * .118 + .067) * 1000 print "A=" + repr(A) print "-B/2=" + repr(-B / 2) print "C=" + repr(C) c = Component(length=A * 100, width=390) p = Pin(thickness=40 + 30, drill=40, clearance=12, mask=40 + 30 + 6) h = Pin(thickness=118 + 30, drill=118, clearance=12, mask=118 + 30 + 6) y0 = 0 numholes = 1 if num > 6: numholes = 2 c.add_array( PinArray(pin=p, x0=-B / 2, y0=y0, spacing=118, num=num / 2, direction=1, prefix="", start_num=num / 2 + 1)) c.add_array(
string+="\tElementLine ["+ pr(-self.length/2) + " " + pr(-self.width/2) + " " + pr(-self.length/2) + " " + pr(self.width/2) + " 1000]\n" string+="\tElementLine ["+ pr(self.length/2) + " " + pr(-self.width/2) + " " + pr(self.length/2) + " " + pr(self.width/2) + " 1000]\n" for a in self.arrays: string+=(a.generate()) return string + "\n)" if __name__== "__main__": prefix=argv[1] for num in range(25,26): # just 25 for now A=2.087 * 1000 B=1.852 * 1000 C=1.512 *1000 offset_1=.652*1000 offset_2= .598*1000 print "A=" + repr(A) print "-B/2=" + repr(-B/2) print "C=" + repr(C) c=Component(length=A*100, width=311*100) p=Pin(thickness=47+30,drill=47, clearance=12 , mask=47+30+6) h=Pin(thickness=120+30,drill=120, clearance=12 , mask=120+30+6) h2=Pin(thickness=150+30,drill=150, clearance=12 , mask=150+30+6) y0=0 c.add_array(PinArray(pin=p, x0=-offset_1, y0=y0 + 112/2, spacing=109, num=num/2 +1, direction=1, prefix="")) c.add_array(PinArray(pin=p, x0=-offset_2, y0=y0-112/2, spacing=109, num=num/2, direction=1, prefix="", start_num=num/2 + 1 +1)) c.add_array(PinArray(pin=h, x0= -1.852/2*1000 , y0= y0, spacing=1.852*1000, num=2, direction=1, prefix="h")) c.add_array(PinArray(pin=h2, x0= -2.4/2*1000 , y0= y0-30, spacing=2.4*1000, num=2, direction=1, prefix="h")) elmstr= c.generate() write(name="DB-25_NORCOMP" +".fp", prefix=prefix, elmstr=elmstr)
from sys import argv from ArrayGenerator import PinArray, Pin from WriteComponents import write class Component: def __init__(self, length, width): self.arrays=[] self.length=length self.width=width def add_array(self, array): self.arrays.append(array) def generate(self): string="Element[ \"\" \"\" \"\" \"\" 1000 1000 0 0 0 100 \"\"] (\n" string+="\tElementLine [0 0 " + repr(int(floor(100*self.length))) +" " + "0 600]\n" string+="\tElementLine [0 0 " + "0" +" " + repr(int(-100*floor(self.width))) +" 600]\n" string+="\tElementLine [" + repr(int(floor(100*self.length))) + " 0 " + repr(int(floor(100*self.length))) +" " + repr(int(-100*floor(self.width))) +" 600]\n" string+="\tElementLine [0 " + repr(int(-100*floor(self.width))) + " " + repr(int(floor(100*self.length))) +" " + repr(int(-100*floor(self.width))) +" 600]\n" string+="\tElementLine [0 " + "-1000" + " " + repr(int(floor(100*self.length))) +" " + "-1000" +" 600]\n" for a in self.arrays: string+=(a.generate()) return string + "\n)" if __name__== "__main__": prefix=argv[1] for num in range(2,12+1): c=Component(length=(num-1)*156+126, width=401.5) p=Pin(thickness=70.86+30,drill=70.86, clearance=12 , mask=70.86+12+3) c.add_array(PinArray(pin=p, x0=63, y0=181.1, spacing=156, num=num, direction=1, prefix="")) elmstr= c.generate() write(name="KK-156-" +repr(num) + ".fp", prefix=prefix, elmstr=elmstr)
start_num=2, incr=2)) c.add_array( PinArray(pin=p, x0=-A / 2, y0=y0 + row_spacing / 2, spacing=pitch, num=num / 2, direction=1, prefix="", start_num=1, incr=2)) y_offset = -574.8 # mils x_offset = 383.86 # mils hole_distance = 1.53543307 * 1000 h = Pin(thickness=60, clearance=20, mask=65, drill=38) h2 = Pin(thickness=65, clearance=20, mask=69, drill=42) c.add_array( PinArray(pin=h, x0=-(hole_distance / 2 + x_offset), y0=y0 + hole_distance / 2 - y_offset, spacing=hole_distance, num=2, direction=1, prefix="h")) c.add_array( PinArray(pin=h, x0=-(hole_distance / 2 + x_offset) + hole_distance, y0=y0 - hole_distance / 2 - y_offset, spacing=hole_distance, num=1,
def add_array(self, array): self.arrays.append(array) def generate(self): string="Element[ \"\" \"\" \"\" \"\" 1000 1000 0 0 0 100 \"\"] (\n" string+="\tElementLine ["+ pr(-self.length/2) + " -57700 " + pr(self.length/2) + " -57700" + " 1000]\n" string+="\tElementLine ["+ pr(-self.length/2) + " -57700 " + pr(-self.length/2) + " -24600" + " 1000]\n" string+="\tElementLine ["+ pr(self.length/2) + " -57700 " + pr(self.length/2) + " -24600" + " 1000]\n" for a in self.arrays: string+=(a.generate()) return string + "\n)" if __name__== "__main__": prefix=argv[1] for num in range(2,24+1,2): # even pin numbers from 2 to 24 A=(num/2 * .118+.144) * 1000 B=((num/2 -1) * .118) *1000 C=(num/2 * .118 + .051) * 1000 print "A=" + repr(A) print "-B/2=" + repr(-B/2) print "C=" + repr(C) c=Component(length=A*100, width=390) p=Pad(height=115,width=50, clearance=12 , mask=50+30) h=Pin(thickness=95+30,drill=95, clearance=12 , mask=95+12+3) y0=0 c.add_array(PinArray(pin=p, x0=-B/2, y0=y0, spacing=118, num=num/2, direction=1, prefix="", start_num=num/2 + 1)) c.add_array(PinArray(pin=p, x0=-B/2, y0=y0-182, spacing=118, num=num/2, direction=1, prefix="")) c.add_array(PinArray(pin=h, x0= -C/2 , y0= y0- (455 -118/2) , spacing=C, num=2, direction=1, prefix="h")) elmstr= c.generate() write(name="MicroFit_SMT_Press-2x" +repr(num/2) + ".fp", prefix=prefix, elmstr=elmstr)