#usage "<b>Solder link outside the PADs</b><p>\n"
"Puts squares on tRestict layer around all PADs for solder link outside the PADs<p>\n"
"Usage: Run 'SolderLinkOutsidePADs.ulp' first, then Run 'LockPADs.scr'.<p><p>\n"
"<author>UPDATED2009, Previous Code Marc Hoppenbrouwers (marckyh@dds.nl)<p>\n"
"Original source: 0V_RESTR.ULP by Daemon Reinhard</author>\n"
/* SolderLinkOutsidePADs.ulp
This EAGLE User Language Program puts RECTs on the "tRestrict" layer around all the pads.
You may want this if you want to make a double-sided board, but only want to
solder link outside the pads.
In a board editor window you can Run only this ULP.
Thereafter execute the script text - file "LockPads.scr".
This ULP is only a slight adaptation from the obsolete '0V_restr.ulp'->'restrict.ulp'->'restrict-40.3.ulp'.
It now runs
in Eagle 5.x and includes all connected pads. In Eagle v4.1 the User Language constants PAD_SHAPE_XLONGOCT
and PAD_SHAPE_YLONGOCT have been replaced with PAD_SHAPE_LONG, and the new constant PAD_SHAPE_OFFSET
has been introduced due to which slight modification was needed in the old script. No support for
elongation factor other than 100 is available in this script.
*/
if ( board )
board( B ) {
string s = path_scr[0] + '/' + "LockPADs";
string fileName = dlgFileSave( "Save File", s, "*.scr" );
if (fileName == "" ) exit(0);
output( fileName ) {
int cnt2 = 0;
int cnt = 0, coordx[], coordy[], ydiameter[], xdiameter[];
B.signals(S) {
numeric string Part[], Pad[];
S.contactrefs(C) {
Part[cnt] = C.element.name;
Pad[cnt] = C.contact.name;
coordx[cnt] = C.contact.x;
coordy[cnt] = C.contact.y;
B.elements(E) {
if (E.name == C.element.name) {
E.package.contacts(CC) {
if ((CC.name == Pad[cnt]))
if ((CC.pad) && !(CC.smd)) {
if (CC.pad.shape[LAYER_TOP] == PAD_SHAPE_ROUND || CC.pad.shape[LAYER_TOP] == PAD_SHAPE_SQUARE
|| CC.pad.shape[LAYER_TOP] == PAD_SHAPE_OCTAGON) {
ydiameter[cnt] = CC.pad.diameter[LAYER_TOP];
xdiameter[cnt] = CC.pad.diameter[LAYER_TOP];
cnt++;
}
if (CC.pad.shape[LAYER_TOP] == PAD_SHAPE_LONG) {
if(CC.pad.angle == 0 || CC.pad.angle == 180) {
ydiameter[cnt] = CC.pad.diameter[LAYER_TOP];
xdiameter[cnt] = CC.pad.diameter[LAYER_TOP]*2;
cnt++;
}
else {
ydiameter[cnt] = CC.pad.diameter[LAYER_TOP]*2;
xdiameter[cnt] = CC.pad.diameter[LAYER_TOP];
cnt++;
}
}
}
}
}
}
}
}
int cnt1 = 0; int x1[]; int y1[]; int x2[]; int y2[];
for(cnt1 = 0; cnt1 < cnt; cnt1++) {
x1[cnt1] = u2mil(coordx[cnt1]) - u2mil(xdiameter[cnt1])/2;
y1[cnt1] = u2mil(coordy[cnt1]) - u2mil(ydiameter[cnt1])/2;
x2[cnt1] = u2mil(coordx[cnt1]) + u2mil(xdiameter[cnt1])/2;
y2[cnt1] = u2mil(coordy[cnt1]) + u2mil(ydiameter[cnt1])/2;
}
/* SCRIPT - DATEI */
printf("# Solder link outside the PADs\n");
printf("grid mil;\n");
printf("ch layer 41;\n");
for(cnt1 = 0; cnt1 < cnt; cnt1++)
printf("rect (%d %d) (%d %d);\n",x1[cnt1], y1[cnt1], x2[cnt1], y2[cnt1]);
printf("grid last;\n");
printf("grid last;\n");
}
}
else {
dlgMessageBox("\n Run this ULP only in a BOARD Window \n");
}