/* The MIT License (MIT) Copyright (c) 2014 Eric Stevens Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #usage "Show Nets" "

Shows all airwires and traces connected to a selected part, while hiding " "all other airwires. This does NOT work for groups of parts.

" "

Usage:
RUN show-nets [:Part Name] [Signal list]

" "

All arguments are optional.

" "

Any argument beginning with a colon (':') will be considered as the part you " "want to process. If multiple parts are given,
only the last part listed will " "be processed. All other arguments will be considered as signals to " "ignore.

" "

For example, `RUN show-nets :U107 GND +5V` will show all nets connected to " "part U107 except for GND and +5V.

" "

Example eagle.scr entry for adding package editor context items:

" "
BRD:
" "SET CONTEXT;
" "SET CONTEXT ELEMENT 'Show part airwires' 'RUN show-nets';
" "
" "

Copyright © 2014, Eric Stevens " "<estevens05+ulp@gmail.com>

" #require 6.0 string Version = "Version 1.0.0"; string cmd = ""; string show = ""; string part_arg = ""; int except_count = 0; string exception[]; int part_count = 0; string part_ref[]; int skip = 0; int valid_part = 0; cmd = "RATSNEST ! *; RATSNEST"; show = "SHOW"; if (argc >= 2) { for (except_count = 0; except_count < argc - 1; except_count++) { // argv[0] is the ULP name so we need to start at 1 string cmd_arg = argv[except_count + 1]; // If the first char is a colon, treat the argument as the part name if (strsub(cmd_arg, 0, 1) == ":") { part_arg = strsub(cmd_arg, 1); continue; } exception[except_count] += cmd_arg; } } if (board) { board(B) { B.elements(E) { if (strlen(part_arg) > 0) { if (E.name == part_arg) { valid_part = 1; part_count = 1; part_ref[0] = part_arg; } } else { if (ingroup(E)) { part_ref[part_count++] = E.name; valid_part = 1; } } } if (valid_part != 1) { dlgMessageBox(":" + part_arg + " not found on the board."); exit(0); } if (part_count < 1) { dlgMessageBox(":No part selected"); exit(0); } if (part_count > 1) { dlgMessageBox(":This script only works on a single selected part, not " "groups of parts. Sorry.\n\nYou have the following parts in a group:\n" + strjoin(part_ref, '\n')); exit(0); } B.signals(S) { int i; skip = 0; for (i = 0; i < except_count && skip != 1; i++) { if (S.name == exception[i]) { skip = 1; } } if (skip == 1) continue; S.contactrefs(C) { if (C.element.name == part_ref[0]) { cmd += " " + S.name; show += " " + S.name; } } } } } cmd += "; " + show; exit(cmd);