I'm drawing a schematic in KiCad which has a lot of capacitors and resistors. Now i realised that for the sake of tidyness and to make it easier to read it would be nice to have those caps and resistors replaced for the smaller size symbols. Is there any way to do that without having to go through them one by one?
2 Answers
Replacing symbols
Although KiCad has no specific tool to perform that, you can try the following. Let's say you want to replace all resistor symbols R
with a photo resistor, whose symbol is R_PHOTO
.
Just open your schematic file project.sch
with a text editor, replace all instances of Device:R
with Device:R_PHOTO
, save and close it. Just make sure that the replacement's symbol has the same amount of connections and match the replaced symbol. For resistors and non-polarized capacitors should work just fine.
Replacing footprints
You can use a python library kifield
for that as follows:
- Install the library
pip install kifield
- Copy all fields of a schemactic
project.sch
to acsv
file
kifield -x .\project.sch -i design_fields.csv
- The table should look like the following:
Refs,datasheet,footprint,value
C1,~,Capacitor_SMD:C_0603_1608Metric_Pad1.05x0.95mm_HandSolder,22u
C2,~,Capacitor_SMD:C_0603_1608Metric_Pad1.05x0.95mm_HandSolder,1n
C3,~,Capacitor_SMD:C_0603_1608Metric_Pad1.05x0.95mm_HandSolder,100n
D1,~,custom-footprints:SMA_DO-214AC,SS14
D2,~,LED_SMD:LED_1206_3216Metric_Pad1.42x1.75mm_HandSolder,YELLOW
- Replace let's say the
0603
cap size with an appropriate0805
one using thereplace all
function of any text editor. save and close the csv file.
Refs,datasheet,footprint,value
C1,~,Capacitor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolder,22u
C2,~,Capacitor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolder,1n
C3,~,Capacitor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolder,100n
D1,~,custom-footprints:SMA_DO-214AC,SS14
D2,~,LED_SMD:LED_1206_3216Metric_Pad1.42x1.75mm_HandSolder,YELLOW
- Import it back into KiCad
kifield -x design_fields.csv -i .\project.sch
Now your footprints should be updated
-
1\$\begingroup\$ The change footprint feature is now built into PCBNew, you don't need any external scripting. \$\endgroup\$– awjloganCommented May 7, 2020 at 8:53
-
1\$\begingroup\$ @awjlogan I was not aware of it. Thanks for the info. \$\endgroup\$ Commented May 7, 2020 at 8:53
-
\$\begingroup\$ I'm also afraid the schematic change by find/replace doesn't work - that was my first thought too, but it only works if both of the symbols' connection nodes are in the same place. \$\endgroup\$– awjloganCommented May 7, 2020 at 9:05
-
\$\begingroup\$ @awjlogan What do you mean by both of the symbols's connection nodes are in the same place? I might have overlooked something, but I ran a small test and it seemed to work. I had some resistors replaced in a schematic of my own. \$\endgroup\$ Commented May 7, 2020 at 9:08
-
1\$\begingroup\$ @awjlogan got it. You are right. Just double checked it. Thanks again. \$\endgroup\$ Commented May 7, 2020 at 9:21
There is a tool in eeschema: tools -> edit symbol library references.
This allows you to change the referenced symbol for symbols. However, be aware that if the pin positions of the two symbols differ then you will need to fix up the schematic afterwards.
For changing footprint assignments on mass use either the assign footprint tool (you can select multiple symbols to change with shift click) or the field editor. Both are found in the tools menu.