Nice! Did you check if your file sym-lib-table also needs to be edited by hand with a text editor to update the link to the new library name?
I did not check that as I did not know this was needed, I have no idea what the “sym-lib-table” is/why it’s there and that’s a one more reason now added why this is a mess
I now tested to change also the naming within the “sym-lib-table” (as I could not now open symbols from the library) after renaming the project. Unluckily though, the fix of "“sym-lib-table” did not help, can not open any symbols from the project library, what’s shown when choosing “Edit Library Symbol” in the schematics is “no symbol loaded”, so this way of renaming doesn’t seem to work so well either…
A comment on your posted video:
If you first do a “save as”, then that does not modify the original files. A “save as” is not a “rename”.
… And if you then rename the copies and the original files to the same names you create some monstrosity by trying to copy copies of the files to the same names.
Wow, this is just getting better and better
@TheSwede : in sym-lib-table, if you rename the library name and not only the filename, then you need to edit also the file NewName.kicad_sym and .kicad_sch and do find-replace there too.
If you do not rename the library name in sym-lib-table, it should open fine (it does for me).
@paulvdh we are not renaming the original files. Just copying to a completely different folder. The ones that are not being automatically renamed (in the new folder!), i.e. the subsheets and the symbol library, we try to rename by hand.
It’s not a monstrosity, let’s not be so scared about trying to rename a project after some days of development because someone thought the initial name they thought of was probably not the best choice. It happens to me, too, and I am tired of reading “don’t do it”. Instead, help us find the less hacky way of doing it.
I skip this topic. It’s better to never rename anything. If I give my KiCad project a “bad” name to start with, it’s my own fault.
An edit has been made at the video link above: “Note: This way the schematics library links crashes/does not work. More work must be made, which I’m not able to manage at this stage…”
You have been given a non-hacky way to rename a project in 5.99. It just doesn’t rename libraries and subsheets. Personally I’m not sure why subsheets should be named after the project name at all. Let’s say I have a regulator in a subsheet. What value does it add to have MyProduct_regulator.kicad_sch instead of just Regulator.kicad_sch under the project folder?
But my subsheets are not called Regulator.kicad_sch
They are just:
MyProject_1.kicad_sch
MyProject_2
MyProject_3
MyProject_4
because there are 4 sheets without specific names, because what’s inside them may change over time. And because I split the main one (in a sequential manner 1-2-3-4) because they do not fit in one sheet. It makes no sense to not rename them for my use case. I agree it makes no sense to rename them in your use case with your regulator. So for my use case, I am trying to find a way.
OK. What would be wrong in naming them just 1.kicad_sch etc.? What value MyProject adds to the file names? They are part of the project anyway because they are in the project folder and are referenced in the main sheet.
Hmm, because that’s the way KiCad works when you create a new project. It generates:
MyProject.kicad_sch
MyProject.kicad_pcb
so the most obvious way to name a subsheet that is an ‘overflow’ of MyProject.kicad_sch that I move to a new file because it doesn’t fit in my A3 or A4 page, is to rename it as MyProject_2.kicad_sch, etc. (If, when generating a new project, KiCad would name them 0.kicad_pcb, 0.kicad_sch and 0.kicad_pro, then one would not be intuitively tempted to add the project name to those subsheets.)
Of course, yes, if you know that there is going to be a problem, you would name them instead 1, 2, 3 and problem solved. But how is a new user supposed to know that there is going to be a problem in the future in the first place? This is why I try to find a solution for those users that might encounter this situation if they chose that _2 naming convention and are now faced with the renaming issue like TheSwede.
There is no need to give all schematic files in a project the same name.
The main schematic sheet has the same name as the project, but for the sub-sheets it’s more useful to give them each a sensible name according to function such as “Power supply” “I/O Connectors” “Memory Interface” or whatever the function of the schematic is.
In this way you don’t have to rename the sub schematics if you rename the project. You can then also copy a single sheet to another project without renaming it.
When a sub-sheet is created, it asks you for a filename, and there you can also link to a sheet in another directory. I think this is by design, but I’m not sure. You can also edit the properties of representation of the sub sheet, and make it point to another schematic sheet from within Eeschema.
Hi Paul. Even if I have left this topic, at least for a while, can you show the other guys here what you mean, it sounds interesting and also me (if I come back) would like to learn why there is “no need” to rename files free of choice as at least I have wished for so far. A video would be absolutely great where this is explained and showed. Please!
“When a sub-sheet is created, it asks you for a filename, and there you can also link to a sheet in another directory. I think this is by design, but I’m not sure. You can also edit the properties of representation of the sub sheet, and make it point to another schematic sheet from within Eeschema.”
In this case, all sub sheets are already created. And by some/any reason we want to rename the complete project, for whatever reason, with all parts of the project/all files with the same name, just for the simplicity (and of course the possibility) of doing it.
I agree there is no need to do that. But this was not a post about ‘good practice’ or ‘needs’, but how to find a solution to one particular problem. If someone has done it and named 10 subsheets this way (even if there are more senseful ways, I agree with you), there should be a bunch of steps to follow to solve it, so that one does not need to stick with an InitialUglyName for the rest of his project-life.
I think Save As is not the best name for “copy project but change the basename” operation. I think New Project from Existing would have been a better name. Setting aside what’s been coded, I think a Python plugin could do this:
Get the existing project directory
Get the basename, or a regex matching the basename
Get the substitute for the basename
Get whether to also deal with subsheets that match the basename *
Get for a directory for the new project, creating it if user agrees
Do the copy, and edits if needed
Open the new project
Get means obtain values from a GUI form. * is where the two usages are distinguished.
I’m half tempted to code it up as a Python exercise.
Go for it if Python is your thing, don’t wait, I have not idea what Python is but I’m ready to test the result(s) whenever it’s possible!
I came across this Python script - does it do what you need?
Actually I don’t need anything since this is not something I do. I’ll wait for v6 so that my KiCad supports Py3 (for some reason my distro’s 5.1 packages were built with Py2) and might code it if I’m bored.