Browse Source

automated panel generation process

fixes #5
fixes #2
master
Julian Daube 4 years ago
parent
commit
e89d1a2a81
6 changed files with 248 additions and 68735 deletions
  1. +3
    -0
      Panel/.gitignore
  2. +0
    -34196
      Panel/SideA.brd
  3. +0
    -34511
      Panel/SideB.brd
  4. +191
    -0
      Panel/genpanel.ulp
  5. +34
    -28
      Panel/jlcpcb.cam
  6. +20
    -0
      Panel/makefile

+ 3
- 0
Panel/.gitignore View File

@@ -0,0 +1,3 @@
*zip
*brd
*#*

+ 0
- 34196
Panel/SideA.brd
File diff suppressed because it is too large
View File


+ 0
- 34511
Panel/SideB.brd
File diff suppressed because it is too large
View File


+ 191
- 0
Panel/genpanel.ulp View File

@@ -0,0 +1,191 @@
/* dieses Program macht die Seitenpanele aus dem Masterboard-design fuer jlcpcb */

string str = "";

// erstellt einen Punkt als string
string Point(real X, real Y)
{
string temp = "";
sprintf(temp, "(%f %f)", X,Y);
return temp;
}

// kopiert eine selektierte Gruppe in die zwischenablage
void cut(real originX, real originY)
{
string temp = "";
sprintf(temp, "GRID mm 1;\nCUT (%f %f);\nGRID last;\nDISPLAY last;\n", originX, originY);
str += temp;
}

// gruppiert elemente in einem rechteck
void group(real upperLeftX, real upperLeftY, real lowerRightX, real lowerRightY)
{
string a = Point(upperLeftX, lowerRightY);
string b = Point(upperLeftX, upperLeftY);
string c = Point(lowerRightX, upperLeftY);
string d = Point(lowerRightX, lowerRightY);
string temp = "";
sprintf(temp, "GROUP %s %s %s %s %s;\n", a,b,c,d,a);
str += temp;
}

// oeffnet ein neues board zum editieren
void edit(string name)
{
string temp = "";
sprintf(temp, "SET CONFIRM YES;\nEDIT %s;\nSET CONFIRM OFF;\n", name);
str += temp;
}

// loescht alle elemente auf einem board
void clearBrd()
{
str += "DISPLAY ALL;\nSET CONFIRM YES;\nRIP;\nGROUP ALL;\nDELETE (C> 0 0);\nSET CONFIRM OFF;\nDISPLAY last;\n";
}

// speichert das board
void write()
{
str += "SET CONFIRM YES;\nWRITE;\nSET CONFIRM OFF;\n";
}

// fuegt letzte kopierte sektion in das board an der gewaehlten stelle ein
void paste(int offset, real originX, real originY)
{
string temp = "";
sprintf(temp, "GRID mm;\nPASTE %d (%f %f);\nGRID last;\n", offset, originX, originY);
str += temp;
}

// zeichnet eine linie mit dicke width
void line(real width, string A, string B)
{
string temp = "";
sprintf(temp, "LINE %f %s %s;\n", width, A, B);
str += temp;
}

// zeichnet eine runde linie zwischen den Punkten A und B
void arc(int width, string A, string B, real angle)
{
string temp = "";
sprintf(temp, "LINE %d %s %f %s;\n", width, A, angle, B);
str += temp;
}

// loescht dinge um gegebenen Punkt
void delete(string atPoint)
{
string temp = "";
sprintf(temp, "DELETE %s;\n", atPoint);
str += temp;
}


// schliesst die outline
void closeBoundary(real radius, real hoehe, real mittelabstand_links, real mittelabstand_rechts)
{
str += "LAYER 20;\nDISPLAY NONE;\nDISPLAY 20;\n";
// setzt das grid auf mm fuer folgende operationen
str += "GRID mm 0.1;\n";

group(0, hoehe - 0.1, 100, 2);
delete("(C> 0 0)");
delete(Point(10, hoehe));
delete(Point(50-10, hoehe));

delete(Point(50+10, hoehe));
delete(Point(100-10, hoehe));

// reproduziere die seitenkanten
line(0, Point( 0, hoehe - radius), "( 0 0)");
line(0, Point(radius, hoehe), Point(25 - mittelabstand_links, hoehe));
line(0, Point(25 + mittelabstand_rechts, hoehe), Point(50 - radius, hoehe));
// reproduziere die abgerundeten ecken
arc(0, Point(0, hoehe - radius), Point(radius, hoehe) , -90);
arc(0, Point(50-radius, hoehe), Point(50, hoehe - radius), -90);
str += "GRID last;\nDISPLAY ALL;\n";
}

// ergaenzt ein Bohrloch
void hole(real drill, string point)
{
string temp = "";
sprintf(temp, "HOLE %f %s;\n", drill, point);
str += temp;
}

// prozessiert eine seite des PCBs
void side(string name, real originX, real originY, real radius, real hoehe, real abstand_l, real abstand_r) {
cut(originX, originY);
edit(name);
clearBrd();

paste(0, 0, 0);
closeBoundary(radius, hoehe, abstand_l, abstand_r);

// sie panele sollen seitensymmetrisch sein
// damit die zerbrochen platine die trennungsartifakte
// immer auf der rechten bzw. linken seite aufweist
str += "GRID mm;\nGROUP ALL;\nCUT (0 0);\nPASTE MR0 (100 0);\n";
// trennungshilfen setzten
real holedrill = 0.5;
real slotwidth = 0.5;
int numholes = 4;
for (int i = 0; i < numholes; ++i)
{
hole(holedrill, Point(50, i));
hole(holedrill, Point(50, hoehe-radius-1-i));
}
str += "LAYER 20;\n";
line(slotwidth, Point(50, hoehe-radius-1-numholes), Point(50, numholes));

// alle dimensionsmarken loeschen
str += "DISPLAY none;\ndisplay 47;\ngroup all;\ndelete (C> 0 0);\ndisplay all;\n";
str += "GRID last;\n";
// fuelle polygone
str += "rats;\n";

// jlc markierung plazieren
str += "LAYER 21;\nCHANGE FONT VECTOR;\nGRID mm;\nCHANGE SIZE 0.8;\nTEXT 'JLCJLCJLCJLC' R180 (98 2);\n";
write();
}

// verhindert, dass das skript auf was anderes als boards angewendet wird
if(board)
board(B){
real radius = 1.5; // radius der abrundungen an der unteren fusskante
real hoehe = 21.2; // hoehe der unteren fusskante
// man merke sich das master-design
// um es spaeter wieder zu oeffnen
string master = B.name;

// maskieren von Seite 1
str += "DISPLAY all;\n";
group(0, 110, 49.5, -10);
side("SideA.brd", 0,0, radius, hoehe, 6.9, 5.7);
// zurueck zum master fuer seite 2
edit(master);
str += "DISPLAY all;\n";
// maskieren von Seite 2
group(50.5, 110, 100, -10);
side("SideB.brd", 50,0, radius, hoehe, 7.3, 5.9);

// master wieder oeffnen
edit(master);

// generierten code als skript zu eagle zurueckgeben
exit(str);
}

dlgMessageBox(":Dies ist kein Board-context!\nBitte das ulp im Masterboard ausfuehren", "O&K");


+ 34
- 28
Panel/jlcpcb.cam View File

@@ -9,31 +9,7 @@
"output_type": "zip",
"outputs": [
{
"filename_prefix": "",
"format_specifier": {
"decimal": 3,
"integer": 3
},
"output_type": "drill",
"outputs": [
{
"drills": {
"NPTH": true,
"PTH": true,
"VIA": true
},
"filename_format": "%N.xln",
"layers": {
"from": 1,
"to": 16
},
"name": "Excellon",
"type": "excellon"
}
]
},
{
"filename_prefix": "CAMOutputs/GerberFiles",
"filename_prefix": "gerber/",
"format_specifier": {
"decimal": 4,
"integer": 3
@@ -156,16 +132,46 @@
"type": "gerber_layer"
}
],
"version": "X2"
"version": "RS274X"
},
{
"filename_prefix": "",
"format_specifier": {
"decimal": 3,
"integer": 3
},
"output_type": "drill",
"outputs": [
{
"drills": {
"NPTH": true,
"PTH": true,
"VIA": true
},
"filename_format": "%N.xln",
"layers": {
"from": 1,
"to": 16
},
"name": "Excellon",
"type": "excellon"
}
]
},
{
"filename_prefix": "assembly",
"output_type": "assembly",
"outputs": [
]
},
{
"filename_prefix": "CAMOutputs/DrawingFiles",
"filename_prefix": "Drawings",
"output_type": "drawing",
"outputs": [
]
}
],
"timestamp": "2019-10-01T18:38:43",
"timestamp": "2019-10-05T00:36:40",
"type": "EAGLE CAM job",
"units": "metric",
"version": "9.2.0"


+ 20
- 0
Panel/makefile View File

@@ -0,0 +1,20 @@
EAGLE ?= /usr/bin/eagle
cwd := $(shell pwd)


all: SideA.zip SideB.zip

%.zip: %.brd
# eagle has no option to run the cam processor with a certain
# job file ...
$(EAGLE) -C "MANUFACTURING CAM;" $<

# generates the panel using the script for eagle
SideA.brd SideB.brd: master.brd
$(EAGLE) -C "RUN $(cwd)/genpanel.ulp; QUIT;" "$<"

master.brd: ../weihnachtsbaum2.0.brd
cp "$<" "$@"

clean:
rm -rf master.brd SideA.brd SideB.brd *.*#*

Loading…
Cancel
Save