Kicad_sch V6 file format and components/units

I’m trying to write a parser for kicad_sch v6 files, by following the document specification at S-Expression Format | Developer Documentation | KiCad and it seems there is a discrepancy between the specification document and the actual format in the library structure.

The documentation states that

The optional UNITS can be one or more child symbol tokens embedded in a parent symbol

So we have similar looking symbol stuff but for units.

When I peep at a simple symbol in a real file I can read this:

    (symbol "power:GND" (power) (pin_names (offset 0)) (in_bom yes) (on_board yes)
      (property "Reference" "#PWR" (id 0) (at 0 -6.35 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "Value" "GND" (id 1) (at 0 -3.81 0)
        (effects (font (size 1.27 1.27)))
      )
      (property "Footprint" "" (id 2) (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "Datasheet" "" (id 3) (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "ki_keywords" "power-flag" (id 4) (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (property "ki_description" "Power symbol creates a global label with name \"GND\" , ground" (id 5) (at 0 0 0)
        (effects (font (size 1.27 1.27)) hide)
      )
      (symbol "GND_0_1"
        (polyline
          (pts
            (xy 0 0)
            (xy 0 -1.27)
            (xy 1.27 -1.27)
            (xy 0 -2.54)
            (xy -1.27 -1.27)
            (xy 0 -1.27)
          )
          (stroke (width 0)) (fill (type none))
        )
      )
      (symbol "GND_1_1"
        (pin power_in line (at 0 0 270) (length 0) hide
          (name "GND" (effects (font (size 1.27 1.27))))
          (number "1" (effects (font (size 1.27 1.27))))
        )
      )
    )

For a component as simple as GND, I don’t understand the presence of two units which obviously make a single symbol in reality. Moreover, the units don’t hold on_board or in_bom fields when these fields are indicated to be mandatory.

One final point is: if the units are no longer v5 units, how are they managed?

Hello
I am writing a parser too. As I understand, “0” means your polyline will appear in all your unit, in your case in unit 1.
https://dev-docs.kicad.org/en/file-formats/sexpr-intro/index.html#_symbol_unit_identifier

1 Like

Thanks for pointing me to the documentation chunk about this management. My only word is: WTF…

Here’s a clarification that 0 can be used for both, UNIT and STYLE as well.

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