EAGLE Central Forums
Where the EAGLE community meets. Sponsored by Stratford Digital.

Home » CadSoft Support Forums » eagle.userchat.ger » BOM.ULP
BOM.ULP [message #131187] Mon, 22 November 2010 13:59 Go to next message
juergen.Beuth
Messages: 2
Registered: May 2006
Junior Member
Hallo
gibt es eine ULP für Stückliste, die aus einer Board - Datei
erstellt werden kann.
Dies wäre für Nutzen ganz hilfreich

Danke für die Hilfe
Gruß
Jürgen Beuth
Re: BOM.ULP [message #131204 is a reply to message #131187] Tue, 23 November 2010 10:23 Go to previous message
Grzegorz Zalot
Messages: 712
Registered: November 2004
Senior Member
/*
* This EAGLE User Language Program prints a board's
* Partlist and its "Bill Of Material"
*/

void PartLine(string Name, string Value, string Package, string Library)
{
printf("%-*s %-*s %-*s %s\n",
ELEMENT_NAME_LENGTH, Name,
ELEMENT_VALUE_LENGTH, Value,
PACKAGE_NAME_LENGTH, Package,
Library);
}

int ValueLine(string Quantity, string Value, string Package, string Library, string Parts)
{
return printf("%-4s %-*s %-*s %-*s %s%s",
Quantity,
ELEMENT_VALUE_LENGTH, Value,
PACKAGE_NAME_LENGTH, Package,
LIBRARY_NAME_LENGTH, Library,
Parts, Parts != "" ? "\n" : "");
}

if (board) board(B) {
output(filesetext(B.name, ".bom")) {
printf("%s\n\n", EAGLE_SIGNATURE);
printf("Partlist exported from %s at %s\n\n", B.name, t2string(time()));

PartLine("Part", "Value", "Package", "Library");
printf("\n");

numeric string ename[], evalue[], pname[], lname[];
int cnt = 0, index[];

B.elements(E) {
ename[cnt] = E.name;
evalue[cnt] = E.value;
pname[cnt] = E.package.name;
lname[cnt] = E.package.library;
cnt++;
}
sort(cnt, index, ename);
for (int i = 0; i < cnt; i++)
PartLine(ename[index[i]], evalue[index[i]],
pname[index[i]], lname[index[i]]);
printf("\n");

int n1, n2, i1, i2, offset;
string quantity;

ValueLine("Qty", "Value", "Package", "Library", "Parts");
printf("\n");
sort(cnt, index, evalue, pname, lname, ename);
for (n1 = 0, n2 = 0; ++n2 <= cnt; ) {
i1 = index[n1];
if (n2 < cnt) {
i2 = index[n2];
if (evalue[i1] == evalue[i2] && pname[i1] == pname[i2] && lname[i1] == lname[i2])
continue;
}
sprintf(quantity, "%d", n2 - n1);
offset = ValueLine(quantity, evalue[i1], pname[i1], lname[i1], "");
for (;;) {
offset += printf(ename[i1]);
if (++n1 < n2) {
i1 = index[n1];
offset += printf(", ");
if (offset + strlen(ename[i1]) > 77) {
printf("\n");
offset = ValueLine("", "", "", "", "");
}
}
else
break;
}
printf("\n");
}
}
}

--
Previous Topic: Hole verankern
Next Topic: Bauteil aus einem anderen Plan in meine Lib bernehmen?
Goto Forum:
  


Current Time: Sat Apr 29 19:26:30 GMT 2017