From 60784dfa2107f72fcaeed739b835d647e4c3a7a9 Mon Sep 17 00:00:00 2001 From: Garret Fick Date: Sat, 16 Jan 2016 18:33:40 +0800 Subject: Skip over a strange excellon statement --- gerber/excellon.py | 9 ++++++--- gerber/ncparam/allegro.py | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 gerber/ncparam/allegro.py diff --git a/gerber/excellon.py b/gerber/excellon.py index cdd6d8d..4317e41 100755 --- a/gerber/excellon.py +++ b/gerber/excellon.py @@ -500,9 +500,12 @@ class ExcellonParser(object): self.statements.append(infeed_rate_stmt) elif line[0] == 'T' and self.state == 'HEADER': - tool = ExcellonTool.from_excellon(line, self._settings()) - self.tools[tool.number] = tool - self.statements.append(tool) + if not ',OFF' in line and not ',ON' in line: + tool = ExcellonTool.from_excellon(line, self._settings()) + self.tools[tool.number] = tool + self.statements.append(tool) + else: + self.statements.append(UnknownStmt.from_excellon(line)) elif line[0] == 'T' and self.state != 'HEADER': stmt = ToolSelectionStmt.from_excellon(line) diff --git a/gerber/ncparam/allegro.py b/gerber/ncparam/allegro.py new file mode 100644 index 0000000..a67bcf1 --- /dev/null +++ b/gerber/ncparam/allegro.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright 2015 Garret Fick + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Allegro File module +==================== +**Excellon file classes** + +Extra parsers for allegro misc files that can be useful when the Excellon file doesn't contain parameter information +""" + -- cgit