Howto select only vias of one size

Hi people,

In my nearly finished layout I want to select all vias with a specific hole size and a specific diameter to change these values: All vias off (0,5/ 0,3) need to be changed to (0,6/ 0,25).
How do I select them?

Version: (5.99.0-10137-ga6c3d74a73)

There’s no such advanced selection filtering even in 5.99. Changing is easy after you have selected them (Edit -> Track & Via…). The best could be to use the python scripting console, but it needs a small script. Something like

import pcbnew
board = pcbnew.GetBoard()
for i in board.GetTracks():
… if (i.GetClass() == ‘VIA’ and i.GetDrill() == 400000 and i.GetWidth() == 800000):
… i.SetDrill(300000)
… i.SetWidth(600000)

I was also looking up Pcb Editor / Edit / Edit Track & Via Properties… when eelik posted.
With that dialog you can filter by net, or by netclass or by layer.

Which prompts me to as:
Do you know how net classes work, and have you used them in your project?
If not, then learn about it. With a netclass, you make a set of rules (track with & clearance, via dimensions, etc) and then you apply those rules to a net, or to multiple nets. Once you’ve set up your nets in net classes properly, your modification is likely also easy.

I use net classes in my project, its quite handy like you mentioned. But I use quite a few net classes and not all my nets are part of net classes.
I just use three different kinds of vias, so in the end I selected them manually by hand and used the dialog up ahead.

I like the scripting idea. Is there some good documentation how to use the pcbnew package with the functions?

Unfortunately not, especially for 5.99 where the API has changed. We are waiting for the new stable API but before that what I gave should work (using the needed values, of course) because I tried it with 5.99. There’s one problem, the changes aren’t updated visibly to the view. IIRC closing and reopening pcbnew will help with that. But make sure you have backups or try first with a copy.

Thanks for fast replys guys. Much appreciated!


If you want to change all the vias in the board to a different size then you can specify the sizes of via in board setup.

Then, from Edit–> Edit tracks and via properties, uncheck all the filters and select the size and click ok.

If you want to change the via size in the same net, check the filter items by the net and select the size.

If you want to change the size of via in the particular class, check the filter items by net class and select the size.