Edit multiple component fields using KiField


#1

Hello all, I am a new user to KiCad. I chose this software to keep all my work open-source, yet take advantage of a powerful tool. So far I am pretty happy.

Editing multiple components with KiCad can be incredibly tedious. I recently found the KiField Python Package and this certainly is the way to go. I created two batch files: one for exporting, and then I can edit the csv file, and the second for importing, and deleting the now defunct csv file. This way I can ensure I don’t overwrite values that I manually set in eeschema.

My Question is this: I created a new field in the csv file called “mfg” for manufacturer part number. I then changed the name two “PartNumber”. Now every component has two fields. It seems that removing columns from the cvs file does not removed the field from each component. Does anybody have a solution for this?

Export csv:
kifield -x TopLevel.sch -r -i Scripts\exportedCom.xlsx
Import csv:
kifield -x Scripts\exportedCom.xlsx -r -i TopLevel.sch
rm Scripts\exportedCom.xlsx


#2

If I recall, KiField is tries to be as inherently safe as possible and therefore will only updated the per the cvs columns listed. It never deletes information. I had a legacy schematic that had parts with a mix of fields, with some fields that were dead as you have. I believe I opened up the .sch file(s) in a text editor (VIM) and did a global find/delete that blew away all the lines containing the field name I no longer wanted. As usual, back everything up before trying anything.


#3

The KiField documentation has a section titled “Removing Fields from a Schematic or Library”. That would be the section to read if you are interested in removing fields from a schematic or library.


#4

Brilliant. obviously I should have re-read the directions before posting.

Thanks!


#5

Ah, I mis-read that section. To be clear, that doesn’t just clear the fields, but removes the field from every part’s properties in the schematic?