Assigning components fields after the fact?

Hi forum,

Say that I have a schematic in which I forgot or somehow neglected to populate the fields of components — I know: a rookie mistake! (I’m at best making the transition from beginner to an “early intermediate” user, with KiCAD 5)

More specifically, the mistake was: for decoupling capacitors (something like 40+ of them), I did start placing one and assigning value = 0.1uF, then copy-n-pasted. Just thinking in terms of grouping them together in the generated BOM. I should have — but didn’t — populated MPN and Digikey part number fields in that initially placed capacitor.

Hacking into the .sch file, and looking at the file format doc, I can more or less easily add those fields (read: I can write a quick program/script that does it, or possibly I could manage to do it with a search-and-replace in a regex-aware text editor).

My concrete question: is there a built-in way to accomplish this? (or any existing plugins, or standalone programs such as the one I’m thinking of writing?)

To avoid this in the future, the strategy I have in mind is creating custom library symbols — I could have a symbol Decoupling (or specific ones, such as Decoupling_0.1, Decoupling_0.1_402, Decoupling_0.1_603, Decoupling_0.1_25V, etc.), with the fields already in. For resistors, I could have symbols R_pullup_10k, R_pullup_4.7k, … , or simply the combinations of typical values with typical package sizes.

Does the above sound like a reasonable / effective strategy? Do you guys have your own strategy to deal with this? Or simply discipline when creating the schematic?


KiCad V5 has added something in the Tools menu that might help you. “Edit Symbol Fields…”. Here you can cut and paste in a spreadsheet-like interface.


Thanks! This is a great feature!

Hmm, sadly, I have to report that this is rather a very buggy feature — essentially unusable. (I have KiCAD 5.0.1 on Ubuntu 18.04).

The headings get out of sync with the actual data columns — I think the trigger is the horizontal scroll; if I scroll to the right and reduce the width of one of the right-most columns to a point where now all the columns fit without the need for a horizontal scroll bar, then the scroll bar disappears, and what ends up happening is: the headings remain the same way as when I had scrolled to the right (the leftmost heading — reference — no longer shows). However, the column with the references does show. The rest of the columns are simply out of alignment with the headings (horizontally).

Another issue that makes this feature unusable is: I have to reduce some of the columns such as Datasheet and Footprint, that both tend to be extra-wide when they don’t really provide anything useful. But, if I copy-n-paste from a spreadsheet, the widths reset and I need to scroll again. I then noticed that it is only when I copy-n-paste directly from the cell in the spreadsheet, so maybe it copies as a line, including a newline character/sequence at the end; if I copy from the “Cell content” field at the top, then it works. However, cutting (Ctrl-X) a cell from the Edit symbol fields dialog resets the columns width.

*sigh* … back to my idea of writing a script to populate those attributes? :frowning:

Why not deselect the show tickmark for the footprint and datasheet fields if you do not want to see them instead of reducing their width?

I can not reproduce this under ubuntu version 16.04. So this might be related to the gtk stuff.

This i can reproduce under ubuntu 16.04

Well, yeah, agreed for the datasheet — but the footprint, I need to see it to be able to tell whether I’m looking at a, say, 0.1uF in 402 size, or 0.1uF in 603 size.

I think even with the datasheet hidden, the width will exceed the allocated screen size (and I’m using it on a 2560x1440 monitor!!!)

You’re right, that part at least seems to be (or in any case, could be) related to something outside of KiCAD — I cannot reproduce that on my PC at home (running the same version of KiCAD, but on Ubuntu 14.04)

And yes, the other buggy behaviour (Ctrl-X in one of the cells in the Edit fields dialog), that one is also present here on the Ubuntu 14 system.

You can also do this using KiField.

1 Like

A propos of what @Rene_Poschl mentioned about hiding columns, you can actually select the ‘group by’ footprint button but deselect ‘show’ footprint. The components will then be grouped by footprint - you can quickly check which footprint you are looking at and then hide the column again. By using the disclosure ‘>’ sign, you can expand the group and edit each block of components which share the same footprint.

I agree there do seem to be some problems in selecting some cells (I can only enter some cells using the keyboard arrows) as well as copying & pasting; I will have a look on the bug tracker. I get a repeatable crash if I try and paste back a sheet edited outside of Kicad. Nevertheless, for lightweight bulk editing, this is a very useful feature.

Agree that this can be potentially helpful. For that matter, agreed that for lightweight work this is indeed a good/useful feature. (I wonder whether one could argue that for more serious work one should not need to do this anyway, as one would have had the discipline to get it right up-front?)

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