summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-05-10 23:16:51 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-05-10 23:16:51 +0800
commitf1f07d74c41ad74be2b0bbad4cfcd1c6e5923678 (patch)
treeb04b2483827726049bc9c0955a877c750429c256
parent7fda8eb9f52b7be9cdf95807c036e3e1cfce3e7c (diff)
downloadgerbonara-f1f07d74c41ad74be2b0bbad4cfcd1c6e5923678.tar.gz
gerbonara-f1f07d74c41ad74be2b0bbad4cfcd1c6e5923678.tar.bz2
gerbonara-f1f07d74c41ad74be2b0bbad4cfcd1c6e5923678.zip
Offset of drill hit and slots
-rwxr-xr-xgerber/excellon.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/gerber/excellon.py b/gerber/excellon.py
index 09636aa..9a69042 100755
--- a/gerber/excellon.py
+++ b/gerber/excellon.py
@@ -100,7 +100,9 @@ class DrillHit(object):
min_y = position[1] - radius
max_y = position[1] + radius
return ((min_x, max_x), (min_y, max_y))
-
+
+ def offset(self, x_offset, y_offset):
+ self.position = tuple(map(operator.add, self.position, (x_offset, y_offset)))
class DrillSlot(object):
"""
@@ -134,6 +136,10 @@ class DrillSlot(object):
min_y = min(start[1], end[1]) - radius
max_y = max(start[1], end[1]) + radius
return ((min_x, max_x), (min_y, max_y))
+
+ def offset(self, x_offset, y_offset):
+ self.start = tuple(map(operator.add, self.start, (x_offset, y_offset)))
+ self.end = tuple(map(operator.add, self.end, (x_offset, y_offset)))
class ExcellonFile(CamFile):
@@ -268,7 +274,7 @@ class ExcellonFile(CamFile):
for primitive in self.primitives:
primitive.offset(x_offset, y_offset)
for hit in self. hits:
- hit.position = tuple(map(operator.add, hit.position, (x_offset, y_offset)))
+ hit.offset(x_offset, y_offset)
def path_length(self, tool_number=None):
""" Return the path length for a given tool