diff options
author | Paulo Henrique Silva <ph.silva@gmail.com> | 2019-11-27 11:44:13 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-27 11:44:13 -0300 |
commit | 1b65147f7abbb5b022fd746d99f69b3d50d7d805 (patch) | |
tree | 258035bc49f3f5166d0729e84ab4b9bfb059840f /gerber/pcb.py | |
parent | 77a156cea2411411922d0a755e4b4efab2a1b3d0 (diff) | |
parent | 4aca5b8a02be8d648b7a2d5f462c6b80c6a6edda (diff) | |
download | gerbonara-1b65147f7abbb5b022fd746d99f69b3d50d7d805.tar.gz gerbonara-1b65147f7abbb5b022fd746d99f69b3d50d7d805.tar.bz2 gerbonara-1b65147f7abbb5b022fd746d99f69b3d50d7d805.zip |
Merge pull request #99 from chintal/gEDA_layers
Correctly recognize gEDA pcb generated gerber filenames
Diffstat (limited to 'gerber/pcb.py')
-rw-r--r-- | gerber/pcb.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gerber/pcb.py b/gerber/pcb.py index 56deaa3..1d22e74 100644 --- a/gerber/pcb.py +++ b/gerber/pcb.py @@ -18,7 +18,7 @@ import os from .exceptions import ParseError -from .layers import PCBLayer, sort_layers +from .layers import PCBLayer, sort_layers, layer_signatures from .common import read as gerber_read from .utils import listdir @@ -41,7 +41,14 @@ class PCB(object): camfile = gerber_read(os.path.join(directory, filename)) layer = PCBLayer.from_cam(camfile) layers.append(layer) - names.add(os.path.splitext(filename)[0]) + name = os.path.splitext(filename)[0] + if len(os.path.splitext(filename)) > 1: + _name, ext = os.path.splitext(name) + if ext[1:] in layer_signatures(layer.layer_class): + name = _name + if layer.layer_class == 'drill' and 'drill' in ext: + name = _name + names.add(name) if verbose: print('[PCB]: Added {} layer <{}>'.format(layer.layer_class, filename)) |