Setting up custom default library fields

I add various custom fields to my symbols. Is there a way of adding them to some sort of template that has them already in for each new symbol?

Simplest solution is to make a schematic symbol called “template”, and start any new schematic symbol by making a copy of that.

You can open any schematic symbol from any library in the schematic symbol editor and then put it in your custom library with a different name. Any symbol can be used as a template for another symbol.

Yea I tend to do this as every resistor makes a new resistor, every capacitor makes a new capacitor etc. I was just wondering if there was a way to start out this way.

… and any of your personal symbols has your own “custom fields”.
The rest is just some pins and graphic lines.
Changing a capacitor into a resistor is just changing the two plates to a rectangle and a default of “R” instead of “C” for the RefDes. Clearing the graphics of an existing symbol is just a single box select and [Del].

Schematic symbols are so simple and easy to manipulate that’s it hardly worth making a fuss about.

2 Likes

Eeschema Preferences -> Field Name Templates lets you specify the names of fields that will be added to every symbol you put in the schematic. The fields will be empty, of course, but at least you don’t have to create them yourself. I use this for fields like Manufacturer, Manufacturer PN, etc. These fields will be in symbols that are added to the schematic, but they aren’t present in the library symbol.

I’m not sure if this is exactly what you’re asking for, though. Sounds like you want to create and fill these custom fields in your library? In that case I’d do what Paul suggests and start your new symbols as a copy of a symbol that already has those fields created. There may be an easier way, but I don’t know it.

3 Likes

Ah I see. So these fields are not in the symbol but show up on symbols once inserted into the schematic? This is not quite what I want as each symbol with have those fields filled in.

Basically I am using KiCad to create wiring loom schematics and i want to insert fields in the library for part numbers of the connector bodies and the amount of pins of various sizes required so that when I pull a BOM off the schematic I get a breakdown of all the parts by part number and how many of each I need to order.

Correct, what I said doesn’t save any information in the library.

To be clear, it is possible to save additional fields/values in your library symbols, it just requires you to add the fields yourself for each library symbol. I would probably start with a “template” connector symbol, edit it to have all the fields you want, and then “save as” for each different kind of connector, adjusting the information accordingly for each connector.

Another approach is to do it with scripts.
Schematic symbols in KiCad are in a pretty simple text format. Some years ago I wanted to experiment a bit with python, and in a single afternoon I wrote a simple python script to generate a library with some 40 connectors.

With such a script you can of course add all the custom fields you want.

You can find the script in:

Some words of caution:
KiCad V6 is now not far away (maybe half a year) and it has significant changes in the file formats especially for schematics, so now is not such a good time to invest time in learning those formats.

Current schematic symbol libraries are a bit weird. You have the symbol itself in a .lib file, and some additional file with auxillary information, I think it’s an .scm file. But I don’t really know what’s in it.

Small typo. The extra data is in a .dcm file.

1 Like

It was not a typo. It was more like lazyness.

To remedy that, I wanted to post a link to “file_formats.pdf” on kicad.org, but it seems to have disappeared there.

But there are plenty of copies sprinkled around on this forum:
https://forum.kicad.info/search?q=%22file_formats.pdf%22

Unfortunately the .dcm format is not in that file (at least the versions I saw). But as stated earlier, with the upcoming changes in V6 the info in that file will not be very relevant for much longer.

2 Likes

You did say “I think”, but since the s and the d keys are next to each other (at least on my US Qwerty keyboard) I assumed it was an errant finger. :wink:

I verified my memory by looking in my KiCad (v5.1.9) library folder and saw the .lib and the .dcm files.

But, no matter. As you mention (and AFAIR), the new library format no longer uses two files for each library with all the data spread across the current .lib and .dcm files combined into a new file format. I don’t recall the new extension, and I’m too lazy to find out right now. :wink:

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