When using KiCad to create a circuit schematic and then a PCB layout, you have to associate the schematic components with their PCB footprints. After finishing on the schematic and generating a netlist file, you have to run CvPcb to associate components and footprints which are in the .pretty library files. These files have to be retrieved from KiCad’s github repository which takes a lot of time especially when you have a slow Internet connection. In addition, if you don’t have a connection, then accessing the footprints becomes impossible. It’s therefore better to have these files offline on your computer. To do so, follow the steps below.
- Navigate to your home folder
cd ~/
- Get library-repos-install.sh library installer script from KiCad source mirror.
wget https://raw.githubusercontent.com/KiCad/kicad-source-mirror/master/scripts/library-repos-install.sh
- Run the following commands to install required packages :
sudo chmod +x library-repos-install.sh ./library-repos-install.sh --install-prerequisites
Then download library sources from github to your library-repos folder:
./library-repos-install.sh --install-or-update
This takes a while.
After doing this, the library files are all now at ‘/home/username/kicad_sources/library-repos’ .Then there is the error “unable to parse URL….” whenever CvPcb is launched, and so the components cannot be associated with their footprints.
- To solve this error:
- Close the error window (press esc key)
- Go to preferences, Footprint Libraries
- Click on Remove Library until all the rows under Nickname and Library Path are deleted then click OK.
- Under Preferences, click on Configure Paths. A table containing paths and their names should appear.
Select KIGITHUB and delete it from the table then click on ‘Add’.
Under Name, type in a name of your choice that starts with ‘KI’ in upper case.
Under Path, type in the path to the directory ‘/home/username/kicad_sources/library-reposโ then click on ‘OK’ - On the terminal, navigate to the fp-lib-table
sudo chmod +x /usr/share/kicad/template/fp-lib-table gedit /usr/share/kicad/template/fp-lib-table
- Copy the content in the fp-lib-table and paste it in /home/username/.config/kicad/fp-lib-table
- Since we are using a local repository for our libraries and not github, in ‘/home/username/.config/kicad/fp-lib-table’ replace the text ‘type Github’ with ‘type KiCad’ and ‘uri ${KIGITHUB}’ with ‘uri ${KINAME}’ where ‘NAME’ in ‘KINAME’ is the name you assigned your path in the Configure Paths table, Step 4.4.
These changes should me made throughout the entire file, /home/username/.config/kicad/fp-lib-table. - Save and exit
- You’re done! Close KiCad and run it again. When you run CvPcb the error is gone and the footprints appear in the table and can be associated with the components in the schematic. ๐
[…] redefined by the user. Finally, don’t forget to keep saving your work. You can then go on and associate components with their footprints […]
I was using this and there is a typo in the second command of step 3, ‘_’ instead of ‘-‘. Also, you need to ‘chmod +x’ the script before running it ๐ . I also realized that this command uses kicad_sources folder in your home directory no matter where you run it from ๐ may be it was updated.
I corrected the typo and added the ‘chmod +x’ in step 3, thank you for pointing that out. I ran the command again and realized the same thing too, about the kicad_sources folder being in my home directory
Then may be step 1 should also be edited to remove all but the first command. That’s necessary now. Then in step 3, edit the path where the libraries will be found accordingly.
I have edited the library paths in step 3 and added the commands necessary for dealing with the ‘fp-lib-table’ in step 4