Physics-Controlled Component Auto-Placer
[Jarrett] recently stumbled upon a class of drawing algorithms called force-directed graphs, which artificially apply forces to the elements. The final graph is then generated by applying the laws of physics and letting the system reach equilibrium. This can often result in a pleasing presentation of things like mind maps and other diagrams without having to hand-place everything. He realized that this approach almost mimics the way he places components when doing a PCB layout. Out of curiosity or intense boredom, we’re not sure which, he decided to implement this in a tool that interacts with KiCad ( see animated GIF below the break ).
He has to ignore certain nets such as power and ground rails, because they distort the result. This simulation treats the nets as springs, and the center of each footprint behaves a charged particle. [Jarrett] added a twist, literally, to the usual implementations — each net pulls on its pin, not the part center, and therefore the chips will both rotate and be pushed around as the system stabilizes.
The results are sometimes quite striking. Useful? Dubious, but maybe!
The project code is up on GitHub, but is very experimental and he is unlikely to carry it further. Among the missing features, the Python code must be tweaked for each different netlist files and other parameters, and there is no way to feed the result back into KiCad. But this is enough for [Jarrett], who only set out to see if the concept was possible. The code is available if anyone wants to try their hand at taking this to the next level.
Post a Comment