KiCadHowTo top banner
Sheepdog Software HOME KiCadHowTo HOME    Delicious.Com Bookmark this on Delicious    StumbleUpon.Com Recommend to StumbleUpon
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"

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.

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, in hopes that you did use a sub-folder, and hopes that what it talks about won't arise, but case it helps....

Unless your .lib and .mod files were in a subfolder of the project's folder, (where they should be, if not in a global repository) the program will 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...

All I had to do from here was do a normal save, AND CREATE A NETLIST by the normal procedure. There was no fuss over the fact that I wasn't overwriting a previous one. (Make a few small changes to the schematic first, just to prove you can, if you like.)

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 tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes.


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