dvc94ch / pykicad

Library for working with KiCAD file formats
ISC License
64 stars 18 forks source link

failed to parse this definition #1

Closed wez closed 7 years ago

wez commented 7 years ago

pykicad had trouble parsing this keyswitch definition

 pos (19.05, -10.16) size (1.778, 1.778)
   1: (module Mx_Alps_100 (layer F.Cu) (tedit 58057B75)
   2:   (descr MXALPS)
   3:   (tags MXALPS)
   4:   (fp_text reference >NAME (at 0 4.318) (layer B.SilkS)
   5:     (effects (font (size 1 1) (thickness 0.2)) (justify mirror))
   6:   )
   7:   (fp_text value >VALUE (at 5.334 10.922) (layer B.SilkS) hide
   8:     (effects (font (thickness 0.3048)) (justify mirror))
   9:   )
  10:   (fp_line (start -6.35 -6.35) (end 6.35 -6.35) (layer Cmts.User) (width 0.1524))
  11:   (fp_line (start 6.35 -6.35) (end 6.35 6.35) (layer Cmts.User) (width 0.1524))
  12:   (fp_line (start 6.35 6.35) (end -6.35 6.35) (layer Cmts.User) (width 0.1524))
  13:   (fp_line (start -6.35 6.35) (end -6.35 -6.35) (layer Cmts.User) (width 0.1524))
  14:   (fp_line (start -9.398 -9.398) (end 9.398 -9.398) (layer Dwgs.User) (width 0.1524))
  15:   (fp_line (start 9.398 -9.398) (end 9.398 9.398) (layer Dwgs.User) (width 0.1524))
  16:   (fp_line (start 9.398 9.398) (end -9.398 9.398) (layer Dwgs.User) (width 0.1524))
  17:   (fp_line (start -9.398 9.398) (end -9.398 -9.398) (layer Dwgs.User) (width 0.1524))
  18:   (fp_line (start -6.35 -6.35) (end -4.572 -6.35) (layer F.SilkS) (width 0.381))
  19:   (fp_line (start 4.572 -6.35) (end 6.35 -6.35) (layer F.SilkS) (width 0.381))
  20:   (fp_line (start 6.35 -6.35) (end 6.35 -4.572) (layer F.SilkS) (width 0.381))
  21:   (fp_line (start 6.35 4.572) (end 6.35 6.35) (layer F.SilkS) (width 0.381))
  22:   (fp_line (start 6.35 6.35) (end 4.572 6.35) (layer F.SilkS) (width 0.381))
  23:   (fp_line (start -4.572 6.35) (end -6.35 6.35) (layer F.SilkS) (width 0.381))
  24:   (fp_line (start -6.35 6.35) (end -6.35 4.572) (layer F.SilkS) (width 0.381))
  25:   (fp_line (start -6.35 -4.572) (end -6.35 -6.35) (layer F.SilkS) (width 0.381))
  26:   (fp_line (start -6.985 -6.985) (end 6.985 -6.985) (layer Eco2.User) (width 0.1524))
  27:   (fp_line (start 6.985 -6.985) (end 6.985 6.985) (layer Eco2.User) (width 0.1524))
  28:   (fp_line (start 6.985 6.985) (end -6.985 6.985) (layer Eco2.User) (width 0.1524))
  29:   (fp_line (start -6.985 6.985) (end -6.985 -6.985) (layer Eco2.User) (width 0.1524))
  30:   (fp_line (start -7.75 6.4) (end -7.75 -6.4) (layer Dwgs.User) (width 0.3))
  31:   (fp_line (start -7.75 6.4) (end 7.75 6.4) (layer Dwgs.User) (width 0.3))
  32:   (fp_line (start 7.75 6.4) (end 7.75 -6.4) (layer Dwgs.User) (width 0.3))
  33:   (fp_line (start 7.75 -6.4) (end -7.75 -6.4) (layer Dwgs.User) (width 0.3))
  34:   (fp_line (start -7.62 -7.62) (end 7.62 -7.62) (layer Dwgs.User) (width 0.3))
  35:   (fp_line (start 7.62 -7.62) (end 7.62 7.62) (layer Dwgs.User) (width 0.3))
  36:   (fp_line (start 7.62 7.62) (end -7.62 7.62) (layer Dwgs.User) (width 0.3))
  37:   (fp_line (start -7.62 7.62) (end -7.62 -7.62) (layer Dwgs.User) (width 0.3))
  38:   (pad HOLE np_thru_hole circle (at 0 0) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu))
  39:   (pad HOLE np_thru_hole circle (at -5.08 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu))
  40:   (pad HOLE np_thru_hole circle (at 5.08 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu))
  41:   (pad 1 thru_hole oval (at -3.405 -3.27 330.95) (size 2.5 4.17) (drill oval 1.5 3.17) (layers *.Cu *.Mask F.SilkS))
  42:   (pad 2 thru_hole oval (at 2.52 -4.79 356.1) (size 2.5 3.08) (drill oval 1.5 2.08) (layers *.Cu *.Mask F.SilkS))
  43: )
  44:
Traceback (most recent call last):
  File "./kbdmakerutils", line 1291, in <module>
    circuit = kicad_schematic(physical_matrix, shapes)
  File "./kbdmakerutils", line 1113, in kicad_schematic
    csw = circuit.keyswitch()
  File "/Users/wez/src/kbdmakerutils/circuitlib.py", line 278, in keyswitch
    'Keebs:Mx_Alps_100')
  File "/Users/wez/src/kbdmakerutils/circuitlib.py", line 200, in part
    module = self.footprintpcb.parseFootprintModule(footprint)
  File "/Users/wez/src/kbdmakerutils/kicadpcb.py", line 128, in parseFootprintModule
    module = pykicad.module.parse_module('%s/%s.kicad_mod' % (lib, compname))
  File "pykicad/pykicad/module.py", line 565, in parse_module
    return Module.parse(module)
  File "pykicad/pykicad/module.py", line 500, in parse
    return Module.from_tag(Module.parser().parseString(string)[0])
  File "./deps/usr/local/lib/python2.7/site-packages/pyparsing.py", line 1632, in parseString
    raise exc
pyparsing.ParseException: Expected ")" (at char 85), (line:4, col:3)
wez commented 7 years ago

effects can have an optional justify property.

In addition, the size property of font is also optional, not required.