How to find all vias of a specific diameter?

I have a board with about 3000 vias of various sizes.

I noticed that one particular via had a slightly too small via diameter assigned to it likely due to a typo leading to manufacturability issues.

I often copy-paste vias and now I want to check if the board contains any more such vias, but I can’t find a way to filter select vias using their diameter. Specifically: their pad diameter, not their drill diameter.

For example, EasyEDA has the following “Find Similar Object” function which is very helpful in this situation. Is there anything like it in Kicad?

I figured out that I can select all vias, copy them, paste into notepad and then use the notepad search/replace function to look for specific sizes or eliminate specific sizes and look for different ones. But is there an integrated filter select tool in Kicad?

Maybe in Scripting Console something like:

from pcbnew import *
for v in GetBoard().GetTracks():
    if type(v) is PCB_VIA and v.GetWidth() == FromMM(0.61):
        v.SetWidth(FromMM(0.60))
1 Like

I opened the console. When i paste this, I get an error that there are multiple statements.
When pasting as a new file, I don’t know how to run the script.

Also as I understand the script it would modify all the questionable vias to have a given size.

However, it would not indicate if or how many or where these vias were found. I first just want to search for those vias to see if/where they are to understand if it matters for the manufactured board and see what size would be appropriate

Maybe type it instead (only 2 lines):

from pcbnew import *
len([v for v in GetBoard().GetTracks() if type(v) is PCB_VIA and v.GetWidth() == FromMM(0.61)])

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.