summaryrefslogtreecommitdiff
path: root/gerber/excellon_statements.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-18 23:13:23 -0500
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-18 23:13:23 -0500
commit5966d7830bda7f37ed5ddcc1bfccb93e7f780eaa (patch)
treeb5d96312c9dab598ec342d2215d235f2b00e8a48 /gerber/excellon_statements.py
parent4b92e1b59dcaff48bda4e1c906506432651fcd4f (diff)
downloadgerbonara-5966d7830bda7f37ed5ddcc1bfccb93e7f780eaa.tar.gz
gerbonara-5966d7830bda7f37ed5ddcc1bfccb93e7f780eaa.tar.bz2
gerbonara-5966d7830bda7f37ed5ddcc1bfccb93e7f780eaa.zip
Add offset operation
Diffstat (limited to 'gerber/excellon_statements.py')
-rw-r--r--gerber/excellon_statements.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/gerber/excellon_statements.py b/gerber/excellon_statements.py
index 356a96b..83a96a0 100644
--- a/gerber/excellon_statements.py
+++ b/gerber/excellon_statements.py
@@ -54,6 +54,9 @@ class ExcellonStatement(object):
def to_metric(self):
pass
+ def offset(self, x_offset=0, y_offset=0):
+ pass
+
def __eq__(self, other):
return self.__dict__ == other.__dict__
@@ -294,6 +297,12 @@ class CoordinateStmt(ExcellonStatement):
if self.y is not None:
self.y = metric(self.y)
+ def offset(self, x_offset=0, y_offset=0):
+ if self.x is not None:
+ self.x += x_offset
+ if self.y is not None:
+ self.y += y_offset
+
def __str__(self):
coord_str = ''
if self.x is not None:
@@ -426,6 +435,12 @@ class EndOfProgramStmt(ExcellonStatement):
if self.y is not None:
self.y = metric(self.y)
+ def offset(self, x_offset=0, y_offset=0):
+ if self.x is not None:
+ self.x += x_offset
+ if self.y is not None:
+ self.y += y_offset
+
class UnitStmt(ExcellonStatement):
@classmethod