summaryrefslogtreecommitdiff
path: root/gerber/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'gerber/__init__.py')
-rw-r--r--gerber/__init__.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/gerber/__init__.py b/gerber/__init__.py
index 0bf7c24..089d7b6 100644
--- a/gerber/__init__.py
+++ b/gerber/__init__.py
@@ -14,3 +14,18 @@
# 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.
+
+
+def read(filename):
+ """ Read a gerber or excellon file and return a representative object.
+ """
+ import gerber
+ import excellon
+ from utils import detect_file_format
+ fmt = detect_file_format(filename)
+ if fmt == 'rs274x':
+ return gerber.read(filename)
+ elif fmt == 'excellon':
+ return excellon.read(filename)
+ else:
+ return None