[solved] Newbie - offline files

After an exhaustive search I have decided to use Kicad for my electronic projects.
I have gone through several tutorials. I primarily work with Microchip controllers.

I need to set up files so that I can use Kicad offline. I downloaded all the libs, footprints, etc (~1gb).

-----UPDATED -----

set Kicad directories to
KICAD_PTEMPLATES C:\Users\[user name]\Documents\kicad\template
KIGITHUB https://github.com/KiCad
KISYS3DMOD C:\Users\[user name]\Documents\kicad\packages3d
KISYSMOD C:\Users\[user name]\Documents\kicad\footprint

Also need to set Win OS environment vars to match

docs/kicad/ā€¦

           /Buildingblocks
           /docs & tutorials
           /footprint (.pretty)
           /gerber
           /library (.dcm, .lib)
           /modules (.brd, .equ, .kicad_pcb,)
           /packages3d 
           /parts
           /projects
           /scripts
           /symbols (.sym)
           /template
           /worksheet

Edit C:\Program Files\KiCad\share\kicad\template\kicad.pro
and project .pro file and point to custom library files.
Win OS may need to use forward slashes (unconfirmed).

IMPORTANT : can not have trailing line blanks, or empty lines at end of file!

LibDir=C:/Users/pluto/Documents/kicad/library
[eeschema/libraries]
LibName1=74xgxx
LibName2=74xx
LibName3=audio
LibName4=cmos4000
LibName5=connector
LibName6=connector_icsp
ā€¦

Good question!

I think you have a good tree already. I have a data folder for components, Iā€™m not really concerned about the other bits (you could also add folders for worksheets, scripts etc).

I have folders for components : library, footprints, and packages3d. They all have different handling.

  1. library, symbol libraries. From kicad install, or from github:kicad-library/library
  2. footprints. Download to local disk from github, all the *.pretty repositories.
  3. packages3d. 3d models from kicad install or github:kicad-library/modules/packages3d/

In each case I also have some third party stuff, e.g. Walter Lainā€™s libraries, plus my own stuff.

Configuration in Kicad

  1. Path must be configured for each project, but the ā€œnew projectā€ template can be updated with default system paths.
  2. footprints. Set the KISYSMOD variable to the footprints folder. Configure the system-wide footprint table via Footprint Libraries Wizard to include of you local libs (and delete unwanted ones).
  3. packages3d. Set the variable KISYS3DMOD to your packages3d folder. You may need to change footprints to have the right path to the 3d model.
1 Like

either in cvpcb or pcbnew you can edit the library table in Preferences/Footprint library manager.
OR
if you like editing text files by hand, find out where the fp-lib-table file is located on your machine (a search for fp-lib-table on this forum will show the common location of this file on win/mac/linux).

I would keep the ā€˜Nicknameā€™ field exactly as it is on the github repositories, the Library Path needs to point to your actual .pretty directories (this might be as easy as changing the KIGITHUB variable to point to the root directory of your library collection), and the Plugin Type should be just ā€˜KiCadā€™ for local libraries.

although you have local copies of the libraries on disk, if youā€™ve downloaded them originally with ā€˜git cloneā€™ from github you can still manually update them from github with e.g. ā€˜git pull origin masterā€™ periodically (when you are connected to the internet or otherwise want the latest libs)

HTH

1 Like

per your suggestions
before
KICAD_PTEMPLATES C:\Users\pluto\Documents\kicad\template
KIGITHUB https://github.com/KiCad
KISYS3DMOD C:\Users\pluto\Documents\kicad\modules\packages3d
KISYSMOD C:\Users\pluto\Documents\kicad

after
KICAD_PTEMPLATES    C:\Users\pluto\Documents\kicad\template
KIGITHUB            https://github.com/KiCad
KISYS3DMOD          C:\Users\pluto\Documents\kicad\packages3d
KISYSMOD            C:\Users\pluto\Documents\kicad\footprint

If you go long in KiCAD, you need the following folders, preferably on a data share/drive and not on your os/system drive for more easy backup:

  • symbols (currently .lib files, will become .sweet folders afaik with symbol files .kicad_sym? in them)
  • footprints (.pretty folders which contain .kicad_mod files, which are the footprints)
  • 3d models (suggest similar subfolders as for footprints, models are in .wlr files (VRML), but can be .igs (IGES) or .stp (STEP) in far future (*))
  • projects (folder that contains subfolders - 1 per project, which contain .pro files and all the other files for a project (.sch. lib, .net, etc.pp)
  • python scripts (for the scripts you use/download for KiCAD, this folder needs special hooking to get working with KiCAD)

Thatā€™s the baseline.
On top of this you might want/need/consider:

  • datasheet folder (for footprints at least)
  • how to folder (download guides/tutorials from the web here for kicad)

I donā€™t use pcb templates, donā€™t intend to, so I ignore them.
I once downloaded/got the public footprints, but removed them as I make my own as I go along.
Symbols I got the public ones loaded (still) but never used them, also made my own.
If I werenā€™t so proficient in 3d, I would probably use the public models, but yeah, I also use my own :slight_smile:

If you create gerbers/drill files, create a sub-directory in the project folder and output them into that one, makes it easier to zip them up for fabrication. I use just ā€˜/gerberā€™.

PS: If you look for stuff to download now and digest later:

  • Rheingold Heavy has some articles on BOM and getting KiCAD projects fabrication ready
  • Chris Gammell (Contextual Electronis) youtube channel (I used firefox and DownThemAll extension and stored them locally)
  • get KiCost from github, made by @devbisme
  • as youā€™re on windows, check out the nightly builds if you need/want the bleeding edge, but be prepared for bugs
  • if you need collaboration with mechanical engineers check out StepUP from @maui and get used to have VRML + STEP files at hand for your projects
3 Likes

Thanks for all the help!

My only problem now is I have re-arranged the LIBS quite a bit. For example I have a LIB for resistors because I like to have specific things that I know fits my bench parts and has worked for me in the past.

Where do I edit the default LIBS loaded for a newpcb?

in windows?

C:\Users\JohnDoe\AppData\Roaming\kicad

edit a file called fp-lib-table

PS: and yeah, Iā€™ve got a shortcut where those other folders I wrote above reside that points to that folder in C:, so I can get there fast.

1 Like

Thanks, I had been looking at C:\Program Files\KiCad\share\kicad\template\fp-lib-table

What is the difference?

Dangā€¦ you were asking for the symbol libs, not the footprint reposā€¦ wish there was a more straight forward distinctive naming scheme for this.

The fp-lib-table in the template folder is not used, afaik.

And now, for the symbol libs (in windows):

C:\Program Files\KiCad\share\kicad\template

a file called kicad.pro

This one getā€™s copied/merged with the .pro file that is being created in the project folder, when you make a new one.
Thus thus if you want to change something for an already established project the mcguyver way, you edit the .pro file in the project folder.
And if you got custom libs, you add them to that kicad.pro file there in the template folder, so they are being added each time when you create a new project, without further messing needed in the eeschema library paths window.

PS: I have no clue why some settings are in blabla/Roaming and the others are in blabla/templateā€¦ might be because pcbnew has already been refurbished and eeschema not yet, but I donā€™t knowā€¦

1 Like

GREAT!

Once again thanks for all the help. This gets me goingā€¦

I bought a bottle of whiskey today and now I have a whole night of watching Kicad tutorials ahead of me. I donā€™t learn much with this technique but it sure beats watching presidential candidates on the news.

I donā€™t know if it works for the kicad.pro template lib source file, but an entry for custom libs in the .pro file (which resides in the project folder) looks like this:

LibName2=E:/Data_KiCAD/_KiCAD_Library/MyCustomLib

So, unless you place your custom libs in the folder where the libs reside that ship with kicad, you might need that absolute path - donā€™t know if there is relative path stuff working/available yetā€¦ didnā€™t need it yet/havenā€™t been that far into KiCAD yet.
But will need that myself next when I go over my custom libs, currently all devices are in a single custom lib.

1 Like

Thanks, I am sure you just saved me 30min of format issues. I had noticed the existing config was by name. Iā€™ll report back once I get things going the way I like them tomorrow.

1 Like

So, I edit a project <project_name>.pro file and pointed it to my custom library files. When Kicad loads it reports it can not find the library files. Yet, if I go to the preferences and want to add one, it sees them and inserts a new item. Kicad seems to be using a .pro for the project somewhere else. Any ideas?

LibDir=C:\Users\pluto\Documents\kicad\library
[eeschema/libraries]
LibName1=74xgxx
LibName2=74xx
LibName3=audio
LibName4=cmos4000
LibName5=connector
LibName6=connector_icsp
ā€¦

change the backslashes into slashes like so:

LibDir=C:/Users/pluto/Documents/kicad/library

Does not make a difference :frowning:
changed both default and project .pro

I also tried win & linux line ends (\r\n vs \r) - no difference.

The odd thing is when I use preferences to add a library entry it duplicates an existing entry but does not seem to see the existing entry. It is acting like it keeps a copy of the entries somewhere else. I have rebooted several times in case a cache was effected.

Hmā€¦
I changed the eeschema lib entries in kicad.pro in that template folder to this:

[eeschema]
version=1
LibDir=E:/Data_KiCAD/_KiCAD_Library
[eeschema/libraries]
LibName1=power
LibName2=mylib
(end of file is here)

Then started KiCAD, created a new project (plain vanilla template, nothing special) and I get the same entries in the test.pro file. So for me, itā€™s taking the kicad.pro out of the template folder here

C:\Program Files\KiCad\share\kicad\template

adds some minor changes and it becomes the projects .pro file.
For me backslashes werenā€™t working for the path + when I had one of the lib entries (LibNameX=) left empty (was testing an established projects reaction to these changes) - KiCAD didnā€™t load any libs after that line, so itā€™s pretty finickle in that regard.

I use BZR6097 at the momentā€¦ as the scripting console is working again in the nightlies Iā€™ll install that asap and see if it works there too.

If all else fails, create a new project, add the libs via the preferences/component libs dialog in eeschema and once all works, check out the .pro file of that project. Copy the parts that you need into the template and it should work. Unless the template is somewhere else, but for BZR6097 it seems to sit there.

Success!
You got me thinking about cut & paste I did. So I took both files and noticed blank empty lines at the end of the file and some extra end of line blank spaces. Once I removed them it WORKED!

So,it does not like extra spaces anywhere including blank lines. I do not know what language is being used for Kicad but PHP has trim,ltrim,rtrim to solve these types of problems during line parsing. Thank you for all the help.

I havenā€™t made any boards or parts, etc but I have Kicad working the way I want now. Now I can start learning how to use it offlineā€¦

1 Like

2 posts were split to a new topic: I need help with libraries