eeschema: Field Name Templates not considered when resolving symbol field referencing variables in text blocks
Description
Text block variables with symbol fields (${refdes:field}
type) are only resolved when referencing property (field) instances attached to the symbol, but not when referencing Field Name Templates for which no value is assigned yet in the referenced symbol.
Steps to reproduce
In eeschema:
- Add a resistor, assign it reference
R1
. - In Schematic Setup, add a Field Name Template
Foobar
. - Create a text block containing
${R1:REFERENCE} has Foobar value ${R1:FOOBAR}.
.
Observed behavior
The field reference ${R1:FOOBAR}
is not resolved (instead, verbatim "${R1:FOOBAR}
" appears in the text block).
Expected behavior
The field reference ${R1:FOOBAR}
should be resolved to an empty value, just as for defined (but empty) symbol properties (fields). This is expected because in the Symbol Properties dialog, both internal field types (Template Fields and empty defined symbol fields) are listed with an empty value, indistinguishable from each other.
Probable reason
When creating the text block, field Foobar
is not (yet) a "defined property" of the symbol R1
instance, as the property (field) has not (yet) been assigned a non-empty value. I checked the resulting .kicad_sch
file and found no property "FooBar"
entry for R1
.
For the resolution of variables referencing symbol fields, Field Name Templates do not seem to be taken into account. This is an error, imho.
Further implications
The inability to resolve these variables also causes the internal conversion from reference (R1) to UUID to fail, which causes trouble later on, e.g. when re-annotating the schematic.
KiCad Version
Application: KiCad Schematic Editor
Version: 5.99.0-unknown-4594d88417~130~ubuntu20.04.1, release build
Libraries:
wxWidgets 3.0.4
libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Platform: Linux 5.4.0-77-generic x86_64, 64 bit, Little endian, wxGTK, xfce, x11
Build Info:
Date: Jun 28 2021 17:06:16
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.71.0
OCC: 7.3.0
Curl: 7.68.0
ngspice: 31
Compiler: GCC 9.3.0 with C++ ABI 1013
Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON