empty lib field not written to lib

Asked by Theo Beisch

Not sure this is a bug or by design - hence posting as question.

I am moving an eagle lib thats annotated with vendor data to KiCad when I noticed this:

When you add a field (e.g. OC_FARNELL) to a symbol and not enter any text/value the field is not saved to the lib file.
Actually the symbol editor seems to cache it and still keeps showing it as valid property.
Only when you exit and reload the lib the field is gone.

KiCad 5.1.2 on W10 btw...

Question information

Language:
English Edit question
Status:
Solved
For:
KiCad Edit question
Assignee:
No assignee Edit question
Solved by:
Theo Beisch
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Jeff Young (jeyjey) said :
#1

It is by design (although one might question the design).

If you want to have global field definitions you can create them in Preferences > Eeschema > Field Name Templates. They still don't get saved unless they have content, but the template ensures that they have consistent names (when they are given content) across symbols.

Revision history for this message
Theo Beisch (tb3000) said :
#2

Thanks Jeff Young, that solved my question.

Revision history for this message
Theo Beisch (tb3000) said :
#3

Jeff, Thanks for your fast response! Interesting that's in Eeschema and not in Symbol Editor.

Revision history for this message
Theo Beisch (tb3000) said :
#4

Actually this seems a bit inconsistent (please forgive the newcomer) - I can add these attributes in Eeschema but they do not propagate - not even if I open a part from Eeschema in the symbol editor.

Wouldn't it make sense to define - at least some - attributes on a symbol level rather than at the sheet (override option at sheet of case if project specific) - especially for migration cases from e.g. Eagle where companies have years of annotation inside their libs and don't want to lose that?

Revision history for this message
Wayne Stambaugh (stambaughw) said :
#5

Symbol library fields 0-3 are mandatory so even if they are empty, they will be written to the library. All other fields are optional and are not written to the library when they are empty. Adding fields to a symbol in the schematic has no influence on the library symbol. They are completely separate entities. Schematic fields supersede the library fields. Schematic sheets have nothing to do with either the schematic and/or library fields other than the reference field in complex hierarchies.

Revision history for this message
Theo Beisch (tb3000) said :
#6

Making some progress - updating the eagle-lbr2kicad ULP - I have had success exporting EAGLE attributes to F4.. fields in the symbols lib. One question arises: if I am e.g. using F4 as "MF", F5 as "MPN", and so on - does it matter for future field use (BOM etc) that the relationship stays as initially mapped (like F4 always being "MF" if once assigned "MF") or is just the property Name relevant (meaning I can assign any sequence of attributes to F4 and above and )?

Revision history for this message
Jeff Young (jeyjey) said :
#7

Only the property name should be relevant.

(You could write a BOM generator that looked at the field index, but I'd consider that at best poor design and at worst buggy.)

Revision history for this message
Theo Beisch (tb3000) said :
#8

Great, thanks! I will publish the updated ULP via the original developer once done.