Issue using ${FILENAME} / ${PROJECTNAME} in drawing title block

I did some trials using Variables in Kicad before.

Now I want to create my own title block for the drawing frame.
The KiCad Documentation lists the available build in variables.

If you place ${FILENAME} anywhere in a text box in your schematic you’ll get “the Filename of the root schematic sheet, with a file extension”. Just as described in the documentation.

But the drawing sheet template also uses ${FILENAME}, but this expands to the filename of the current schematic page. So if you are doing a project with several sheets the filename here will not be the root filename unless you are on the root schematic.

If you have a text box with ${FILENAME} on the sheet this will give you the root filename, but the variable ${FILENAME} in the frame will give you the name of the (sub) schematic.

Then the documentation lists the variable ${PROJECTNAME}. It should return the “Project name, without a file extension”. This variable also expands nicely anwhere on the sheet if placed into a text box.
But it does not expand when used in the drawing sheet template. Here ${PROJECTNAME} is printed.

This seems to be a bug.

I am using KiCad Schematic Editor x64 on x64, Version: 7.0.9, release build on Windows 10 (build 19045), 64-bit edition

Different variables are available in different places. The documentation you link says:

The following variables can be used in schematic text, label names, label fields, hierarchical sheet fields, symbol text, and symbol fields.

I think that’s accurate? If you think it’s misleading or not accurate, let me know and I can improve it (I wrote it).

If you’re making your own drawing sheet, presumably you’re using the drawing sheet editor. Variable usage in the drawing sheet editor would be described in the drawing sheet editor documentation, but unfortunately that section is pretty out of date and doesn’t describe the text variable system.

This is what the Drawing sheet editor says it offers . . .

image

That’s the syntax help window? That’s a good point, you can always check that.

For the most part I didn’t write the various syntax help windows, but at first glance it seems to match what OP reports (FILENAME is available, PROJECTNAME is not).

A self defined text variable $MYPROJECTPATH (located in *.kicad.pro) will be correctly expanded in the text block. It is irritating why the internal variables have a different / no function in the frame (from drawing sheet editor) compared to the drawing sheet itself.

I would appreciate if the documentation for Eeschema would also be applicable for the drawing template editor.

By the way: The Help function from the drawing template editor takes me here. Using the ${variable} is not mentioned here. Instead printf replacement with %F is mentioned. Is this a legacy method? It would be great to have a common way of working with text variable throughout the complete KiCad suite.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.