📄 fabmaster.ulp
字号:
#usage "<b>Generate EAGLE Output in Fabmaster Format FATF REV 11.1</b><p>\n"
"See program text for more information<p>"
"<author>Author: support@cadsoft.de</author>"
///////////////////////////////////////////////////////////////////////////////////////////
// ASCII Transfer Format (FATF) FABmaster software V8.E - 11 August 2000 //
// FABMASTER FATF REV 11.1 //
// //
// Revision 1.3: Export Wires with Arc, rotated Pads, Pad Shape Long & Offset //
// rotated Packages in 0.1 degree //
// export rectangle and circle on layer 1, 16, 21, 22 //
// export polygon filling on klayer 1, 16 //
// export text on layer 1,16,21,22 as wire (**vector font**) //
// Mai 2004 by support@cadsoft.de //
///////////////////////////////////////////////////////////////////////////////////////////
// Revision 1.2: Slightly changed in the output statement, so that the Fabmaster file //
// will be written in the same directory as the brd file is. //
// November 2001 by support@cadsoft.de //
///////////////////////////////////////////////////////////////////////////////////////////
// Revision 1.1: Runs with EAGLE version >= 4; top pad shape assumed for all layers;
// fixed bug in EAGLE version output
///////////////////////////////////////////////////////////////////////////////////////////
// Rudi Hofer, CadSoft, rudi.hofer@cadsoft.de, 9/99
//
// THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND,
// EXPRESSED OR IMPLIED.
//
// This ULP generates output for FABMASTER software which is able to convert the
// data for automatic mounting and test equipment. The resolution is fixed to 1 mil.
//
// To generate the output, load the board and run this ULP from the board window.
//
// Restrictions and prerequisites:
// - Board outline must be defined as wires in dimension layer (directly in
// board or in a package).
// - All coordinates must be positive!!! Please move the board accordingly!!!
// - Do not use different packages with the same name (avoid REPLACE command).
// - Padtypes octagon, xlongoct, ylongoct are realized with round shapes.
// - For polygons no output is generated.
// - Inner layer Route2..5 may contain tracks.
// - Inner layer Route6 may contain a power plain (no output generated yet!).
// - For all other inner layers no output is generated.
// - On the top and bottom layers only wires and smd pads are output.
// Exception: Circles defined in a package are output as filled circles
// but do not belong to a signal.
//
///////////////////////////////////////////////////////////////////////////////////////////
if (EAGLE_VERSION * 100 + EAGLE_RELEASE < 411) {
string h;
sprintf(h, "Eagleversion %d %d ", EAGLE_VERSION, EAGLE_RELEASE);
dlgMessageBox(h + "This ULP does not run in Eagle Versions older than 4.11", "OK");
exit(0);
}
string jobname,
layer_name[],
padshape[] = {"P_ROUND","P_ROUND","P_ROUND","P_ROUND","P_ROUND"},// if long/offset subst. by round
viashape[] = {"P_BLOCK","P_ROUND","P_ROUND","P_ROUND","P_ROUND"},// if long/offset subst. by round
padname,
shapename[], // package names
t[], // padtypes
pst[]; // padstacktypes
real cx, cy, rx, ry, x, y, x1, x2, y1, y2, r, a1, a2;;
real delta = 5;
int i, new, sx,
padcount,
pad_is_numeric,
// eagle to fabmaster layer conversion
// eagle 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
flayer[] = {0, 2, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 1, 0,16,16, 0, 0, 0,18,19,20,21};
int sizes[], ratio[]; // Text fonts
int cntt = 0;
int boardroundness = 100; // global roundness (design rules)
int xmin = 32000, xmax = 0, ymin = 32000, ymax = 0;
//-----------------------------------------------------
string validname (string s) {
int i;
for (i = 0; s[i]; i++) {
if (s[i] == ',') s[i] = '_';
if (s[i] == ';') s[i] = '_';
if (s[i] == ')') s[i] = '_';
// add further substitutions here
}
return s;
}
//-----------------------------------------------------
int fablayer(int l) {
return flayer[l];
}
//-----------------------------------------------------
int u2u(int x) { // resolution 1/1000 inch
return u2mil(x); // mil
}
//-----------------------------------------------------
real deg2arc(int x) { // degree to arc
return x*PI/180;
}
//-----------------------------------------------------
int u2ang(real x, int mirror) {
if (mirror) {
real m = 360 - x;
if (m > 180) m -= 180;
else m += 180;
x = round((360 - m) * 10); // clockwise in FABMASTER!!!
}
else {
x = round((360 - x) * 10); // clockwise in FABMASTER!!!
}
return x;
}
//----------------------------------------------------
real Xneu(real Xalt, real Yalt, real Xorigin, real Yorigin, real UserWinkel) {
real RADIUS = sqrt(((Xalt - Xorigin) * (Xalt - Xorigin)) + ((Yalt - Yorigin) * (Yalt - Yorigin)));
real WinkelNeu; /* alter Cosinus Winkel = (Xalt - Xorigin) / RADIUS; */
if ((Xalt > Xorigin) && (Yalt >= Yorigin)) { /* Quadrant 1 */
WinkelNeu = acos((Xalt - Xorigin) / RADIUS) * 57.29578 + UserWinkel;
real rad = PI / 180 * WinkelNeu;
return (RADIUS * cos(rad));
}
if ((Xalt < Xorigin) && (Yalt >= Yorigin)) { /* Quadrant 2 */
WinkelNeu = acos((Xalt - Xorigin) / RADIUS) * 57.29578 + UserWinkel;
real rad = PI / 180 * WinkelNeu;
return (RADIUS * cos(rad));
}
if ((Xalt < Xorigin) && (Yalt < Yorigin)) { /* Quadrant 3 */
WinkelNeu = 360 - acos((Xalt - Xorigin) / RADIUS) * 57.29578 + UserWinkel;
real rad = PI / 180 * WinkelNeu;
return (RADIUS * cos(rad));
}
if ((Xalt > Xorigin) && (Yalt < Yorigin)) { /* Quadrant 4 */
WinkelNeu = 360 - acos((Xalt - Xorigin) / RADIUS) * 57.29578 + UserWinkel;
real rad = PI / 180 * WinkelNeu;
return (RADIUS * cos(rad));
}
if ((Xalt == Xorigin) && (Yalt == Yorigin)) { /* Ursprung */
WinkelNeu = (Xalt - Xorigin) + UserWinkel;
real rad = PI / 180 * WinkelNeu;
return (RADIUS * cos(rad));
}
if ((Xalt == Xorigin) && (Yalt > Yorigin)) { /* 90
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -