From 5476da8aa3f4ee424f56f4f2491e7af1c4b7b758 Mon Sep 17 00:00:00 2001 From: Hamilton Kibbe Date: Thu, 21 Jan 2016 03:57:44 -0500 Subject: Fix a bunch of rendering bugs. - 'clear' polarity primitives no longer erase background - Added aperture macro support for polygons - Added aperture macro rendring support - Renderer now creates a new surface for each layer and merges them instead of working directly on a single surface - Updated examples accordingly --- gerber/common.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'gerber/common.py') diff --git a/gerber/common.py b/gerber/common.py index 04b6423..cf137dd 100644 --- a/gerber/common.py +++ b/gerber/common.py @@ -22,7 +22,6 @@ from .exceptions import ParseError from .utils import detect_file_format - def read(filename): """ Read a gerber or excellon file and return a representative object. @@ -73,5 +72,3 @@ def loads(data): return excellon.loads(data) else: raise TypeError('Unable to detect file format') - - -- cgit From 5df38c014fd09792995b2b12b1982c535c962c9a Mon Sep 17 00:00:00 2001 From: Hamilton Kibbe Date: Thu, 28 Jan 2016 12:19:03 -0500 Subject: Cleanup, rendering fixes. fixed rendering of tented vias fixed rendering of semi-transparent layers fixed file type detection issues added some examples --- gerber/common.py | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'gerber/common.py') diff --git a/gerber/common.py b/gerber/common.py index cf137dd..334714b 100644 --- a/gerber/common.py +++ b/gerber/common.py @@ -33,42 +33,41 @@ def read(filename): Returns ------- file : CncFile subclass - CncFile object representing the file, either GerberFile or - ExcellonFile. Returns None if file is not an Excellon or Gerber file. + CncFile object representing the file, either GerberFile, ExcellonFile, + or IPCNetlist. Returns None if file is not of the proper type. """ with open(filename, 'rU') as f: data = f.read() - fmt = detect_file_format(data) - if fmt == 'rs274x': - return rs274x.read(filename) - elif fmt == 'excellon': - return excellon.read(filename) - elif fmt == 'ipc_d_356': - return ipc356.read(filename) - else: - raise ParseError('Unable to detect file format') + return loads(data, filename) -def loads(data): +def loads(data, filename=None): """ Read gerber or excellon file contents from a string and return a representative object. Parameters ---------- data : string - gerber or excellon file contents as a string. + Source file contents as a string. + + filename : string, optional + String containing the filename of the data source. Returns ------- file : CncFile subclass - CncFile object representing the file, either GerberFile or - ExcellonFile. Returns None if file is not an Excellon or Gerber file. + CncFile object representing the data, either GerberFile, ExcellonFile, + or IPCNetlist. Returns None if data is not of the proper type. """ fmt = detect_file_format(data) if fmt == 'rs274x': - return rs274x.loads(data) + return rs274x.loads(data, filename) elif fmt == 'excellon': - return excellon.loads(data) + return excellon.loads(data, filename) + elif fmt == 'ipc_d_356': + return ipc356.loads(data, filename) else: - raise TypeError('Unable to detect file format') + raise ParseError('Unable to detect file format') + + -- cgit