How to clone a project

Thanks for such a thorough answer. That is what I was looking for. It gives me a clearer idea what is going on under the hood and solid list of what I need to archive / copy.

many thanks.

The cache lib and rescue lib is missing from your list. Without them the schematic will break!

I just verified that I could replicate an existing project by copying the four files @devbisme said to copy on Sept. 16, 2019 using kicad 5.1.4+dfsg1-1~bpo10+1, release build. I did this for a simple one-schematic-file, one-board-file, project.

Specifically, what I did was

  1. Started Kicad. Opened the project using File…New…Project… and then navigated to the directory where I wanted to put the new project, and gave it (the folder) the new name “my-proj”.
  2. Closed the viewport. Closed kicad.
  3. Copied the four files (myproj-cache.lib, myproj.kicad_pcb, myproj.pro, and myproj.sch) from the existing project directory to the new replicated project directory myprojrep with the new basename (myprojrep-cache.lib, myprojrep.kicad_pcb, myprojrep.pro, myprojrep.sch)
  4. Started kicad. Opened the new project and
    verified it looked and behaved exactly the same as the project from which it was copied.

Thank you, @devbisme.

@Rene_Poschl, my original project had NO “rescue lib” in its subdirectory. Has this file become obsolete w/ 5.1.4 ?
When you create a replicated project in this fashion, I highly recommend you add a myprojrep.README.txt text file to the new project’s subdirectory. Open the file with your favorite editor. In it, write today’s date, and the name of the project that you copied. Explain your reason for copying the project. Explain your purpose or plan for making it into a new project. This information will help anybody who comes across the new kicad project in the future and wonders, “why does this replicated project exist?, what’s it for ?”

That file is only added if it is needed.

A proper ending to this old thread is to announce that Save As is nowadays found in the project window’s menu of KiCad - but only in nightly builds which will eventually evolve into version 6.0.

I don’t understand what for are points 1 and 2.
To start new project I:

  1. Copy files myproj.pro, myproj.sch and myproj.kicad_pcb to new directory,
  2. Select them all in new directory and rename to newproj.*
  3. Open newproj with KiCad.

First time I have checked if it works with 4.0.6 and a moment ago I have checked it in 5.1.5. It works for me.

I ignore (delete) …cache.lib as my assumption is that I don’t have several versions of the same elements.
As I am still beginning using KiCad if I change anything in libraries I update to it all my 3 projects already done. I believe before I will start to have a bigger number of projects I will be able to 100% stabilize my libraries. That is I will be adding new elements but not modifying existing.

That`s brave.

You checked with one project. That is one datapoint. Your conclusion is not reliable.


To be clear: if it would be as easy as you make it out to be then the feature would be in KiCad.

I still believe it IS so easy but only for one-sheet designs. I have checked it (4.0.6) as one of my first checks of KiCad as it is for me ‘must have’. If it didn’t worked I would not do next my steps toward KiCad. KiCad can’t force one-sheet so have a problem with that feature :slight_smile:
I didn’t done the rev.B,C,D of my designs in KiCad yet but making the next revision I always start from a copy of previous one as there is no idea to redesign it from beginning.

It does not matter how many sheets you have. The complexity comes in once anything in the library changed since your source project was last edited. Or if you have a rescue lib.

Oh and most of the problems were better hidden in v4 as it did not include a pointer to libraries for referencing symbols. (The problems were still there but did not affect users that easily)

I can confirm that the method that Piotr uses works well for me on multi sheet schematics, with the caveat that I do not store custom symbol or module libraries within the project directory. These I always have in a common location defined with a custom environment variable set in the configure paths dialogue.
I use the following procedure:
(1) Copy complete folder & rename as required.
(2) Use a text editor to rename the project file as required
(3) Open the new project file with KiCAD
(4) From within the file tree, rename root schematic & PCB as required.
(5) Optionaly - Open escheema & rename hierarchical sheets that are in the root schematic.
I have used this method many times with no issues

I agree it will work in most cases. But here is the thing. Most is not all and the few cases where it fails it will fail catastrophically. (Project only savable with a text editor and a lot of knowledge about the file format). I have been in this state and can tell you it is not fun. So yes by all means clone projects that way but make backups and treat this process like a nuclear bomb about to go off.


So what is my solution?
Well i do not rename the project files if i can help it. I copy the full project directory and only rename that one. This has the lowest chance to nuke anything. (This at least fulfils the usecase of wanting to have separate projects for different versions of the same PCB)

I didn’t checked other then one sheet projects as I assume to use only one sheet. I supposed that main sheet links to other sheets by their names somewhere inside main sheet so when I change the names links will be broken.

I hope that the ‘anything’ is not true here. I hope that adding new symbols, footprints to libraries have no influence on old projects don’t using this elements. That means I believe symbols are referenced by their names so even their position in library is changed old project will have no problem with it. As footprints are separate files there should be even no suspicion there can be any problems with it. As I have said earlier I assume elements used are not modified later.

I had once a problem with cashing the library in project files. After earthquake (I think in 2002) when tantals became not accessible I decided that from now on in all my projects 10u/16 not means tantal but ceramic. I have changed that in library, and in my BOM generation spreadsheet. Some time later I designed the revision of one old PCB and missed that 10u/16 footprint was (nastily) taken from cash.
So I had ceramic in BOM and tantal footprint.
I prefer to see that something is wrong with that old schematic then to have such surprises.
But as I have read probably in V6 I will be no able to copy schematic and delete cash :frowning:

v6 will no longer need the cache lib. (If it does then v6 does not include the new file format because something went terribly wrong during its implementation and the project leaders decided to move it back to v7 instead of postponing the rest of the improvements made. So i am quite certain that this will all be history with v6.)

But you have all versions with the same file names. Even you can work with it I’m not sure if my PCB manufacturer will accept the same file names for gerbers of different PCB versions.
I prefer to change the project name than to change all output file names.

You send your gerbers in one large directory? I would assume the manufacturer gets one zip file per order or not? (The zip file has the project name while the inside just defines the layer names) Worked with every manufacturer i interacted with. Even the german ones (strangely i always had fewer problems with Asian fabs than with European ones.)

Also gerbers are easier to rename than the project. (They do not reference externals)

I’m just not sure. Our practice (established 25…30 years ago) is that each (gerber) file name agrees with PCB name including the rev. symbol (BC50_A.gtl is the top layer of BC50 rev.A). So they never get from us two files with the same name.

The first two steps just (1) Make a new subdirectory “myproj” where I choose to put it in my filesystem and (2) Make the new myproj.kicad_pcb, myproj.pro, and myproj.sch files in the new myproj subdirectory (which I then overwrite in step 3). I have not tried your recipe (algorithm), but it would be the first thing to do - 0 in your recipe.

Obviously I did not need kicad to do steps 1 and 2 in kicad. I could have done the first two steps in my operating system instead of opening kicad. Just a personal preference.

@Rene_Poschl, thank you pointing out that changing the basenames of the kicad files is not necessary when making a new copy of the project so long as you put them in their own new subdirectory. Good point.

Hi,

I will tell what I do, and works at least in Kicad 5.1.4-0 on my not very complex circuits:

  1. Close Kicad
  2. On file explorer make a copy of entire folder of the project (myproj) and rename (myproj2)
  3. Go to new project folder (myproj2) and delete all “bak” files.
  4. Rename all files to fit new project name, i.e. rename myproj.pro to myproj2.pro, myproj.sch to myproj2.sch, myproj.kicad_pcb to myproj2.kicad_pcb, myproj-cache.lib to myproj2-cache.lib, and so on…
  5. With preferred text editor (nano, vim, sublime text, notepad++, etc. NOT recommend to use Windows Notepad), edit myproj2.pro and replace all “myproj” text occurrences to “myproj2” (only a few occurrences you will find), the same with myproj2.sch and myproj2.kicad_pcb.
  6. Open myproj2.pro with kicad and enjoy

I am sure Git is better, and the best is if Kicad includes “save as…” or “cone” utility ;_)

I hope it will be helpfully,