easyeda2kicad.py icon indicating copy to clipboard operation
easyeda2kicad.py copied to clipboard

Adding a part with a colon in the name causes creation of invalid symbol

Open itsumimario opened this issue 1 year ago • 1 comments

When adding a part that has a colon in the name, the script creates a symbol that Kicad doesn't like, and will give an error message saying something like "invalid prefix at line 56 offset 14". For example, part C26393 will do this.

The solution is to substitute "{colon}" for ":" in the symbol name.

For example, here is the invalid symbol that the script generates:

(kicad_symbol_lib (version 20220914) (generator kicad_symbol_editor)
  (symbol "MT48LC16M16A2P-6AIT:G" (in_bom yes) (on_board yes)
    (property "Reference" "U" (at 0 38.1 0)
      (effects (font (size 1.27 1.27)))
    )
    (property "Value" "MT48LC16M16A2P-6A IT:G" (at 0 -38.1 0)
      (effects (font (size 1.27 1.27)))
    )
    (property "Footprint" "easyeda2kicad:TSOP-54_L22.2-W10.2-P0.80-LS11.8-BL" (at 0 -40.64 0)
      (effects (font (size 1.27 1.27)) hide)
    )
    (property "Datasheet" "https://lcsc.com/product-detail/RAM_Micron_MT48LC16M16A2P-6AIT-G_MT48LC16M16A2P-6AIT-G_C26393.html" (at 0 -43.18 0)
      (effects (font (size 1.27 1.27)) hide)
    )
    (property "Manufacturer" "micron(镁光)" (at 0 -45.72 0)
      (effects (font (size 1.27 1.27)) hide)
    )
    (property "LCSC Part" "C26393" (at 0 -48.26 0)
      (effects (font (size 1.27 1.27)) hide)
    )
    (property "JLC Part" "Extended Part" (at 0 -50.8 0)
      (effects (font (size 1.27 1.27)) hide)
    )
    (symbol "MT48LC16M16A2P-6AIT:G_0_1"
      (rectangle (start -8.89 35.56) (end 8.89 -35.56)
        (stroke (width 0) (type default))
        (fill (type background))
      )
      (circle (center -7.62 34.29) (radius 0.38)
        (stroke (width 0) (type default))
        (fill (type none))
      )
... blah blah blah
    )
  )
)

But it will work if you substitute two of the ":" instances with "{colon}" like this:

(kicad_symbol_lib (version 20220914) (generator kicad_symbol_editor)
  (symbol "MT48LC16M16A2P-6AIT{colon}G" (in_bom yes) (on_board yes)
    (property "Reference" "U" (at 0 38.1 0)
      (effects (font (size 1.27 1.27)))
    )
    (property "Value" "MT48LC16M16A2P-6A IT:G" (at 0 -38.1 0)
      (effects (font (size 1.27 1.27)))
    )
    (property "Footprint" "easyeda2kicad:TSOP-54_L22.2-W10.2-P0.80-LS11.8-BL" (at 0 -40.64 0)
      (effects (font (size 1.27 1.27)) hide)
    )
    (property "Datasheet" "https://lcsc.com/product-detail/RAM_Micron_MT48LC16M16A2P-6AIT-G_MT48LC16M16A2P-6AIT-G_C26393.html" (at 0 -43.18 0)
      (effects (font (size 1.27 1.27)) hide)
    )
    (property "Manufacturer" "micron(镁光)" (at 0 -45.72 0)
      (effects (font (size 1.27 1.27)) hide)
    )
    (property "LCSC Part" "C26393" (at 0 -48.26 0)
      (effects (font (size 1.27 1.27)) hide)
    )
    (property "JLC Part" "Extended Part" (at 0 -50.8 0)
      (effects (font (size 1.27 1.27)) hide)
    )
    (symbol "MT48LC16M16A2P-6AIT{colon}G_0_1"
      (rectangle (start -8.89 35.56) (end 8.89 -35.56)
        (stroke (width 0) (type default))
        (fill (type background))
      )
      (circle (center -7.62 34.29) (radius 0.38)
        (stroke (width 0) (type default))
        (fill (type none))
      )
... blah blah blah
    )
  )
)

itsumimario avatar Mar 24 '23 15:03 itsumimario

I also encounter this problem

boromyr avatar Sep 24 '23 13:09 boromyr