Here's the Eagle ULP I wrote a couple years ago. Use what you need if there's anything useful in there.
It just does the outline, and I never made a PCB panel with it, but exported the result as DXF to get panels laser cut. Eagle, for all its faults, exports rock-solid DXFs (and Gerbers).
In the parts library I added a new layer (115) to any component poking through the panel (pots, jacks, leds, etc.). In the Eagle PCB editor this generated panel was used as a guide to lay out all the components. Then just had to export layer 115 as a DXF and send to the laser cutter for perfectly fitting panels with no dicking around and worrying about whether the PCB will line up with panel.
Code: Select all
#usage "Create Eurorack panel outline on layer115"
//
// By THX2112
//
string cmd="";
int HP=8;
real base=0;
real offset=.36;
real height=128.5;
real maxPCBheight=112.0;
string realToStr(real number)
{
string retVal = "";
sprintf(retVal, "%f", number);
return retVal;
}
string intToStr(int number)
{
string retVal = "";
sprintf(retVal, "%d", number);
return retVal;
}
string drawLine(real x1, real y1, real x2, real y2)
{
string cmd = "";
cmd += "WIRE (" + realToStr(x1) + " " + realToStr(y1) + ") (" + realToStr(x2) + " " + realToStr(y2) + ");";
return cmd;
}
string drawArc(real x1, real y1, real x2, real y2)
{
string cmd = "";
cmd += "WIRE (" + realToStr(x1) + " " + realToStr(y1) + ") -180 (" + realToStr(x2) + " " + realToStr(y2) + ");";
return cmd;
}
string drawHole(real x, real y)
{
real HoleRadius = 1.6;
real HoleWidth = 1;
string cmd = "";
cmd +=drawArc(x-HoleWidth,y-HoleRadius,x-HoleWidth,y+HoleRadius);
cmd +=drawLine(x-HoleWidth,y+HoleRadius,x+HoleWidth,y+HoleRadius);
cmd +=drawArc(x+HoleWidth,y+HoleRadius,x+HoleWidth,y-HoleRadius);
cmd +=drawLine(x+HoleWidth,y-HoleRadius,x-HoleWidth,y-HoleRadius);
return cmd;
}
int Result = dlgDialog("Enter Parameters") {
dlgHBoxLayout {
dlgLabel("HP");
dlgIntEdit(HP, 1, 50);
dlgStretch(1);
dlgPushButton("+OK") dlgAccept();
dlgPushButton("Cancel") dlgReject();
}
};
// Calculate right side of panel
real width=(HP*5.08)-offset;
// Panel Coordinates
real x1=0;
real y1=0;
real x2=width*1000; // convert units to micrometers
real y2=height*1000;
// Hole Coordinates
real BottomHoles = 3.0;
real TopHoles = 125.5;
real LeftHoles = 7.5;
real RightHoles = ((HP - 3.0) * 5.08) + 7.5;
real HoleRadius = 1.6;
real HoleWidth = 1.6;
real x;
real y;
// Maximum PCB Extents
real RailSpace = (height-maxPCBheight)/2;
real TopExtent = height-RailSpace;
real BottomExtent = base+RailSpace;
// Draw panel and holes
cmd="";
cmd += "GRID MM 1 1;";
cmd += "CHANGE WIDTH 0;";
cmd += "LAYER 115 Panel;";
cmd += "SET COLOR_LAYER 115 WHITE;";
cmd += "SET WIRE_BEND 2;";
cmd +=drawLine(0,0,width,0);
cmd +=drawLine(width,0,width,height);
cmd +=drawLine(width,height,0,height);
cmd +=drawLine(0,height,0,0);
cmd +=drawHole(LeftHoles,BottomHoles);
cmd +=drawHole(LeftHoles,TopHoles);
cmd +=drawHole(RightHoles,BottomHoles);
cmd +=drawHole(RightHoles,TopHoles);
// Draw PCB extent limits
cmd += "CHANGE STYLE SHORTDASH;";
cmd +=drawLine(0,TopExtent,width,TopExtent);
cmd +=drawLine(0,BottomExtent,width,BottomExtent);
cmd += "CHANGE STYLE CONTINUOUS;";
exit(cmd);