-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert_bom.py
More file actions
25 lines (21 loc) · 806 Bytes
/
Copy pathconvert_bom.py
File metadata and controls
25 lines (21 loc) · 806 Bytes
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
import csv
import pathlib
production = pathlib.Path(__file__).parent / "production"
positions = csv.reader((production / "positions.csv").open())
connectors = []
for row in positions:
reference, x, y, rotation, layer = row
if not reference.startswith("Module"):
continue
x = float(x)
y = float(y)
connectors.append((f"X{len(connectors) + 1}", x + 0.46, y - 21.5, rotation, layer))
connectors.append((f"X{len(connectors) + 1}", x - 33.46, y - 21.5, rotation, layer))
(production / "positions.csv").open(mode="a").write(
"\n".join(",".join(map(str, c)) for c in connectors) + "\n"
)
(production / "bom.csv").open(mode="a").write(
'"{}",10164227-1001A1RLF,{},10164227-1001A1RLF,C6782225'.format(
", ".join(r[0] for r in connectors), len(connectors)
)
)