Skip to content

Commit 1e387ca

Browse files
committed
Some changes that will make kicad 6 support easier
1 parent c4864e4 commit 1e387ca

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

Stretch/kiplug/arc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def __init__(self):
4141
self.layer = ''
4242
self.fill = ''
4343
self.tstamp = ''
44+
self.net = ''
4445
self.status = 0
4546

4647
def From_PCB(self, input):
@@ -76,6 +77,9 @@ def From_PCB(self, input):
7677
if item[0] == 'tstamp':
7778
self.tstamp = item[1]
7879

80+
if item[0] == 'net':
81+
self.net = item[1]
82+
7983
if item[0] == 'status':
8084
self.status = item[1]
8185

Stretch/kiplug/board.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,29 @@ def From_PCB(self, pcb):
9191
self.layers = Layers()
9292
self.layers.From_PCB(item)
9393

94+
elif item[0] == 'footprint':
95+
# This is the new name of modules
96+
# KiCad 6 supports "module" as a legacy option
97+
# So that's what we will use.
98+
module = Module()
99+
module.From_PCB(item)
100+
self.module.append(module)
101+
94102
elif item[0] == 'module':
95103
module = Module()
96104
module.From_PCB(item)
97-
# print(module.fp_text[0].text)
98105
self.module.append(module)
99106

100107
elif item[0] == 'segment':
101108
segment = Segment()
102109
segment.From_PCB(item)
103110
self.segment.append(segment)
104111

112+
elif item[0] == 'arc':
113+
arc = Arc()
114+
arc.From_PCB(item)
115+
self.arc.append(arc)
116+
105117
elif item[0] == 'gr_arc':
106118
arc = Arc()
107119
arc.From_PCB(item)
@@ -160,6 +172,9 @@ def To_PCB(self):
160172
for item in self.segment:
161173
pcb.append(item.To_PCB())
162174

175+
for item in self.arc:
176+
pcb.append(item.To_PCB())
177+
163178
for item in self.gr_arc:
164179
pcb.append(item.To_PCB())
165180

@@ -214,6 +229,11 @@ def To_SVG(self):
214229
tag = BeautifulSoup(item.To_SVG(), 'html.parser')
215230
layer = item.layer
216231
base.svg.find('g', {'inkscape:label': layer}, recursive=False).append(tag)
232+
233+
for item in self.arc:
234+
tag = BeautifulSoup(item.To_SVG(), 'html.parser')
235+
layer = item.layer
236+
base.svg.find('g', {'inkscape:label': layer}, recursive=False).append(tag)
217237

218238
for item in self.module:
219239
tag = item.To_SVG(hiddenLayers = hiddenLayers)
@@ -309,6 +329,14 @@ def From_SVG(self, svg):
309329
segment = Segment()
310330
segment.From_SVG(tag, path)
311331
self.segment.append(segment)
332+
333+
elif tag['type'] == "arc":
334+
paths = parse_path(tag['d'])
335+
336+
for path in paths:
337+
arc = Arc()
338+
arc.From_SVG(tag, path)
339+
self.arc.append(arc)
312340

313341
elif tag['type'] == "gr_line":
314342
paths = parse_path(tag['d'])

0 commit comments

Comments
 (0)