Skip to content

Commit a9d4474

Browse files
committed
Add via support for easyeda
Fixes #477
1 parent 5915a24 commit a9d4474

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

InteractiveHtmlBom/ecad/easyeda.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,19 @@ def parse_track(self, shape):
113113

114114
return layer, segments_json
115115

116+
def parse_via(self, shape):
117+
print('Parsing via', shape)
118+
shape = self.tilda_split(shape)
119+
assert len(shape) >= 5, 'Invalid via ' + str(shape)
120+
x, y = self.normalize(shape[0]), self.normalize(shape[1])
121+
width = self.normalize(shape[2])
122+
return self.TOP_COPPER_LAYER, [{
123+
"type": "segment",
124+
"start": [x, y],
125+
"end": [x, y],
126+
"width": width
127+
}]
128+
116129
def parse_rect(self, shape):
117130
shape = self.tilda_split(shape)
118131
assert len(shape) >= 9, 'Invalid rect ' + str(shape)
@@ -387,6 +400,7 @@ def parse_shapes(self, shapes):
387400
shape = shape_str.split('~', 1)
388401
parse_func = {
389402
'TRACK': self.parse_track,
403+
'VIA': self.parse_via,
390404
'RECT': self.parse_rect,
391405
'CIRCLE': self.parse_circle,
392406
'SOLIDREGION': self.parse_solid_region,
@@ -398,6 +412,9 @@ def parse_shapes(self, shapes):
398412
if parse_func:
399413
layer, json_list = parse_func(shape[1])
400414
drawings.setdefault(layer, []).extend(json_list)
415+
print(shape[0], layer, json_list)
416+
if shape[0] == 'VIA':
417+
drawings.setdefault(self.BOT_COPPER_LAYER, []).extend(json_list)
401418
if shape[0] == 'LIB':
402419
layer, component, json, extras = self.parse_lib(shape[1])
403420
for drawing_layer, drawing in extras:

0 commit comments

Comments
 (0)