Lost in Kicad libraries

Following tutorials generally follows a narrow path to some objective. In fact there often, multiple paths and branches and if you miss a turn you are left with the menus to try and recover. I find multiple dead-ends in Kicad library usage when winging it in the menus to get out of a hole.

I seem to have three blocks of libraries: the Kicad system library, my User library which is tied to the home folder of Kicad top level. Then I downloaded Digikey stuff from Github. It seemed to do some reorganisation to point to itself. Its library does not have the foot print of an ordinary capacitor (yet).

Then I created a new footprint.
When I later tried to saved it, Footprint Editor chose a digikey library collection and then said it is read only.
I also tried Save as … It too chooses some anon library collection which I don’t want. I can’t tell where to save!!!

I could not find a way to point to a different library collection in the Footprint Editor. It is configured to save where it wants

I wanted to save my work, so the only option seemed to be to use the Footprint Export option. This creates a xxx.kicad_mod file, I suppose with the footprint in it.

Then I tried somewhere to import it, I suppose into my User parts library. But I could not find any import anywhere. Dead end, but i hope my work can be recovered. What is the purpose and point of xxx.kicad files?

One of the problems I see is that each library is a collection of folders holding symbols. Kicad then just merges these collections into one long list. Great if you are try just trying to pick a part from the list. But not so great if you trying to figure where it came from and if the source is writable.

There are several dialogs that just list one collection (by memory) but they do not list the source of the collection. Managing libraries is all about managing these collections. Are they writable? What is their full path?
And managing libraries is a misnomer. You are not really managing libraries at all. You are managing the collections of libraries.

I would also like to have my own library which is not bound to the Kicad root directory, but is a level above that so it can be shared among several of my projects but ${KIPRJMOD} is fixed at Kicad root and is where my custom symbols and footprints go.

In Footprint Editor I then tried using Add library… The dialog initialises pointing to the Kicad root (which has my custom symbols) and can hold footprints. So select Kicad root. Now another dialog …

Select library table, Global or Project. I select project.

Then I think the first time I did this I got a dialog, see below. Subsequently, if I repeat the command, since the library is already there, it just flashes the screen because the library collection was already loaded.
From memory, the first time I did this, I got a dialog:

  • Loading library (from somewhere not specified)
  • To (somewhere else).
    and where somewhere and somewhere else is not specified. Not very informative!

Evidently it was from Digikey.

It seemed to be the Digikey Library collection that was loading and does not include my custom stuff and in any case is not writable.

I use Widows Explorer to figure what is happening by comparing file content.

Dead end again.

Is the problem in:
" (fp_lib_table (lib (name digikey-footprints)(type KiCad)(uri “C:/Users/Robin Hayman/Robins documents/IoTkit/Kicad/digikey-kicad-library/digikey-footprints.pretty”)(options “”)(descr “”))"

Do I need to add another entry here??
How to recover my footprint in a xxx.kicad_mod file?

I think the whole Library managment would be clearer by talking of Collections of libraries and to always be able to drill down to the Collection path. And to always specify the Collection name since it is a folder somewhere and allow to drill down to full path and understand what is going on.

As is Library Mangement is tough going inV5.

I assume you mean .kicad_mod. They hold the footprint.

Although KiCad dialogs often start in “C:\Program Files\KiCad” (or similar), it is bad idea for the user to create files there. Either put them somewhere common like “C:\My_kicad_data” or Users\Documents.

Unfortunately I lost track there, which problem are you referring to? Generally it is better to look at the GUI than the delve into the text files.

  1. First, find the path of the file.
  2. Create a new folder C:\my_kicad_data\my_footprints
  3. Copy the file to that folder
  4. Go to the Footprint Library Table editor
  5. Click “Browse libraries”
  6. Navigate to your folder
  7. Add it to the table

Have you already read Rene’s articles in (Start Here) Frequently Asked Questions? Especially Library management in KiCad version 5?

He starts off “As a first step create a new project just for following this tutorial”.
That is a part of the narrow track"!

I don’t want to do that. I already have a project.

I start with File - New Footprint, that’s what I want do. The dialog just asks for Footprint name.

Just now, I can’t get further because I have my unsaved footprint blocking make a new one. The dialog points to kicad root,so I save and get Footprint exported to file “C:\Users\Robin Hayman\Robins documents\IoTkit\Kicad\Resistor_0.25W.kicad_mod.”
So it should be safe to close the new foot print. Exit with warning ‘Not saved’. But it is exported to ok.

So now I am free to restart. Kicad already has project “Project name:
C:\Users\Robin Hayman\Robins documents\IoTkit\Modules\Term 4.4\Term 4.4.pro” That has .sch and some custom symbols. Continue with it.
Now select Kicad Footprint icon.
A dialog pops up
“Loading footprint libraries”. I does not say whic ones. It should say
"Loading library collection from c:…
so I know what I am loading. Instead it loads a collectionfrom an unknown place. I can deuce by content that is a Digikey library read only collection…
I had no say in this.
This a dead end.

Instead I can got to Preferences - Manage Footprints ad choose Project specific libraries

It lists two nicknames, digikey-footprints with path
and Term 4 with path.
Are these nicknames for Library Collections sometimes called tables?
Both are marked Active.
I choose Term4 and OK.
Now Footprint dialog disappeared. Just Kicad now.

Dead end? I was managing Footprint library.

Stop here. What next?

Back to

@bobc
Thanks for how to recover from export and recover .kicad_mod files.
I am trying do that.

Blockquote
How to recover my footprint in a xxx.kicad_mod file?

    First, find the path of the file.
    Create a new folder C:\my_kicad_data\my_footprints
    Copy the file to that folder
    Go to the Footprint Library Table editor
    Click “Browse libraries”
    Navigate to your folder
    Add it to the table

@bobc Where is the Footprint Library Table editor
Do you mean Kicad - Manage Footprint Libraries
But it has no browse.

Follow the tutorials, they have been written for you. They are not intended to fix your immediate problem, but to give you the understanding required to fix problems you might encounter, or better avoid them in the first place.

Creating a new dummy project for the tutorial is not difficult.

There is no such thing as library collections.

2 Likes

Yes I do.

Good point, it has been replaced with the “folder” symbol.

2 Likes

@bobc

The saved footprint is at

C:\Users\Robin Hayman\Robins documents\IoTkit\Kicad\Resistor_0.25W.kicad_mod.

Create a new folder ...\IoTkit \Kicad \exported footprints
Add it in to the table. 
Then a long list of  libraries  load
It would be much better if it listed the name of each library collection it is  loading before it sarts the big long list
e.g System footprints
Digikey foot prints
Local user footprints.
Kicad dos not make enough use of collection names to say what is going on
At the end of the listing, I got a message
There were errors.
My particular footprint did not load.
Any ideas?

How do you get here?

A footprint can only be saved into a library. A library is a folder whose name ends in .pretty, for example maylib.pretty. And the library must be loaded in the fp-lib-table with “Manage Footprint Library…”

Of course, a footprint can be copied with the system file browser to any other folder not ending in .pretty. But in this case it would not be recognised as belonging to any library.

1 Like

@pedro > “How do you get here?”
By trying to attach a Digikey library and messing up somewhere.

But I still want to recover my footprint!

Save does not work because the Digikey target library is read only. And something is choosing to write my footprint there (Hint: Digikey set me up some how).

The the only option left was Save as …
which makes a xxx.kicad_mod file which I would now like to make into a .pretty and put in my User library.

Should I just wrap the kicad_mod in a pretty folder and put it in the right place ? From comments above I understand Footprints are written in .kicad_mod format.

@bobcThere is no such thing as library collections.”
Isn’t the KiCad System library just that, a protected collection of libraries?
And this Digikey thing adds another protected collection of libraries which somehow, my footprint wants to write to but can’t because it is write protected.
And Kicad does not tell me (If I recall correctly), which collection of libraries it is trying to write to, it just says something failed along the way.

Kicad then displays the merged set of collections of libraries as a linear list of libraries and it does not tell you where they came from or if they are protected. And my User library is not in the linear list.

Have I got messed up by Digikey writing:

“(fp_lib_table (lib (name digikey-footprints)(type KiCad)(uri “C:/Users/Robin Hayman/Robins documents/IoTkit/Kicad/digikey-kicad-library/digikey-footprints.pretty”)(options “”)(descr “”))”

What is fp_lib_table about?

As a fix, do I need to add another line entry here pointing to my stuff?

Is p_lib_table a list which binds nick-names to file locations and somehow I have lost that binding or Digikey overwrote mine with theirs, when it should have added to the nick-name / file binding list?

It is getting too late to attack this again tonight. I will get back to it soon and I will have a go with the suggestions above and perhaps a bit better understanding.

Thanks for help

The library tables tell kicad where libraries are and under which name (nickname) the libraries should be addressed. (The nickname defines the name used by kicad, the path is the name used by the operating system)

Yes only libraries that are in the lib table are known to kicad. If your library is not in the library table then kicad does not know about it.

Again read Creating a new footprint library with the support of
Library management in KiCad version 5 and Tutorial: How to make a footprint (From scratch)?

1 Like

OK.

I am going to give up here and start a new thread
Kicad: Configuration by Convention : model 1

Help me make Model 1.

What do you mean with “model 1”?

why don’t you give up wasting people’s time and just read the tutorials that have been suggested??

1 Like

How about the tutorials are not accurate stating to click buttons or select pull-down menu options that don’t exist at least in version 5.1.5?

I was checking out this thread along with others and reviewing tutorials seeing references to items like clicking “Save footprint to new library” or “Select library as active”, but the tutorial does not say how. Where does either of these buttons or command selections exist? I don’t see either in the File menu as one tutorial references. All I see is a Save button whether it is in the top row, under the File menu, or in the context menu that appears when right-clicking a footprint library in the browser list. Click any of these save buttons, nothing happens. Robin appeared to have the same problem, except he was getting the wrong library. I can’t get any library selected to save the footprint and so it doesn’t save. I have been able to intermittently get a context menu to come up asking me what library to save the footprint. If that happens, I can save the footprint to a library. No issue. Most of the time, however, I get nothing. I don’t so much as get an error. I have tried saving footprints on two different computers with KiCAD 5.1.5 installed finding that trying to select a library to save a footprint is hit and miss. Is there really a way to select a library to save a footprint?

Also, one sentence in the tutorial also states that local verses global footprint libraries allow libraries of the same nickname to co-exist. Yes, the tables allow that, but the Footprint Editor will only list the global library and not the local. So even between local and global library tables, the nickname appears to need to be unique to get full use of a library.

So then either download the version used in the tutorial, or apply some basic software-fu.

In the version I’m using it’s called “save as” and I don’t see how this could be any simpler.

But if he’d just READ the provided information he would at least understand how symbols and footprints are organized into files/directories and the role of the library tables.

Demanding that someone start from his messed up installation and understanding rather than a blank slate is just wasting time on both sides.

2 Likes

These phrases only appear in the version 5.0 section of the how to make a new footprint library tutorial (all other tutorials i made do not have these phrases in them)

If you are on version 5.1 then a section about 5.0 is clearly not the place to look for information. (The old section is kept around because 5.0 is still quite often used)

Oh, I know how it can be simpler, gray out and disable the Save button so the user would then be forced to use the Save As and I believe then it just takes the OS file system route to saving the footprint. People are going to be gun shy about using the OS file system to build a library repository. The schematic symbols don’t work that way, right? The multiple symbols are bundled into one library file. Otherwise, I agree with your argument about due diligence and Rene’s tutorial does revile that the individual footprints are their own self-contained item that can be manipulated by the file system. (Of course, try doing that with a Subversion repository.) What led me to this thread and I think the other guy as well is a software bug which I would not blame the user as a training issue.

From what I am understanding the bug to be is that an empty library is an issue that causes a crash. The work around (aside from using the OS file system) was to have the user have a footprint ready to put in a new library immediately on creation so the ‘Save footprint to new library’ helped with the situation. With version 5.1, the error seems to now be trapped (no crash) but there seems to be some difficulty in handling the error (what to do with it). What I have found to work consistently thus far (without using the OS file system and following Rene’s older 5.0 tutorial) is to save a footprint to the new library immediately after naming the footprint before doing anything else with that footprint. The context menu will appear at that point and let the user populate the new library. If importing an existing footprint to a new library, best just to use the OS file system as the context menu may or may not appear.

Version 5.0 could already handle empty libs. But the process for creating new libs was the same as in version 4 so the tutorial is written for the oldest version it applies to. (and version 4 indeed had a problem with empty libs.) I now separated the tutorial parts a bit more and made it even clearer for which versions each of them applies.

2 Likes

Well, if your footprint is still at C:\Users\Robin Hayman\Robins documents\IoTkit\Kicad\Resistor_0.25W.kicad_mod, just move it to a .pretty folder.