summaryrefslogtreecommitdiff
path: root/gerber
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-04-05 22:40:12 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-04-05 22:40:12 +0800
commit2eac1e427ca3264cb6dc36e0712020c1ca73fa9c (patch)
treed12de1805441100fb7c5dbe97aed3bc051a60713 /gerber
parentad29fac87358a43f50357580e705fc389f02c1ad (diff)
downloadgerbonara-2eac1e427ca3264cb6dc36e0712020c1ca73fa9c.tar.gz
gerbonara-2eac1e427ca3264cb6dc36e0712020c1ca73fa9c.tar.bz2
gerbonara-2eac1e427ca3264cb6dc36e0712020c1ca73fa9c.zip
Fix converting values for excellon files. Give error for incremental mode
Diffstat (limited to 'gerber')
-rwxr-xr-xgerber/excellon.py24
-rw-r--r--gerber/render/excellon_backend.py5
2 files changed, 13 insertions, 16 deletions
diff --git a/gerber/excellon.py b/gerber/excellon.py
index 72cf75c..09636aa 100755
--- a/gerber/excellon.py
+++ b/gerber/excellon.py
@@ -85,14 +85,10 @@ class DrillHit(object):
self.position = position
def to_inch(self):
- if self.tool.units == 'metric':
- self.tool.to_inch()
- self.position = tuple(map(inch, self.position))
+ self.position = tuple(map(inch, self.position))
def to_metric(self):
- if self.tool.units == 'inch':
- self.tool.to_metric()
- self.position = tuple(map(metric, self.position))
+ self.position = tuple(map(metric, self.position))
@property
def bounding_box(self):
@@ -121,16 +117,12 @@ class DrillSlot(object):
self.slot_type = slot_type
def to_inch(self):
- if self.tool.units == 'metric':
- self.tool.to_inch()
- self.start = tuple(map(inch, self.start))
- self.end = tuple(map(inch, self.end))
+ self.start = tuple(map(inch, self.start))
+ self.end = tuple(map(inch, self.end))
def to_metric(self):
- if self.tool.units == 'inch':
- self.tool.to_metric()
- self.start = tuple(map(metric, self.start))
- self.end = tuple(map(metric, self.end))
+ self.start = tuple(map(metric, self.start))
+ self.end = tuple(map(metric, self.end))
@property
def bounding_box(self):
@@ -253,7 +245,7 @@ class ExcellonFile(CamFile):
for primitive in self.primitives:
primitive.to_inch()
for hit in self.hits:
- hit.position = tuple(map(inch, hit.position))
+ hit.to_inch()
def to_metric(self):
@@ -268,7 +260,7 @@ class ExcellonFile(CamFile):
for primitive in self.primitives:
primitive.to_metric()
for hit in self.hits:
- hit.position = tuple(map(metric, hit.position))
+ hit.to_metric()
def offset(self, x_offset=0, y_offset=0):
for statement in self.statements:
diff --git a/gerber/render/excellon_backend.py b/gerber/render/excellon_backend.py
index b2c213f..c477036 100644
--- a/gerber/render/excellon_backend.py
+++ b/gerber/render/excellon_backend.py
@@ -36,6 +36,11 @@ class ExcellonContext(GerberContext):
self.header.append(UnitStmt.from_settings(self.settings))
+ if self.settings.notation == 'incremental':
+ raise NotImplementedError('Incremental mode is not implemented')
+ else:
+ self.body.append(AbsoluteModeStmt())
+
def _start_comments(self):
# Write the digits used - this isn't valid Excellon statement, so we write as a comment