kiutils icon indicating copy to clipboard operation
kiutils copied to clipboard

Footprint with `fp_arc` versioning issue

Open zardini123 opened this issue 1 year ago • 0 comments

I found exporting a footprint with a fp_arc from KiUtils, KiCad fails to import it due to a syntax error in the fp_arc. From further investigation, I found that without specifying a footprint version number, KiCad imports the file using legacy syntax. Specifically, the version number evaluates to <= LEGACY_ARC_FORMATTING (fp_arc parsing source), where LEGACY_ARC_FORMATTING is of date 20210925 (date source). In the source of KiCad I found that they consider both (modules and (footprint as .kicad_mod files as modern due to first versions of .kicad_mod being (modules. Therefore the main differentiation is the version number provided in the footprint header.

The goal is to have footprint library files freshly exported from KiUtils be importable by KiCad. Currently this is not possible in whole due to files with fp_arc and the default version of None not importing in KiCad under the version KiUtils expects.

After exploring KiUtil's source for a couple days, I find fixing this issue might be a bit more loaded than I hoped. Footprints can be embedded in board files, but when as a standalone footprint library includes the version and generator token (footprint library documentation). Therefore attempting to set the default date in KiUtils to 20210926 (day after LEGACY_ARC_FORMATTING) would result in embedded footprints in boards with version numbers, which is against what the documentation suggests. My suggested "quick fix" is this:

  • Make a FootprintLib object (similar to SymbolLib) that houses the footprint object (Footprint) and its version and generator.
  • Set the default version number of FootprintLib to 20210926 (day after LEGACY_ARC_FORMATTING)

zardini123 avatar Feb 20 '23 17:02 zardini123