summaryrefslogtreecommitdiffstats
path: root/case/place.py
blob: fa42711529bd46aa9a5d17a1827ec9c9f3da67bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from case import gridify, shape2points, design

header = "# Ref Val Package PosX PosY Rot Side"
fmt =    "{}{}  *   *       {}   {}   {}  {}"
print(header)

points = gridify(shape2points(design["shape"]))
for i, (y, x) in enumerate(points, start=1):
  x += 26
  y += 126

  i = i - 3
  if i <= 0:
    i += 48 + 3

  d_rot = -90
  rgb_rot = 0
  if (i-1)%12 >= 6:
    d_rot += 180
  if (i-1)%24 >= 12:
    rgb_rot += 180

  print(fmt.format("S", i, x, -y, 0, "top"))
  print(fmt.format("D", i, x, -y - 9.5, d_rot, "bottom"))
  print(fmt.format("RGB", i, x, 4.7-y, rgb_rot, "top"))