#usage "en: DesignLink Library Tool\n" "
" "ULP for embedding Farnell and/or Newark order codes and related data to EAGLE library devices." "
" "Usage: run designlink-lbr [-both_oc]|[-sop]\n" "
" "Options:" "
"
"-both_oc: This lets you search both in Farnell and Newark databases and embed both order codes.
\n"
"-sop : Search option package. By default searching for Farnell parts "
"is done with device name and technology. With this option the "
"package name is taken additionally for getting more accurate results.\n"
"
"
"
" "ULP für die Zuweisung von Farnell- und/oder Newark-Ordercodes und verwandte Daten zu EAGLE-Devices." "
" "Usage: run designlink-lbr [-both_oc]|[-sop]\n" "
" "Optionen:" "
"
"-both_oc: Damit können Sie sowohl in der Farnell- als auch in der Newark-Datenbank suchen"
" und Ordercodes zuweisen.
\n"
"-sop : Search option package. Fuer die Produktsuche zu einem Bauteil wird "
"standardmässig der Value verwendet. Mit dieser Option wird mit "
"Value und Packagebezeichnung gesucht, um genauere Ergebnisse zu erzielen.\n"
"
"
"
" +
DS.description;
string image = "";
for (int j = 0; j < (both_oc ? 2 : 1); j++) {
DevSet[NrDev] = DS.name;
DevName[NrDev] = D.name;
DevPkg[NrDev] = D.package.name;
DevTech[NrDev] = t[i];
DevFullName[NrDev] = full_name;
InitFarnellNewark(j);
DevOCIdx[NrDev] = j;
DevOC[NrDev] = NotAssigned;
DevMF[NrDev] = "";
DevMPN[NrDev] = "";
D.attributes(A, t[i])
if ((A.name == DIAttOC) && (A.value != "")) DevOC[NrDev] = A.value;
else if (A.name == DIAttMPN) DevMPN[NrDev] = A.value;
else if (A.name == DIAttMF) DevMF[NrDev] = A.value;
if (DevOC[NrDev] == NotAssigned) {
DevMPN[NrDev] = "";
DevMF[NrDev] = "";
}
DevDesc[NrDev] = description; // lot of memory ?
DevImgLink[NrDev] = image;
DevProdDesc[NrDev] = "";
// For statistic purpose:
if (statistics && (st_idx >= 0))
if (DevOC[NrDev] == NotAssigned) ++st_nr_not_ass;
else if (DevOC[NrDev] != DIUnknown)
if (DevOCIdx[NrDev] == 0) ++st_nr_oc_f;
else ++st_nr_oc_n;
FillDevListRow(NrDev++);
}
}
}
}
}
// Process Statistics
if (statistics) {
string res_file = filedir(st_list) + "stat_lbr.txt";
if (st_idx >= 0) {
output(res_file, "wba")
printf("%-40s:%6d %6d %6d %6d %6d\n", LibName, NrDev/2, st_nr_oc_f, st_nr_oc_n,
NrDev - st_nr_oc_f - st_nr_oc_n, st_nr_not_ass);
st_all_nr_dev += NrDev/2;
st_all_nr_oc_f += st_nr_oc_f;
st_all_nr_oc_n += st_nr_oc_n;
st_all_nr_not_ass += st_nr_not_ass;
}
else
output(res_file, "wt") printf("Library Order Code Statistics.\n\n"
"Name #Devices #Farnell OCs #Newark OCs #Without OCs #Not assigned\n"
"-----------------------------------------------------------------------------------------------------\n");
// Read name of next library:
++st_idx;
string lines[];
int nr_l = fileread(lines, st_list);
int i, idx = -1;
for ( ; (i < nr_l) && (idx < st_idx); ++i)
if ((lines[i] != "") && (strchr(lines[i], '#') == -1)) ++idx;
string next_lbr = ((idx == st_idx) ? lines[--i] : "");
// Run again with next library
if (next_lbr != "") {
string cmd;
sprintf(cmd, "OPEN '%s';RUN '%s' %s%s %s%d %s%d %s%d %s%d %s%d ;", next_lbr, argv[0],
st_opt_list, st_list,
st_opt_idx, st_idx,
st_opt_nr_dev, st_all_nr_dev,
st_opt_nr_oc_f, st_all_nr_oc_f,
st_opt_nr_oc_n, st_all_nr_oc_n,
st_opt_nr_not_ass, st_all_nr_not_ass);
exit(cmd);
}
// Print total numbers
else {
output(res_file, "wba") {
int nr_without = 2 * st_all_nr_dev - st_all_nr_oc_f - st_all_nr_oc_n;
printf("=====================================================================================================\n");
printf("%-40s:%6d %6d %6d %6d %6d\n", "Total absolute", st_all_nr_dev,
st_all_nr_oc_f, st_all_nr_oc_n, nr_without, st_all_nr_not_ass);
printf("%-40s: %3.1f %3.1f %3.1f %3.1f %3.1f \n", "Total percentages", 100.0,
real(st_all_nr_oc_f)/st_all_nr_dev * 100, real(st_all_nr_oc_n)/st_all_nr_dev * 100,
real(nr_without)/(2 * st_all_nr_dev) * 100, real(st_all_nr_not_ass)/(2 * st_all_nr_dev) *100);
printf("=====================================================================================================\n");
}
exit(EXIT_SUCCESS);
}
}
// Master dialog
int save = 1, sel_idx = -1;
int ret = dlgDialog("DesignLink " + tr("Ordercode-Zuweisung - ") + LibName) {
dlgHBoxLayout dlgSpacing(800);
dlgHBoxLayout {
dlgVBoxLayout dlgSpacing(400);
dlgVBoxLayout {
dlgListView(dev_list_head, DevList, sel_idx)
SearchDev(sel_idx);
dlgLabel(tr("Zur Detailansicht oder Suche und Zuweisung eines Artikels bitte Device doppelklicken !"));
dlgHBoxLayout {
dlgStretch(1);
dlgCheckBox(tr("Ordercodes speichern"), save);
dlgPushButton(tr("Exportieren") + "...") {
string file = dlgFileSave(tr("Export als Textdatei"), filesetext(L.name,".txt"));
if (file) output(file, "wt") {
printf("%s\n", dev_list_head);
for (int i = 0; i < NrDev; ++i)
printf("%s\n", DevList[i]);
}
}
dlgPushButton(tr("Beenden")) dlgAccept();
}
}
}
}; // Warum hier der ';' ?
SaveCfg();
if (ret == -1) exit(1);
if (save) {
status(tr("Speichere Ordercodes") + " ..."); // This can take a little time for large files
exit(SaveAttributes());
}
}