# Is it possible to run EagleCad's DRC from a terminal, and pipe the error list to a file?

I currently use EagleCAD to capture my schematics and route my circuit boards. Eagle isn't very pleasant to work with, so I've started working with schematics and boards outside of Eagle's GUI by directly editing the SCH and BRD files; calling Eagle commands from the system command line when needed. (Just to be clear, I mean calling Eagle commands from an external script or a CMD or terminal window, not from the little textbox "command window" inside the Eagle GUI.)

I'd like to be able to handle DRC and ERC from outside of the Eagle GUI, but I'm unsure how. I can, for instance, call the Eagle DRC from the command line with "eaglecon -C DRC;QUIT; [board name]", but this just opens the Eagle GUI, lists any DRC errors in a dialog window inside the GUI, and then closes the GUI. I would like to get the list of DRC errors as text in the command window, so they can be piped to a file.

Any ideas if this is feasible? Thanks

• Ask this questions at EAGLE Exchange in Element14 community. Looking through GUI, scripts and ULPs I do not see such functionality. When you view DRC error list in GUI, it instantly shows the location of the issue on the board, and does not list any location details or elements involved in the table (but I use v6, probably in newer versions it looks differently). – Anonymous Nov 16 '16 at 16:58

Okay, I figured it out (and the anonymous comment pointing out the Eagle Exchange forum helped).

You can't pipe the DRC output by running it directly from the command line, but starting with Eagle 7.x you can access a UL_ERROR object in User Language Programs (ULPs). Cadsoft's ULP manual (v7.2) gives the details. Here is a sample program to print all DRC errors for a given board:

string errstring;
string errlist[];
int errcnt = 0;
finest_unit = 0.000000123031496; //assuming grid is in inches

if (board) {
board(B) {
if (B.checked) {
B.errors(ER) {
if (ER.state == ERROR_STATE_ACTIVE) {
errlist[errcnt++] = errstring;
}
}
}

string filepath = [full path to desired output text file];
output(filepath) {
printf("Grid size=%f\n", B.grid.distance);
printf("Grid unit=%d\n\n", B.grid.unit); //compare to grid constants in manual
for (int i = 0; errlist[i]; ++i){
printf("%s\n", errlist[i]);
}
}
}
}
exit (0);


Save this in (for example) Eagle's ULP directory as foobar.ulp. This can then be called from the command line with something like

eaglecon -C "DRC; RUN ../ULP/foobar.ulp;QUIT;" [full path to board]


The quotes in that command are necessary.