Add support for PCBmodE generated files.
PCBmodE uses a standard but probably undefined behaviour issue on Gerber where it defines circle apertures with a single modifier but leaves a trilling 'X' after it. 'X' is modifiers separator but when there is only one modifier the behaviour is undefined. For parsing we are just ignoring blank modifiers. Test updated to catch this case.
This commit is contained in:
parent
8ec3077be9
commit
d3b19efb48
2 changed files with 19 additions and 1 deletions
|
|
@ -293,7 +293,7 @@ class ADParamStmt(ParamStmt):
|
|||
self.d = d
|
||||
self.shape = shape
|
||||
if modifiers:
|
||||
self.modifiers = [tuple([float(x) for x in m.split("X")]) for m in modifiers.split(",") if len(m)]
|
||||
self.modifiers = [tuple([float(x) for x in m.split("X") if len(x)]) for m in modifiers.split(",") if len(m)]
|
||||
else:
|
||||
self.modifiers = [tuple()]
|
||||
|
||||
|
|
|
|||
|
|
@ -635,6 +635,24 @@ def test_ADParamStmt_factory():
|
|||
assert_equal(ad.d, 1)
|
||||
assert_equal(ad.shape, 'R')
|
||||
|
||||
stmt = {'param': 'AD', 'd': 1, 'shape': 'C', "modifiers": "1.42"}
|
||||
ad = ADParamStmt.from_dict(stmt)
|
||||
assert_equal(ad.d, 1)
|
||||
assert_equal(ad.shape, 'C')
|
||||
assert_equal(ad.modifiers, [(1.42,)])
|
||||
|
||||
stmt = {'param': 'AD', 'd': 1, 'shape': 'C', "modifiers": "1.42X"}
|
||||
ad = ADParamStmt.from_dict(stmt)
|
||||
assert_equal(ad.d, 1)
|
||||
assert_equal(ad.shape, 'C')
|
||||
assert_equal(ad.modifiers, [(1.42,)])
|
||||
|
||||
stmt = {'param': 'AD', 'd': 1, 'shape': 'R', "modifiers": "1.42X1.24"}
|
||||
ad = ADParamStmt.from_dict(stmt)
|
||||
assert_equal(ad.d, 1)
|
||||
assert_equal(ad.shape, 'R')
|
||||
assert_equal(ad.modifiers, [(1.42, 1.24)])
|
||||
|
||||
def test_ADParamStmt_conversion():
|
||||
stmt = {'param': 'AD', 'd': 0, 'shape': 'C', 'modifiers': '25.4X25.4,25.4X25.4'}
|
||||
ad = ADParamStmt.from_dict(stmt)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue