Created
January 12, 2015 16:28
-
-
Save kblomqvist/9029b0c15412bb9d7e3b to your computer and use it in GitHub Desktop.
Eagle configs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Uses ULP from https://raw.githubusercontent.com/Sns22/Eagle_PCB_Libraries/master/Eagle-ulp-files/toggle-layer.ulp | |
Set Drill 0.15; | |
Change Shape Round; | |
ASSIGN C+R 'Route'; | |
ASSIGN A+R 'Ripup'; | |
ASSIGN C+M 'Move'; | |
ASSIGN C+G 'Group'; | |
# Top on/off | |
ASSIGN C+1 'RUN toggle-layer.ulp -U top tOrigins tKeepout tRestrict tDocu tNames tValues tPlace'; | |
ASSIGN C+2 'RUN toggle-layer.ulp Route2'; | |
ASSIGN C+3 'RUN toggle-layer.ulp Route3'; | |
ASSIGN C+4 'RUN toggle-layer.ulp -U bottom bOrigins bKeepout bRestrict bDocu bNames bValues bPlace'; | |
ASSIGN C+A 'RUN toggle-layer.ulp Unrouted'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//EAGLE ULP "toggle-layer.ulp" | |
//(C) 2013-02-21 Cory Henderson | |
#usage "en: <b>Toggle Layer</b><p>" | |
"This program toggles the layers given as arguments<p>" | |
"Usage:<br>" | |
"<tt>RUN toggle-layer [-U] LAYER [LAYER] [LAYER]</tt> ...<p>" | |
"Options:<br>" | |
"<table>" | |
"<tr><td><i>-U</i></td><td>Unison Mode: If multiple <tt>LAYER</tt> " | |
"arguments are included, all are forced to follow the toggle of the" | |
"first argument. If only one argument listed, then no effect." | |
"</td></tr>" | |
"</table><p><hr>" | |
"<b>Notes:</b><ul>" | |
"<li>The <tt>LAYER</tt> argument can be either the layer " | |
"number or the layer name</li></ul><p>" | |
"<author>© 2013-02-21 Cory Henderson</author>" | |
//Declarations and functions | |
int ToggleLayer; | |
int argi = 1; //Current index of argv[] | |
int unison = 0; //Unison mode | |
string layers_on[]; //List of layers to be turned on | |
string layers_off[]; //List of layers to be turned off | |
int n_on = 0; //Current count of layers_on[] | |
int n_off = 0; //Current count of layers_off[] | |
string command="DISPLAY "; //Output command | |
void inspect(UL_LAYER La) { | |
if (ToggleLayer != 0) { //If toggle layer is a number | |
if (La.number == ToggleLayer) { | |
int visible = La.visible; | |
if (visible == 1) { | |
n_off++; | |
layers_off[n_off] = La.name; | |
} | |
else if (visible == 0) { | |
n_on++; | |
layers_on[n_on] = La.name; | |
} | |
if (unison == 1) unison = 2 + visible; //unison=2: Turn all on unison=3: Turn all off | |
} | |
} | |
else { //If toggle layer is a string | |
if (strlwr(La.name) == strlwr(argv[argi])) { | |
int visible = La.visible; | |
if (visible == 1) { | |
n_off++; | |
layers_off[n_off] = La.name; | |
} | |
else if (visible == 0) { | |
n_on++; | |
layers_on[n_on] = La.name; | |
} | |
if (unison == 1) unison = 2 + visible; //unison=2: Turn all on unison=3: Turn all off | |
} | |
} | |
} | |
{ //Main Function | |
if (argc == 0) exit(1); //Exit with errors if no arguments given | |
if (argv[1] == "-U") { //Check for Unison Mode flag | |
unison = 1; //Unison mode active | |
argi++; | |
if (argc == 1) exit(1); //If only one argument given (unison), exit with errors | |
} | |
for (argi;argi <= argc;argi++) { //For each argument... | |
ToggleLayer = strtol(argv[argi]); | |
if (schematic) { | |
schematic(S) | |
S.layers(La) | |
inspect(La); | |
} | |
else if (board) { | |
board(B) | |
B.layers(La) | |
inspect(La); | |
} | |
else if (library) { | |
library(L) | |
L.layers(La) | |
inspect(La); | |
} | |
} | |
string s_on, s_off; | |
if (unison == 0) { | |
for (int i = 1;i <= n_on;i++) s_on = s_on + " " + layers_on[i]; | |
for (i = 1;i <= n_off;i++) s_off = s_off + " -" + layers_off[i]; | |
} | |
else if (unison == 2) { | |
for (int i = 1;i <= n_on;i++) s_on = s_on + " " + layers_on[i]; | |
for (i = 1;i <= n_off;i++) s_on = s_on + " " + layers_off[i]; | |
} | |
else if (unison == 3) { | |
for (int i = 1;i <= n_on;i++) s_off = s_off + " -" + layers_on[i]; | |
for (i = 1;i <= n_off;i++) s_off = s_off + " -" + layers_off[i]; | |
} | |
command = "DISPLAY " + s_on + s_off +";"; | |
exit(command); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment