Open gh-jmg opened 6 years ago
This rough code works around the Select Copper Connection issue, which is awaiting a fix. It can get slow on large datasets, as it sweeps 2 axes, multiple times.
# Select Copper Connection fails to follow-over PADS where LAYER changes, so add a fix to walk along the nets
for ftrk in trks:
if TagNetName == ftrk.GetNetname():
NetTrackSet.append(ftrk) # Collect a list of ALL nets tracks - this includes Vias
NetCount = NetCount + 1
print '# Net name : %s , Possible Seg/Via : %s '%(TagNetName, NetCount)
LastPass = -1
TstCount = 0
while NewCount != LastPass: # repeat until no more found, ie NewCounts stops increasing
LastPass = NewCount
for ntrk in NetTrackSet: # some selected, some not..
if ntrk.IsSelected(): # seed tree expansion by Selected flag
sS = ntrk.GetStart() # Get this selected Start,End co-ordinates
sE = ntrk.GetEnd()
for mtrk in NetTrackSet: # Scan all other nodes
TstCount = TstCount + 1 # this number can eget large very quickly eg Net name : GND , Possible Seg/Via : 144 Track Segs Added 30 tests 48384
if not mtrk.IsSelected(): # Skip if selected already
mS = mtrk.GetStart()
mE = mtrk.GetEnd()
if (mS == sS) or (mS == sE) or (mE == sS) or (mE == sE) :
NewCount = NewCount + 1
mtrk.SetSelected() # join new touch
print '#Track Segs Added %s tests %s '%(NewCount,TstCount)
.. and the good news, is the bug reported https://bugs.launchpad.net/kicad/+bug/1789807 where Select Copper Connection failed to 'follow over' a pad where layer changed, is now fixed.
Fixed in revision 9eec296b0a0d9e9ff6a152aa1ef91d7ae92920dc https://git.launchpad.net/kicad/patch/?id=9eec296b0a0d9e9ff6a152aa1ef91d7ae92920dc Changed in kicad: status: Triaged → Fix Committed assignee: nobody → Seth Hillbrand (sethh)
So that last slower code is not strictly needed, unless you want to allow any single segment select, to be enough to seed the selection ? (or want it to work on older KiCads )
With a properly working Select Copper Connection, that code should exit with nothing to do, after 1 x 2 axis pass.
Request: can ‘Disconnect airwires from pads’ also act as a split-net command, where someone selects N segments of a NET, but not the whole net. Usually one split keeps the old net name, and a new net name is assigned to now isolated connection set. PADS and Vias touched would have that new net name applied.
One use case, is in manual duplicate of a cell array, where currently that slavish clones all net names where exact clones may not be desired. Being able to split some routed nets, after clone, would be useful. eg keep GND +3V, but make some local by removing the rats-connection due to same-net-name.
Code example below collects selected TRACK items, and then collects PADS of that Netname, and tests for PADs touching selected segments. End outcome is a selected set (trk/via/PAD), ready for NET split rename.
Other issue - I've raised a BUG report in KiCad PCB as to work best, this will need a fix made to Select Copper Connection. https://bugs.launchpad.net/kicad/+bug/1789807
Currently, KiCad menu Select Copper Connection 'travels over' & selects vias in the sub-group, and can travel-over a PAD but fails if entry/exit traces are on different layers. My thinking here, is Select Copper Connection should work like a multimeter, and via is the same as a pad.
I did find a workaround, which is to manually Shft-Clk select one segment in each PAD fragmented sub-net, and then 'I' will collect all the Select Copper Connections. A little klunky and error prone.
`