Filename in the layout

I am used to using Eagle PCB, but I have -of cause- realized that KiCad is the future.

In Eagle PCB it is possible to add a key-text in the layout. For example: >filename. The more-than sign indicates that the “filename” should be substituted for the current filename of the layout file.

This is a very handy feature, because if a is PCB coming back from a customer (after years), you can read directly of the PCB what the filename and version it is.

This is essential, so that you don’t have to rely on your memory to change the text on the PCB each time you change filename or version. I always name my files something like xyz_A, xyz_B, xyz_C, … With a new letter each time I order PCB.
Having the text “xyz_B” on the PCB therefore helps to find the corresponding layout file in the right version.

Try this:

  1. Open schematic editor.
  2. Press T to open a text box.
  3. Type in: ${F
  4. KiCad now shows a list of pre-defined names starting with F.
  5. Choose one (or type it out).
  6. Add the closing Brace (“curly bracket”?)
2 Likes

To add to Paulvdh’s answer, all of the text variables in the PCB editor are listed here: PCB Editor | 7.0 | English | Documentation | KiCad

2 Likes

Thanks. That helped me part of the way.

The ${filename} option seems NOT to be available in layout. And when a PCB is coming back from a customer, you really need to have the right filename on the PCB, so you can find the file that was used for this particular board.

${FILENAME} does work in KiCad-Nightly V7.99, but not in V7.0.10. KiCad-Nightly also has a ${FILEPATH} that expands to the full path (inclusive filename). In V7.0.10 I also see differences in available variables between the schematic editor and the PCB editor.

But also, to identify a PCB or a project, I would not want to trust on an automatic variable. Having them updated manually has some advantages, but changing it too often and unintended is not a good thing.

KiCad also has Footprint Editor / File / Create Footprint / BARCODE USS-39 and there is a generator for QR codes too. Maybe you can make use of those.

1 Like

Thanks!!
You write: " I would not want to trust an automatic variable."
I think: “I don’t what trust myself to remember to update a dumb variable.”

I have used the equivalent of ${FILENAME} for a long time, and it has always served me well. And therefore, it is comforting to know, that I can continue the tradition.
Old habits die hard.

I like the BARCODE idea and I know it is the most professionel method. But I don’t have a barcode reader. For my projects, I like to just “read by eye”. :slight_smile:

The variables in 7.0.10 are generally not working… or I have misunderstud the documentation.

I fill in the page settings, and the information is moved -as expected- to the schematic sheet.

but the variables are not changed to the PCB.

There are some “strange” text strings, in the variables that I don’t know where they are coming from.

I have saved schematic and PCB, re-updated PCB (hit F8) a few times it does not change anything.

You are editing the schematic’s title sheet but dereferencing the variables in the layout. You should be editing the layout’s title sheet. It works for me.

1 Like

Ups, I see what you mean. That was very unexpected to me.
KiCad basically have two sets of variables, one for the schematic and one for the layout.

To be frank, I don’t think that it makes sense to have this double speak. I cannot see a case where one company owns the schematic and another owns the layout. But as consultant, I can see a case where I sell a PCB service to one company, and then another company comes along and orders a similar PCB. Then you have the troubles, when you only remembers to change the schematic’s title sheet.

Keep it simple. Don’t have two sets of variables with the same name.

1 Like

If you want one set of variables, you can add your own project-wide variables in the board/schematic setup window → text variables pane. You can then use those anywhere in the project (board or schematic, including in your sheet title block) with ${MY_PROJECT_WIDE_VARIABLE}.

The system variables are often different between schematic and board because they refer directly to fields in the current sheet’s title block, and the sheet title block can have different values between the board layout and the schematic (not to mention different values between schematic sheets). Your PCB might be on a different rev than your schematic, or they might have different issue dates, or different engineers, and all your schematic sheets will likely have different titles.

2 Likes

This is what I don’t want. I am a simple man, and I need a simple system. Therefore, every time I order new PCB, I give change the last letter of the filename (from “_A”, to “_B”, to “_C”, etc). And both layout and schematic get the same name.
If I order the same again PCB with a new BOM, then I change the filename from “_B” to “_B1” to “_B2”.

The important thing is, that every time I order something, I save layout and schematic with the same “_B2” in a folder ending with “_B2”. And when the PCB has the filename_B2 printed in the top_copper layer, I can always find the layout and schematic. Even when a board comes back from a customer after several years.

That’s fair and mostly what I do too - I make a ${PROJECT_REV} project variable and then reference that in my title blocks and somewhere on my PCB silk. You can even use the variable in your Gerber export filename to get versioned fab files. When I update the variable, it gets propagated everywhere I use it automatically.

(But note that the project text variable definitions are stored in the .kicad_pro file, so if you’re making versioned copies of your project, you’d probably want to copy the whole project, not just the board file)

1 Like

Yes, I got to get used to this project file. It is something that Eagle PCB don’t have.

Yes, we are probably doing mostly the same, but I don’t understand how you find your files: When somebody gives you an old PCB you have made and you read the ${PROJECT_REV} in the silkprint, how do you then find the correct project file? Are you relying on your memory? That is not a viable option for me. :frowning:

I use git so I would do a git tag that corresponds to every rev and matches the board silk, but I think your process is different.

For your workflow, you can do a save as from the project manager (main KiCad window) that will rename all of your design files to whatever you want (which you’d want to include the rev letter).

Or if you see each rev more as an artifact that is only used for reference, you could archive the project and give the archive your rev filename.

Yes, this sounds very much like what I want to do. The only thing is that the filename from the project manager needs to be automatically transferred to schematic and layout. If this can be handled by ${filename}, then it will work.

This is stretching the limits, because then I would need to type the revision in two places.

My things needs to be 100% poka yoke.

Yeah I think that makes sense for your workflow.

And now I want a new automatic variable that resolves to the most recent git tag, for my workflow :slight_smile:

2 Likes

You can do this if you are using CLI to plot, by injecting a variable override on the command line from the output of a git command.

1 Like

That is a good point. And I don’t want exactly the most recent tag, I’d want some concoction of git describe probably.

I ran into issues with text variables with Kicad before. Please see Text Variables in KiCad.

The drawing frame / border around the schematic or PCB even accepts text variables in a “%F” notation Drawing Sheet Editor documentation.

You can define your own text variables in Schematic / PCB configuration. These are stored in the *.kicad_pro file and expand both in schematics and PCB. Maybe that helps.

1 Like

The new release candidate (8.0.0-rc1, Windows 10) has solved a lot of problems with the text variables. As far as I can tell, it is working perfectly.

It is a huge step forward!

1 Like