KiCadHowTo top banner
Sheepdog Software HOME KiCadHowTo HOME   
KiCad logo

KiCadHowTo

How To Clone a Project
Use an old project as the basis for a new one

This page was done in haste. The information should be good... I wrote what was here as I actually did what is described "in anger", on a project I cared about! However, the web-page has not had careful editing, etc.

If there is something Just Wrong, or something that was unhelpful to you, please get in touch (see bottom of page), and spare the next person. If there's something that is just a bit not perfect, please understand that I write these things for no reward. I will try to fix any reported minor rough edges, but the day job does sometimes make demands.

The missing "Save As"

It is a pain to start something from srcatch. It is worry to have no way to back up your work up to a certain point, create a "fall back", in case what you do next goes horribly wrong.

And so, in many applications, I am a great believer in the "SaveAs" function.

Simple backups

Before I go into the matter of a simple backup, I should mention that I am not an advanced user of KiCad. I get things that I want to do done... but I don't exercise every feature of this great PCB CAD tool.

I generally only create schematics and board designs. Along the way, I generate a netlist. (Again and again!). And I do generate Gerber files, for processing by OSH Park, but I don't use BitMap2Component, nor whatever it is that allows users to see a "3d" rendering of what their board, with components, will look like. Nor do a do a lot with custom components and footprints... although I do use them a bit.

So! Onward....

A simple backup:

It is fairly simple to create a "fall back" backup, if you work in a tidy and disciplined manner... by which I mean, primarily, that you created a folder for the project you are working on, and put all of its elements there.

Close all of the KiCad modules. Use your system's ordinary file management tools to make a copy of the folder and all its contents.

For a simple backup of something called, say, PCB123, I tend to put the folder with the copy inside the PCB123 folder I created at the beginning of that project, and, if I created it on 1Jan2015, I might call the folder I've created for the backup "PCB123-BU1Jan15"

====== Sidebar begins.....

KiCad, by the way, is quite tolerant of your wish to organize your folder hierarchy as you want it.

If I had two projects, say PCB001 and PCB002 on my hard drive, my folders would look something like the following. Note how, at the higher levels, you can pick your own names. If the KiCad app is not running, you can move the folders, rename them, etc.

Just don't try to be clever with the names in the innermost folders. And always use the ".pro" file to open a project inside KiCad.

KicadProjects
---- PCB001-my first KiCad
----------PCB001-1 Jan 2019
------------------ (Inside here, let KiCad manage things,
                             ... but it is okay to add notes in .txt files, etc.)
----------PCB001-1 Jan 2019-10pm
------------------ (Inside here, let KiCad manage things,
                             ... but it is okay to add notes in .txt files, etc.)
----------PCB001-5 Jan 2019
------------------ (Inside here, let KiCad manage things,
                             ... but it is okay to add notes in .txt files, etc.)

---- PCB002-another project-LED bargraph
----------PCB001-25 Feb 2019
------------------ (Inside here, let KiCad manage things,
                             ... but it is okay to add notes in .txt files, etc.)
----------PCB001-27 Feb 2019
------------------ (Inside here, let KiCad manage things,
                             ... but it is okay to add notes in .txt files, etc.)

... and so on.

The next "later version" sub-folder for, say, PCB001, would be set up using the OS file tool ("File Explorer" in Windows) by right-clicking on the folder for the most recent version ("PCB001-5 Jan 2019"), then clicking copy. Next, I'd right-click again, choose "Paste"... and then I'd edit the default "PCB001-5 Jan 2019-copy" to give it something like "PCB001-8 Jan 2019".

And I'm done. I can open KiCad, and get to work on the "8Jan19" version of PCB001... which is, of course, for the moment, the same as PCB001-5 Jan 2019", until I'd done some edits.

A final note: At the innermost level, it may pay you to refrain from using spaces in filenames. Some multi-platform applications are fussy about this.

... sidebar ends========

So far, so good.

If you are ignorant, I would like to leave you in bliss, but that rarely works well in the long run. I am the one-eyed king, and know that the details of components and footprints used in the project will have been dragged in from various places. I think, hope, pray that as soon as you use a new component or footprint, the KiCad system creates a "local copy" of that. Thus, the backup will have all that is needed, even if you move to a different machine, with different libraries installed. But... here's where the blissful ignorance comes in... what happens if, say, you decide that the pads on your 8 way DIL footprints, throughout your KiCad work, are too narrow? I think what you do is....

a) Redefine the footprint, in the global library. Once that's done, any NEW use of the footprint will, of course, reflect the changes you made.

b) I think a mechanism exists whereby any OLD projects carry on with the footprint, as it was defined in the library AT THE TIME you used the footprint in the project, BUT that you can "have cake, and eat it", with a way to say "okay... update the footprints in this project to bring them up to the new design.

That all got a bit rambling, I know. But it does have implications for any backing up or project cloning you want to do.

I can't explain it all... because I'm not sure I understand it all... but there is good news: For my needs, the "backup" system explained above seems to work, and the "clone" system I am about to explain seems to work... but use them with your eyes wide open... my schemes may not meet everyone's wants. Sorry.

Cloning a Project

I made a little PCB to "carry" an Arduino Pro Mini, and bring the I/O lines out to screw terminals.

Subsequently, I wanted to make a similar board, but this one was to carry a Modern Device RBBB, an Arduino clone with a different footprint.

=====Sidebar begins.......

If you are cloning a project you did long ago, under a much older version of KiCad, you may have various things to deal with. Deserves a "How To" page of its own.

For the moment: If after you've prepared the way, made your "clone", as described on this page, and, when you go to save the schematic, get "Errors occurred creating symbol library.... cache.lib", then don't immediately panic. Clcik the "See Details" button in the warning message.

You may find that is it "just" one or more instances of "Symbol... not found in any library or cache".

This is a nuisance, but not a major pain. And you can carry on happily, up to a point. You will have already seen, on your schematic, as presented by KiCad, that some of your old schematic symbols haven't been found. There will be a "placeholder" on the diagram. Deal with them when you can... but your clone is not a failure. Whew!

.......Sidebar ends=====

Instead of starting the new project from scratch, all I needed to do was to start from the first project (the Pro Mini carrier), do the KiCad equivalent of a Save As, giving the copy of the first project its own folder, its own name, and then I could just move a few things around, maybe revise some tracks, and "presto", I have the "new" product, by derivation from the old.

Don't be mislead: There is no "SaveAs" in KiCad. But here's how you can achieve what a SaveAs would do....

Close any open KiCad modules.

Fire up your operating system's file management tool.

Find the folder holding the project you want to clone. Let's say is is called PCB123.

Copy that folder and all it's contents to a new folder under a suitable name. If I was starting something which I would call PCB124, I would call the folder for the clone "PCB124". (I'm a pretty simple minded guy. I find it makes life easier.)

I then went into the folder which has what will be the new project, and renamed things. For instance, PCB123.pro, the main Project Definition file, became PCB124.pro.

(Most, if not all of the KiCad files are text files, and can be opened for inspection with a text editor... not that you need to do that for the cloning process.)

I deleted the old PCB123.net file, and created a fresh one, from scratch, during first pass through the development cycle, just to "clear" any unfortunate scraps.

I deleted, in connection with .lib and .mod, the old .bak, .bck and .dcm files, by the logic which led me to delete the .net file.

===

Once I'd done that...

I dbl-clicked on the .pro file, then clicked on eeschema's icon in KiCad project manager... being careful to wait a moment for the file to come up, and NOT to double click!

Hmmm... this next bit seems a bit suspect, a bit vulerable to the exact details of how you have done things... but "it may never happen" to you. Furthermore, as I come to edit this section, years after I wrote it, I'm not sure why I am talking about a sub-folder for the .lib and .mod files. I hope that what the next bit talks about won't arise for you, but case it helps....

Unless your .lib and .mod files were in a subfolder of the project's folder, (where they should be (?? maybe...) if not in a global repository) KiCad may moan that a needed library cannot be found.

To fix "library not found", go into eeSchema's Preferences|Library, remove the reference to the library it was seeking (that was the right library, but it wasn't WHERE eeschema was looking). "Add" it back, using will seem like an absolute path. (Internally, it seems to use a relative path, at least when the library is in a folder within the main folder of the project, the one the .pro file is in, even though the path is listed in absolute terms.

End of "slightly suspect" bit.

Finally...

After that, I just proceded normally. If the circuit didn't need changes, I could go straight to working on the PCB design, but it would be an idea first to open the schematic design, if only to update the text in the legend, if you are using that... as you should be to provide internal documenation. (File- Page Settings).

Then I clicked the CvPCB button of the KiCad project manager.

If you get "Library could not be found", go into CvPCB's Preferences|Libraries", remove the old, add the "new" (old in a new place) as before.

Do CvPCB's Save. Close CvPCB.

===

Click project manager button for PcbNew. Your design should come up.

It seems that the program assumes that any needed .mod files are in the same place as any .lib files. (Such files may reside in multiple folders... but I suspect that individual .lib and .mod file pairs need to be in the same folder.)

Then I told it to read the netlist prepared earlier. Made a tiny change. Saved board, closed everything except project manager. Saved project. Closed manager.

At this point, the clone should be indistinguishable from something started from scratch.

A Detail

If, say, you put "PCB123" into a text object in the silkscreen layer, that will of course have to be edited. It won't "magically" change to "PCB124" by itself!

In conclusion

Hope that helps? As I said at the start, this page was produced in haste. You should find that other pages on my sites are more polished. But I would reiterate that the information should be good, even if the presentation is less good.

If it did help you, I would appreciate Facebook "likes", etc... there's not much point in me writing these things if no one knows about them.



Contact this page's editor, Tom Boyd


Valid HTML 4.01 Transitional Page has been tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes.

AND passes... Valid CSS!


- - - - - Page Ends - - - - -