Eagle,ULP per coordinate,ci ho messo mano ma..

ho provato a modificare qualche riga di un ULP: origins.ULP ho un problema con le coordinate

se dal comando info un componete risulta avere origine x=25,5 y=8

dall'ULP risulta x=25,6 y=8,16

notasi che originariamente veniva diviso per 2,54 nel codice,in modo da uscire con le misure in inches

Togliendo questa divisione e altre e tenendomi quindi la posizione in micron o in decimi o centisimi non cambia,ottengo sempre 2,56 e una fila di zeri di varia lunghezza.

Cosa vuol dire?

era

if (isSMD != 0) { real xr, yr; xr = E.x / 10; // x coord in micrometers yr = E.y / 10;

partName[numParts] = E.name; partMirror[numParts] = E.mirror; partPackage[numParts] = E.package.name; partX[numParts] = xr/25.4; partY[numParts] = yr/25.4; partA[numParts] = E.angle; ++numParts; }.

e ora è .. ... if (isSMD != 0) { real xr, yr; xr = E.x ; // x coord in micrometers yr = E.y ;

partName[numParts] = E.name; partValue[numParts]=E.value; partMirror[numParts] = E.mirror; partPackage[numParts] = E.package.name; partX[numParts] = xr; partY[numParts] = yr; partA[numParts] = E.angle; ++numParts; }

eppure è come se perdessein precisione

grazie

Reply to
blisca
Loading thread data ...

"blisca" ha scritto nel messaggio news:l1svrh$l5c$ snipped-for-privacy@speranza.aioe.org...

ecco qui ,risolto,per estrarre le coordinate ho utilizzato la forma u2mm(E.x) ,e sembra corretto- Chi volesse provare salvi la parte sottostante alla fila di asterischi col nome di origins_mm_ita.ulp ,o altro nome .ulp

******************************************************************************************************

/* * $Id: //DukePro/eagle/ulp/origins.ulp#4 $ * $DateTime: 2011/07/23 09:51:45 $ * * This will emit a list of parts with SMD pads and their origins. */ #usage "Produces a CSV list of parts with SMD pads, their orgins," " and whether each is placed on the top of the board or the bottom."

string partName[], partPackage[],partValue[]; real partX[], partY[], partA[]; int partMirror[]; int numParts = 0; real xExtent = 0.0; real yExtent = 0.0;

void CollectPartData(void) { board(B) { int xExtentInt = 0; int yExtentInt = 0;

/* * Look for the wires in the Dimension layer. Identify the largest * X value. */ B.wires(W) { if (W.layer == 20) { if (W.x1 > xExtentInt) xExtentInt = W.x1; if (W.x2 > xExtentInt) xExtentInt = W.x2; if (W.y1 > yExtentInt) yExtentInt = W.y1; if (W.y2 > yExtentInt) yExtentInt = W.y2; } }

// Convert from tenths of micrometers to mils xExtent = xExtentInt / 1; yExtent = yExtentInt / 1;

B.elements(E) { int isSMD = 0;

isSMD = 0; E.package.contacts(C) { if (C.smd) { isSMD = 1; break; } } if (isSMD != 0) { real xr, yr; xr = 10000*u2mm(E.x) ; // x coord in micrometers yr = 10000*u2mm(E.y) ;

partName[numParts] = E.name; partValue[numParts]=E.value; partMirror[numParts] = E.mirror; partPackage[numParts] = E.package.name; partX[numParts] = xr/10000; partY[numParts] = yr/10000; partA[numParts] = E.angle; ++numParts; } } } }

string listLines[]; void GenListLines(void) { for (int i = 0; i < numParts; ++i) { sprintf(listLines[i], "%s\t%s\t%s\t%s\t%.2f\t%.2f\t%.0f", partMirror[i] ? "bottom" : "top", partName[i], partValue[i], partPackage[i], partX[i], partY[i], partA[i]); } }

void SaveList(void) { string fileName; string assyName; board(BRD) { string assyAttr; string revAttr;

BRD.attributes(ATTR) { if (ATTR.name == "REVISION") revAttr = ATTR.value; if (ATTR.name == "ASSEMBLY") assyAttr = ATTR.value; }

string pn; pn = filesetext(filename(BRD.name), ""); int dashIndex; dashIndex = strchr(pn, '-'); if (dashIndex >= 0) { pn = strsub(pn, 0, dashIndex); }

fileName = filedir(BRD.name) + pn;

if (assyAttr != "") { fileName += "-" + assyAttr; } if (revAttr != "") { fileName += "-Rev" + revAttr; } assyName = filename(fileName); fileName += ".origins.csv"; } fileName = dlgFileSave("Save Part Origins", fileName, "*.origins.csv"); if (fileName) { string a[]; if (!fileglob(a, fileName) || dlgMessageBox(fileName + " exists\n\nOverwrite?", "&Yes", "-&No") == 0) { output(fileName, "wt") {

printf("%s\n", assyName); /*printf("Extents,%.1f,%.1f\n", xExtent, yExtent);*/ printf("layer,nome,valore,package,x,y,angolo\n");

for (int i = 0; i < numParts; ++i) { printf("%s,%s,%s,%s,%.2f,%.2f,%.1f,\n", partMirror[i] ? "bottom" : "top", partName[i], partValue[i], partPackage[i], partX[i], partY[i], partA[i]); } } } } }

CollectPartData(); GenListLines();

int selected = 0; dlgDialog("Part Origins") { string buf; dlgListView("Top/Bottom\tName\tValue\tPackage\tX\tY\tAngle", listLines, selected); dlgHBoxLayout { dlgVBoxLayout { sprintf(buf, "X Extent: %.1f", xExtent); dlgLabel(buf); sprintf(buf, "Y Extent: %.1f", yExtent); dlgLabel(buf);

//dlgLabel("Extents"); //sprintf(buf, "(%.1f %.1f)", xExtent, yExtent); //dlgLabel(buf); } dlgStretch(1); dlgPushButton("&Save...") SaveList(); dlgPushButton("-Close") dlgAccept(); } };

/* vim: set ts=4 sw=4 et ai: */

Reply to
blisca

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.