summaryrefslogtreecommitdiff
path: root/gerber/rs274x.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2016-11-06 14:44:40 -0500
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2016-11-06 14:44:40 -0500
commit422c86bcc684ea94515862b0dd3a39ce0f4bd86f (patch)
treea1efe6504e40083e61dcbe412c243fd8c00628f3 /gerber/rs274x.py
parentede065e6d16e1e4ffe970c8b13945139b3f4bcb2 (diff)
parent22e668c75f24174d2090443ed98e804b3737bd84 (diff)
downloadgerbonara-422c86bcc684ea94515862b0dd3a39ce0f4bd86f.tar.gz
gerbonara-422c86bcc684ea94515862b0dd3a39ce0f4bd86f.tar.bz2
gerbonara-422c86bcc684ea94515862b0dd3a39ce0f4bd86f.zip
Merge upstream changes
Diffstat (limited to 'gerber/rs274x.py')
-rw-r--r--gerber/rs274x.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/gerber/rs274x.py b/gerber/rs274x.py
index 2f8dfd2..5d64597 100644
--- a/gerber/rs274x.py
+++ b/gerber/rs274x.py
@@ -50,7 +50,7 @@ def read(filename):
return GerberParser().parse(filename)
-def loads(data):
+def loads(data, filename=None):
""" Generate a GerberFile object from rs274x data in memory
Parameters
@@ -58,12 +58,15 @@ def loads(data):
data : string
string containing gerber file contents
+ filename : string, optional
+ string containing the filename of the data source
+
Returns
-------
file : :class:`gerber.rs274x.GerberFile`
A GerberFile created from the specified file.
"""
- return GerberParser().parse_raw(data)
+ return GerberParser().parse_raw(data, filename)
class GerberFile(CamFile):
@@ -531,6 +534,7 @@ class GerberParser(object):
else:
aperture = self.macros[shape].build(modifiers)
+ aperture.units = self.settings.units
self.apertures[d] = aperture
def _evaluate_mode(self, stmt):
@@ -649,7 +653,6 @@ class GerberParser(object):
elif self.op == "D03" or self.op == "D3":
primitive = copy.deepcopy(self.apertures[self.aperture])
-
if primitive is not None:
if not isinstance(primitive, AMParamStmt):