KiCAD misplaces symbols in schem editor - Page 1
Forum section: electronics / general

author: opampsmoker
author_rank: Regular Contributor
timestamp: October 28, 2020, 09:40:34 pm
content: Hi,I work on Kicad on a computer in the office. Then when i go home, i copy the kicad project and libraries...and load them on my computer at home. For some reason it then looses a lot of the symbols in the schem when i re-open the kicad schem at home.It must know what they are because it puts a question mark in the schem and writes down in words exactly what the symbol was (the 'value' field).I can individually click each question mark and then get the correct symbol put back in there...but this takes a lot of time.Do you know how i can avoid this happening?

author: nuclearcat
author_rank: Unknown
timestamp: October 28, 2020, 11:21:19 pm
content: Usually when it loses symbol - it shows error why it loses them and offer to repair. All such messages can be helpful.Check also if you have any custom libraries, make sure path to them relative, not absolute.

author: janoc
author_rank: Super Contributor
timestamp: October 28, 2020, 11:37:08 pm
content: This mostly happens when you don't have the libraries in the same place and use absolute path as @nuclearcat mentioned above.It can also happen if you are using two different versions of KiCAD and the libraries are not the same between the two.

author: opampsmoker
author_rank: Regular Contributor
timestamp: October 29, 2020, 07:13:50 am
content: Thanks, presumably by "relative" path you mean it needs to be a "${...}" type path.In the symbol libraries dialog box it has made a name called "${KIPRJMOD}"......so i have to make up some word like this?Surely there is some quick way of using an absolute library address, and then i can just hit some command like "update symbols from library"?

author: janoc
author_rank: Super Contributor
timestamp: October 29, 2020, 09:35:47 am
content: Quote from: opampsmoker on October 29, 2020, 07:13:50 amNo that is most likely still absolute path (depends on what is in the variable).https://en.wikipedia.org/wiki/Path_(computing)#Absolute_and_relative_pathsQuote from: opampsmoker on October 29, 2020, 07:13:50 amThat thing between ${} is an environment variable that gets replaced into the entry in the box. So if you are in Windows, you need to make sure it is not set to e.g. C:\blah\foo\Kicad\something (which is likely different on each of your computers). You can see these in Preferences->Configure Paths.Either you must set the variables (and have the software installed!) the same on both computers or you will need to use relative paths that don't use these variables and are relative to the project directory.Quote from: opampsmoker on October 29, 2020, 07:13:50 amAnd how would you imagine the computer knowing automatically that at work you have a library X at a place Y but now it is in a folder Z (and that it is the same library)?If you want to try to automate this sort of hack, you could make a script that will replace the paths for you (while KiCAD isn't running, obviously).They are stored in the following files:Assuming your system-wide config is in:C:\Users\<username>\AppData\Roaming\kicadVariables - inkicad_commonPaths/list of libraries to schematic symbols -sym-lib-tablePaths/list of footprint libraries -fp-lib-tableThe sym-lib-table and fp-lib-table are both in the system-wide directory (the libraries shipped with KiCAD) and in the project directory (the project-specific libraries you have added to the project). Those are likely the ones you will need to change.All those files are plain text but make sure to keep the format or KiCAD will get confused. Once you fix the paths in there, start KiCAD and it should find your symbols.You can avoid this issue by using a proper project "hygiene" - put a copy of any third-party libraries (stuff that isn't shipped with KiCAD) that you are using inside of your project directory and add them using a relative path (i.e. one that does not start with a "/" or drive letter!). Then the above "massage" won't be necessary.

author: opampsmoker
author_rank: Regular Contributor
timestamp: October 29, 2020, 11:13:17 am
content: QuoteThanks, oh sure, i agree i still have to re-define where the relevant library is when i move to the new machine...but i've done that, and kicad still cant find the library.

author: janoc
author_rank: Super Contributor
timestamp: October 29, 2020, 02:15:09 pm
content: Quote from: opampsmoker on October 29, 2020, 11:13:17 amVerify the paths in the files I have mentioned to make sure there is nothing forgotten there. You have also not said whether it is one of the stock KiCAD libraries which is missing or one of yours - the solution could be different for each.So it is difficult to help you like this because it is only on your computer. You need to provide more information, we really don't read minds.

author: julian1
author_rank: Frequent Contributor
timestamp: October 29, 2020, 11:23:58 pm
content: QuoteThat env variable is supplied by kicad, and always points at the project directory.So you can appropriate it, and use it for relative paths.Eg. I use it to point at my common library that gets shared across different projects. eg. like this.${KIPRJMOD}/../../lib/mylibrary.libThat way my library and projects always travel and reference each other correctly.