/****************************************************************************** * MAKEJUNC.ULP - please send any comments to hv@itec-audio.com * * This EAGLE User Language Program generates a script to insert * junctions in a schematics. The script is written to the directory of the drawing. * * V1.2 xxx Works on all units * * V1.1 16.06.99 Helmut Vaupotitsch - hv@itec-audio.com * Outputs only needed junctions for loaded sheet, added ExitCode * V1.0 Based on mkjunction.ulp by bon@elektron.ikp.physik.tu-darmstadt.de. * * Output-script in MAKEJUNC.SCR * Errorlevel -1: Drawing is not a schematic * *****************************************************************************/ string ScriptFile = "MakeJunc.scr"; enum { OK=0, NotASchematic=-1 }; int ExitCode; /********************/ /* --- HP --- */ /********************/ ExitCode = NotASchematic; if (schematic) schematic(SCH) { ExitCode = OK; output(filedir(SCH.name)+ScriptFile) { // Check for segments that have a known supply name, but are // not connected to any supply pin: // Check for multiple (>2) wires of the same net segment that end at the // same point, but are not visibly connected through a junction: if (sheet) sheet(SH) { // Loaded Sheet // SCH.sheets(SH) { // All Sheets SH.nets(N) { N.segments(S) { int jx[], jy[], NumJunctions = 0; S.junctions(J) { jx[NumJunctions] = J.x; jy[NumJunctions] = J.y; NumJunctions++; } int wx[], wy[], wn[], NumPoints = 0; S.wires(W) { int NewPoint1 = 1, NewPoint2 = 1; for (int i = 0; i < NumPoints; i++) { if (W.x1 == wx[i] && W.y1 == wy[i]) { NewPoint1 = 0; wn[i]++; } if (W.x2 == wx[i] && W.y2 == wy[i]) { NewPoint2 = 0; wn[i]++; } } if (NewPoint1) { wx[NumPoints] = W.x1; wy[NumPoints] = W.y1; wn[NumPoints] = 1; NumPoints++; } if (NewPoint2) { wx[NumPoints] = W.x2; wy[NumPoints] = W.y2; wn[NumPoints] = 1; NumPoints++; } } for (int i = 0; i < NumPoints; i++) { if (wn[i] > 2) { int FoundJunction = 0; for (int j = 0; j < NumJunctions; j++) { if (jx[j] == wx[i] && jy[j] == wy[i]) { FoundJunction = 1; break; } } if (!FoundJunction) printf("junction (%f %f);\n", u2inch(wx[i]), u2inch(wy[i])); } } } } } } } exit(ExitCode);