input = """(pad 8 smd rect (at -1.905 -3.12) (size 0.5 1.2) (layers F.Paste))
(pad 7 smd rect (at -0.635 -3.12) (size 0.5 1.2) (layers F.Paste))
(pad 6 smd rect (at 0.635 -3.12) (size 0.5 1.2) (layers F.Paste))
(pad 5 smd rect (at 1.905 -3.12) (size 0.5 1.2) (layers F.Paste))
(pad 4 smd rect (at 1.905 3.12) (size 0.5 1.2) (layers F.Paste))
(pad 1 smd rect (at -0.64 2.5) (size 0.85 0.5) (layers F.Paste))
(pad 1 smd rect (at 0.46 2.5) (size 0.85 0.5) (layers F.Paste))
(pad 1 smd rect (at -1.74 2.5) (size 0.85 0.5) (layers F.Paste))
(pad 3 smd rect (at 0.635 3.295) (size 0.5 0.85) (layers F.Paste))
(pad 2 smd rect (at -0.635 3.295) (size 0.5 0.85) (layers F.Paste))
(pad 1 smd rect (at -1.905 3.295) (size 0.5 0.85) (layers F.Paste))
(pad 5 smd rect (at 0.85 0.21) (size 1.5 1.5) (layers F.Paste))
(pad 5 smd rect (at -0.85 0.21) (size 1.5 1.5) (layers F.Paste))
(pad 5 smd rect (at -0.85 -1.49) (size 1.5 1.5) (layers F.Paste))
(pad 5 smd rect (at 0.85 -1.49) (size 1.5 1.5) (layers F.Paste))"""

def get_xy_wh(l):
  seg= l.split(" ")
  return (float(seg[5]), float(seg[6][:-1]), float(seg[8]), float(seg[9][:-1]))
lines = [l for l in map(get_xy_wh, input.split("\n"))]
print(lines)

for (x, y, w, h) in lines:
  lx, ux, ly, uy = x - w/2, x + w/2, y - h/2, y + h/2
  print("""  (fp_poly (pts (xy {} {}) (xy {} {}) (xy {} {}) (xy {} {})) (layer F.Paste)  (width 0.1))""".format(
    lx, ly, lx, uy, ux, uy, ux, ly
    ))
