The goal of the project is to make a lot of similar components as quickly as possible using python. the first step was to understand how to do a single component using only the command bar.
I'll write this log in the order I discovered commands, not the final order they are used.
- PAD/SMD
the core command needed to create a component will be familiar to anyone who has made their own component in eagle. the PAD command places a through hole connection and the SMD command places a surface mount connection.
the help documentation is pretty good and lists the following information for the SMD command
SMD [x_width y_width] [-roundness] [orientation] [flags] ['name'] •..
boom
And now i can place a pa-wait what is that DOT at the end?? well the documentation tells me that is a mouse click. that isn't very useful for scripting. however, that dot can also be replaced with "(xCoord yCoord)".
now the pad code begins to take shape:
myCMDs=[]
cmdTemplate = "SMD {0:f} {1:f} '{2:s}' ({3:f} {4:f});"
for i in range(1,p+1):
myCMDs.append(cmdTemplate.format(padW,padH,str(i),x,y))
This will create pads named '1', '2',...,'n', x and y locations. Calculating X and Y are relatively straightforward. X will increase by the pin pitch (0.1"), and Y will alternate.
hpitch = 0.1
yPrime = +(padH/2)
yAlt = -(padH/2)
x=0
p=6
for i in range(1,p+1):
if i%2==1:
y=yPrime
else:
y=yAlt
myCMDs.append(cmdTemplate.format(padW,padH,str(i),x,y))
x+=hpitch
The last step in the footprint was to add a quick silkscreen for the plastic part of the header.
cmd1Template = "WIRE .008 ({0:f} {1:f}) ({2:f} {3:f}) ({0:f} {1:f}) ;"
myCMDs.append("LAYER tDocu;")
myCMDs.append("Set Wire_Bend 0;")
myCMDs.append(cmd1Template.format(-.05,0.05,(p)*.1-0.05,-0.05))
myCMDs.append("Set Wire_Bend 4;")
myCMDs.append(cmd1Template.format(-.05,0.05,(p)*.1-0.05,-0.05))
myCMDs.append("write")
This code required a few more Eagle commands:
- LAYER selects what later any wires will be drawn on.
- WIRE_BEND 0 goes Horizontal before Vertical
- WIRE_BEND 4 goes Vertical before Horizontal
- WIRE draws...wires, on the current Layer and supports multi-part lines.
Boom:
One down, 199 to go.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.