Enviromental variables vs library managers

At the beginning Kicad does not show 3D models for electronics components:

003--footprint_editor

But then I updated my Kicad libraries to the development version from GitHub. I used git copy to copy all three libraries to their respective folders:

  • kicad-symbols
  • kicad-footprints
  • kicad-packages3D

And then I set the enviromental variables in “Configure Paths” window:

  • KICAD_SYMBOL_DIR ----> /home/ziga/kicad/library-git/kicad-symbols
  • KISYS3DMOD ----> /home/ziga/kicad/library-git/kicad-packages3D
  • KISYSMOD ----> /home/ziga/kicad/library-git/kicad-footprints

And now Kicad’s “3D Viewer” window shows 3D models for electronics components

005--footprint_editor

So this is how I obsoleted the imperfect default libraries inside /usr/share/kicad/ that lack 3D models, have weird naming conventions etc. Now I intend to use git pull sooner or later and when I will do it, my official libraries will be overwritten. This is why I will avoid changing them.

I am planning to copy & paste (& modify) whichever library elements I need in my projects to my private libraries. This is what I want:

  1. I plan on having one library for each project,
  2. Each library will be a “git repository” with a .git subfolder for version control, so I can just send URL’s of my libraries to my coworkers and they can git pull my repositories without knowing what is in the other libraries.
  3. I am not sure if I should put the libraries as subfolders in project’s main folders or on a separate location…

How would I do this in terms of Kicad? I was thinking of creating an enviromental variable e.g. LIBRARY_PROJECT and each time that I would start working on a project I would point it to the project’s library. But after I created it this enviromental variable wasn’t visible in “Symbol library manager’s”’ section “Path substitution”.

So what do I do? Should I avoid using enviromental variables for private libraries and use “Symbol library manager” somehow? What are your experiences?

See Environmental Path Variable not being used in Configure Symbol Library.

I suggest putting project specific libraries inside projects and storing whole project in git instead of just the libraries.

1 Like

That’s what ${KIPRJMOD} is for, it’s a pseudo-variable which always points to the current project path.

I once made a custom ${KICAD_DATASHEET) and used it to point to pdf datasheets of my custom symbol libraries. It seemed to work as expected, but it has been some time since I last used it.

Having a default location for spice models also seems to be logical.

It is not the same at all. Project’s library pointed to by LIBRARY_PROJECT could be in different location than project folder (I still wonder if it makes sense to archive projects and project’s libraries in separate folders) while KIPRJMOD always points to the current project’s folder.

I would rather use KIPRJMOD than my own enviromental variable as it seems that custom enviromental variables aren’t fully working yet and.

So I decided to use KIPRJMOD now. How do I automate the process which would:

  1. Create this folder structure inside every new project that I open:

    • bom
    • documentation
    • freecad
    • gerber
    • images
    • library
      • kicad-symbols
      • kicad-footprints
      • kicad-packages
    • spice
    • pdf
  2. Set up library search paths to:

    • ${KIPRJMOD}/library/kicad-symbols
    • ${KIPRJMOD}/library/kicad-footprints
    • ${KIPRJMOD}/library/kicad-packages3D

Shell/batch script of your favorite flavour

There is no such thing in KiCad, it can’t search for libraries, it only knows about libraries you explicitly added to global/project library table.
KiCad will, however, conveniently substitute project path portion of the library path with ${KIPRRJMOD} whenever you add a library that is anywhere within project folder.

I was thinking of creating a template to create the subfolders in my project folder. But it doesn’t work. My template is listed among templates:

Screenshot_2020-06-02_08-08-26

And when I use it to start my new project “test2” it creates files, but it fails to create folders that are inside of it:

These folders inside of the template folder are completely ignored at creation of “test2” project:

So how do I automatically create folders using my template? I would hate if I have to use a script which is not part of a program…

That’s how the templates feature works right now, it ignores non-kicad files. Open a feature request on gitlab, I think there are reasonable arguments to make that feature copy the whole directory structure, devs might agree and implement it.

Ok. Just so that I know not to try the impossible. I home it becomes better in the future.

These might be of interest:

I have already read article at your first link, but the second link is really valuable. I am leaning towards keeping private libraries decentralised and small. Why?

  • Because I want to keep project’s history clean. I don’t want to read about the changes made to the elements I do not use in my current project, but are in the centralised library which I also use for my curent project. In other words if my colleague edits a part that I currently don’t need in centralised library I get a notification which I don’t want.

  • It is easier to send around emails with a smaller private libraries and if I send my project to a person, with whom I would love to work with, and there is a library with millions of elements, he will be confused. With the small private library all he gets is a couple hundred elements or less and it is easier for him to get around this. Otherwise he might put his tail between his legs and run away!

  • I can just compress the project’s folder and put it away knowing that it will work whenever I need it at a later point in time.

  • I first want to work on a project and see if everything works out well. Afterwards if libraries prove themselves worthy I can still add them to my centralised library. But they are tested first in the project!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.