-
Notifications
You must be signed in to change notification settings - Fork 0
/
line.py
75 lines (53 loc) · 1.45 KB
/
line.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from colour import Colour
# https://github.com/KiCad/kicad-source-mirror/blob/93466fa1653191104c5e13231dfdc1640b272777/pcbnew/plugins/kicad/pcb_parser.cpp#L2209
# 0 gr_line
# 1
# 0 start
# 1 66.66
# 2 99.99
# 2
# 0 end
# 1 66.66
# 2 99.99
# 3
# 0 layer
# 1 Edge.Cuts
# 4
# 0 width
# 1 0.05
# 5
# 0 tstamp
# 1 5E451B20
pxToMM = 96 / 25.4
class Line(object):
def __init__(self):
self.start = []
self.end = []
self.width = 0
self.layer = ''
self.fill = ''
self.tstamp = ''
self.status = ''
def From_PCB(self, input):
start = []
end = []
for item in input:
if type(item) == str:
#if item == 'gr_line' or item == 'fp_line':
continue
if item[0] == 'start':
self.start.append(float(item[1]))
self.start.append(float(item[2]))
if item[0] == 'end':
self.end.append(float(item[1]))
self.end.append(float(item[2]))
if item[0] == 'layer':
self.layer = item[1]
if item[0] == 'width':
self.width = item[1]
if item[0] == 'fill':
self.fill = item[1]
if item[0] == 'tstamp':
self.tstamp = item[1]
if item[0] == 'status':
self.status = item[1]