I am taking over a project from its creator. It’s a good design but there’s a lot of inconsistency in the schematic symbol drawings and font sizes. Helpfully, all the schematic and footprint symbols were exported to a project library so it’s all self contained.
I would like to update all the symbol drawings and text field properties (size and visibility) so that, for example, all nonpolarized capacitors use the “C” symbol in the Devices library instead of the various ones in the project library. I don’t want to change the any of the field contents, just set them all to the same size, formatting, and visibility across all symbols.
I’m happy to play search-and-replace in a text editor, but I don’t know if I need to do files other than the .kicad_sch, what the search/replace templates should be, and if there are any special things to watch out for. I realize device pin placement could be an issue but I think it won’t be hard to check that after the conversion. I plan to re-export the updated symbols to a new project library when I’m finished. And I know to make backups first.
The simplest method is to first make a list of what settings you want to use (May I suggest the KLC as a reference) and then change the library symbols one by one. After that you can use Schematic Editor / Tools / Update Symbols from Library.
Another method is to:
Create a new project, just for maintaining the library.
Put one instance of each library symbol on the schematic.
Use: Schematic Editor / Edit / Edit Text and Graphic Propierties to modify stuff.
Use: **Schematic Editor / File / Expor / Export Symbols to (New?) Library.
For the last step, I am not sure whether “Export to Library” or “Export to New Library” works best. If a direct export does not work, you can create a new library variant, and then rename the files.
Use Schematic Editor / Tools / Update Symbols from Library in the original project.
Also, especially when the project is complex, I advise to start experimenting on a copy of your project (I assume you already have backups). The Idea is to first get the workflow correct before you start modifying too many symbols.
Thanks for those suggestions! I definitely will keep the KLC in mind. I’m not as worried about getting the text formatting as I can use the global text edit tool for that. The symbols are the more annoying part. I suspect that some parts of the schematic may have been imported from another toolset as the symbols don’t look like anything I’ve seen before in KiCad, and there are at least two different symbols in use for passive capacitors.
[ I just looked at the kicad_sym file and it’s way more complicated than I suggest in the next paragraph. Trying to edit it by hand looks way too hard. So please ignore the following. ]
I don’t know the library schema that well – does the exported project symbol library contain one record for each unique symbol, or one record for each individual component in the schematic? If it’s one per unique symbol, possibly editing that by hand and then doing “update from library” would be an approach.
I will experiment on a backup! I’ve learned that from experience.
You can also standardize towards KiCad’s standard symbols. Just take some suitable symbols from KiCad’s standard libraries, and copy them into your own library. KiCad’s standard libraries already have a pretty consistent style, and you can just adopt it instead of creating your own. If the pitch between pins is different, it does take a bit of work to stretch or shrink the wires to make them fit, but you only have to do that once.
Thanks. I’ve been doing that for some time. This is a project I inherited from someone else so I’m trying to bring it in line with the libraries I normally use, which I derived from the standard KiCad ones (I make a symbol for each commonly used value that includes the LCSC part number for assembly at JLCPCB, but it’s copied from the appropriate one in the standard libraries).
I’m sorry I wasn’t clear – whenever I can I start with the standard KiCad library symbol, modify that, and do a “save as” to my local library under a unique name. I almost never create new symbols from scratch.
The problem I’m trying to address here is that the creator of this schematic used some symbols with different drawings than those in the standard libraries. I suspect they might have been imported from a schematic created with Eagle or some other toolset. For example, there at least three different drawings used for for non-polarized capacitors. I want to replace those with ones based on the standard libraries.
Load a symbol from the standard libraries into the symbol editor.
Save it into your libary.
Update your project from the symbol in it’s library.
Or, if you want to go “completely native”, then just use Schematic Editor / Tools / Edit Symbol Library Links to update the symbols in your project to directly use the standard symbols. You can both change the name and the library at the same time with that tool.
Edit: Changed link from: “Update Symbols” to: “Edit Library Links” (See posts below).
Apart from the “manual” strategy @paulvdh outlined above you can also use a bit of automation here with scripting to update the library links. As all that needs to be changed to get to your target is updating the .kicad_sch files in the project which are text files, this is actually quite simple. you just need as script which searches for the respective library:symbol_name combination and replaces them with the standard_library:desired_symbol. If it makes sense to spend a bit time to create such a script, where the longest part probably is to get the mapping right, depends on how much symbols you need to update. if there is less then 100 probably the manual way is faster.
As long as it’s for a single project, a script is not going to make it faster. The manual method by clicking in KiCad, can change all links of the same symbol type in one go. As a result, most of the time is spent in figuring out the names of the old & new symbol names to be replaced, and that is the same. A script is only going to be faster if you have a lot of projects to convert.
And even then, most of the time is probably spent in verifying the schematic still works. For example, very old KiCad project had bigger resistors. They were 400mill or 500mill long instead of the current 300. In theory you could write a script to fix that too but it would be difficult. Such a script may become practical when the Schematic Editor get’s it’s own scripting interface, but that may take a few years.
Edited – using Tools/Edit Symbol Library Links does just what I need with minimal effort.
In the process I discovered that the length of the symbols was also inconsistent, so I need to extend a bunch of wires, but that’s not a problem.
Original Reply:
Thank you Tojan and paulvdh. This is a one-time problem (I hope) so that qualifies what it makes sense to do.
paulvdh, I don’t see an option to change libraries in “Tools/Update Symbols From Library” but has it been moved to “Tools/Edit Symbol Library Links”? I hadn’t been aware of that tool until I looked just now, and it might be the easiest way to handle this project.
Tojan, it’s probably not worth making a script for this one-off but what you suggest should be possible with sed or a text editor search-and-replace.
As a learning exercise, I’ll spend some time today playing with both options. Thanks very much and I will flag this as answered (if the forum lets me do that).
It’s an oopsie from my side. The function has not been moved, but I got a bit confused by the change of topic in this topic. It went from modifying an existing library to using symbols from another library. And for this second goal the Tools / Edit Symbol Library Links is indeed the right tool. (I’ll edit that now).
Thanks. My fault for being sloppy in the original post. I had it in my head that the exported project library was like the old -cache.lib file and the symbols were there… I’d forgotten that the symbols are now stored in the schematic so the exported library is just a snapshot. Sorry for the confusion that caused.