Find tracks with a specific width


I’m wondering if is there a way to select tracks with a specific width. I can not find it.
I’m running KiCAD 7.
I’ve a board with mixed tracks width for the same net class and I would like to check it.


What do you want to do after you select them?

I’m wondering if is there a way to select tracks with a specific width.

No, not as builtin function.
Maybe there is a plugin/script available for this task.
(In my personal view this task is very good suited for a plugin solution)

For the future there is a open gitlab issue which adresses your question: Properties Search / Parametric Search (#8390) · Issues · KiCad / KiCad Source Code / kicad · GitLab

in scripting console:

import pcbnew
b = pcbnew.GetBoard()
tracks = b.Tracks()
for t in tracks:
    if t.GetWidth() == pcbnew.FromMM(0.25):

(tested on 8.0.1)


It’s not perfect but you may get what you want depending on your layout and what/how you setup the selection’s…

Example showing two tracks of different Width…, if you want to have/set all of the Tracks in a specific Net at a particular Width, set the Net selection checkbox…

Off-Screen is: File>Edit_Track_Via…

Thanks all.

@ baldengineer
Just checking that I’ve not forget to change some width
@ mf_ibfeew
@ BlackCoffee
I want to select al the tracks not manually as the screencast shows
@ adamws
It seems what I’m searching form but I’m not able to run this. I’ve to investigate. If you have any link that will help me please share it with me.

You can Window-Box Select all of them, or some area of interest. You can use the Panel I show but don’t Check the ‘Only Include Selected’, check the filter by Net, or whatever you want to do…

I get it, but i just want to find which track is 0.2 not to change the width of that tracks.

Your Post title (and text content) say’s “Select” so, I thought you meant ‘Select’. If you meant ‘Find’ then edit your Title/content so other have clarity of what you want…

I’ve edited the post title.

1 Like

I set some of the Track-Segments (they are on different layers) to be 0.2mm Width.

Using the Code posted by @adamws, I changed the Width to ‘search for’ from 0.25 to 0.2

Paste and Run

All of the 0.2mm segments get Highlighted. (somewhat difficult to see after Video Encoding but, they’re selected and Highlighted. Thus, you/user can see what tracks are 0.2mm wide

1 Like

Thank you!
That’s what I need.

My error was pasting the code then running it with the Enter command, with the “paste and run” function I’m able to run it.

… with the “paste and run” function I’m able to run it.

Sorry to be an idiot (it comes naturally to me), but how / where do I find the “paste and run” function?

What I ended up doing after many searches is to put the python commands to run a file as a comment in the file. For this issue, the comment was:

# exec (open (r’C:\Users\MMM\Documents\KiCAD\PythonScripts\’).read(), {“widthMM” : 0.2})

I copy and paste that into the KiPython window/editor (adjusting the “widthMM” as needed) and it works. [I changed adamws’s code to have a parameter.]

Note: it seems the old execfile was removed in Python 3.x. All the examples I had found used it. This caused much weeping and gnashing of teeth.


I am not qualified to tell whether you are an idiot, (or even a natural idiot) but I guess you don’t like video’s. @00:03 Blackcoffee starts the python console, and @00:17 he does a right click and Paste and Run

Maybe screenshots work better for you:

Thank you.

It was the right-click. I usually like videos but for some reason, I get no sound and the click and the handedness of it isn’t obvious to me visually.

I’ll look into the sound issue to reduce my I.Q. (Idiot Quotient) somewhat.


@lkdgironi Perhaps you’ve already hacked my code and made a GUI for it…

If not, Here it is with simple GUI (no Quit button or other stuff) but, can now Repeat with another width to find/highlight and repeat…

The Code: (1.2 KB)


1 Like

Completely (??) different possibility:

1) Make a backup copy of your pcb file.

  1. Identify one such track of interest. Open up the pcb file with a text editor and see if you can identify the text describing what you are looking for.

  2. Use “find” or “find and replace” in the text editor.

I have never used Python and have no idea how to do so. But more than once I have fixed issues in a KiCad file by using my text editor.

I haven’t, so Thanks!
Next step will be a plugin :slight_smile:

Something like this?


That is exaclty what I was looking fot.
Works on 7 and 8 version. Tested on tracks.