You are browsing as a guest. Sign up (or log in) to start making projects!

53m 2s logged

YET ANOTHER PCB UPDATE!

yeah i cannot believe im saying this..
i kid you not this is the 4th time i had to rewire everything… FOR ANYONE who gets the same problem where ur diodes and switches get mixed up and ratnested i got this super neat code that u can use inside KiCADs scripter that i’ll paste at the end of this devlog. Overall 0/10 experience maybe because im so ahh at kicad but hey a maybe’s a maybe. peace out

code:
import pcbnew; board = pcbnew.GetBoard(); dx, dy = pcbnew.FromMM(19.1), pcbnew.FromMM(4); exec('switches = [f for f in board.GetFootprints() if f.GetReference().startswith("SW")]\ndiodes = [f for f in board.GetFootprints() if f.GetReference().startswith("D")]\nnet_sw_count = {}\nfor sw in switches:\n for p in sw.Pads():\n n = p.GetNetname()\n if n: net_sw_count[n] = net_sw_count.get(n, 0) + 1\nfor d in diodes:\n d_nets = {p.GetNetname() for p in d.Pads() if p.GetNetname()}\n for sw in switches:\n sw_nets = {p.GetNetname() for p in sw.Pads() if p.GetNetname()}\n shared = d_nets.intersection(sw_nets)\n local_nets = [n for n in shared if net_sw_count.get(n, 0) == 1]\n if local_nets:\n d.SetPosition(pcbnew.VECTOR2I(sw.GetPosition().x + dx, sw.GetPosition().y + dy))\n d.SetOrientation(pcbnew.EDA_ANGLE(90, pcbnew.DEGREES_T))\n break'); pcbnew.Refresh()

0
9

Comments 0

No comments yet. Be the first!