Project specific path variables

For my work I am switching between projects a lot. I would like to be able to make relative path variables on a per project basis. This is due to not always having the same map structure. As an example:

  • Project A
    • Lib
    • V0.1
      • v0.kicad_pro
    • V0.2
    • V1
  • Project B
    • Lib
    • PCB
      • V0.1
        • v0.kicad_prj
      • V0.2
      • V1
    • Wiring

When in project A the path variable for the Lib folder would be “${KIPRJMOD}/…/Lib/”, whereas in project B it would be ${KIPRJMOD}/…/…/Lib/".

I think a change to the configure paths dialog like below could solve/ improve this workflow.

I have no clue where else in the codebase needs to be changed to create this feature.

1 Like

KiCad project files end in .kicad_pro not .kicad_prj.

Are you referring to symbol or footprint libraries? Both are already supported by project specific libraries.

Perhaps you might like to read the documentation to see how things work first.

Hi I the file extension is not the main topic of my post, but for your convenience i changed it to ,kicad_pro.

I am not referring to symbol or footprint libraries, i am referring to the environment variables you can create in the “configure paths” dialog

1 Like

As far as i know there are no project specific environment variables.

You would have to submit a feature request arguing for its merits as an issue to the Gitlab repo of KiCad for it to be potentially considered for future versions.

Perhaps you can workaround this by another means, e.g. put a symbolic link to the desired directory in the project directory, e.g. lib -> ../lib and lib -> ../../lib in the two cases.

I do not understand what the problem is here. Best I know this is already supported.

I got confused by your screenshot. I do not recognize that dialog. Later I saw a “Mockup” popup text, I guess you drew it yourself in some graphical program. Correct?

Note: You have to put strings with two dots within backtics so this forum treats them as “literal text”. Else this forum software replaces two dots by a single character looking like three dots. It that *&^%$#@! unicode or whatever.

But overall, as I already wrote. It’s already implemented, and has been so for years.
I just tinkered a bit with: Project Manager / Preferences / Manage Symbol Libraries. To verify, I added a library from another directory with a relative path:

And I verified it works. When I open the schematic, I can now add symbols from the “Gerber_Reverse” library to this display_8x8 schematic.

1 Like

@Somososan Thanks for the question. I had the same or very similar situation: I needed to split one project into two. I created two new projects as sub-folders but kept my project specific library (incl. 3d models) in the original project’s folder (initially I also kept the original project). Using a project specific path variable I could have created a variable that points to the common folder where the libraries are located that I need for both sub-projects (, which for KiCAD are ordinary projects) but not for other projects.

Using symbolic links I was able to accomplish the same (thanks @retiredfeline for that hint), but under Windows this turned out to be somewhat tricky. (Only work from command prompt (not powershell) with admin rights.) Also I am a bit worried that using git this may cause some troubles, e.g., when cloning the repo.
Hence, I still think it might be a good feature to have project specific path variables. But then I am also very new to KiCAD - so probably not the one to judge.

Path variables from that dialog can’t be used as normal project variables, but project variables can be used as path variables. That’s the solution. Create variables in Board or Schematic Setup → Text Variables and use them as path variables. Even a complex combination works, like this:

${KIPRJMOD}/${modeldir}/${modeldir2}/R_0805_2012Metric.wrl

modeldir = ../..
modeldir2 = projects/simplified
1 Like

@eelik Nice! Thanks for this valuable hint. :smiling_face:
I guess in many situations this works. In my case, however, it does not seem to work within the footprint editor. The way my project is structured is far from ideal, so I do not blame KiCAD. (It is my first project with KiCAD and so far I am extremely happy. Next time I will structure it better.)