summaryrefslogtreecommitdiff
path: root/gerber/utils.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-18 04:31:23 -0500
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-18 04:31:23 -0500
commit288ac27084b47166ac662402ea340d0aa25d8f56 (patch)
tree792374b99932120fb08e1d689518eed69e0feccb /gerber/utils.py
parentbc532997aecc60f5a939f9ca6ba55dd3eae27a42 (diff)
downloadgerbonara-288ac27084b47166ac662402ea340d0aa25d8f56.tar.gz
gerbonara-288ac27084b47166ac662402ea340d0aa25d8f56.tar.bz2
gerbonara-288ac27084b47166ac662402ea340d0aa25d8f56.zip
Get unit conversion working for Gerber/Excellon files
Started operations module for file operations/transforms
Diffstat (limited to 'gerber/utils.py')
-rw-r--r--gerber/utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/gerber/utils.py b/gerber/utils.py
index 23575b3..542611d 100644
--- a/gerber/utils.py
+++ b/gerber/utils.py
@@ -26,6 +26,7 @@ files.
# Author: Hamilton Kibbe <ham@hamiltonkib.be>
# License:
+MILLIMETERS_PER_INCH = 25.4
def parse_gerber_value(value, format=(2, 5), zero_suppression='trailing'):
""" Convert gerber/excellon formatted string to floating-point number
@@ -235,3 +236,10 @@ def validate_coordinates(position):
for coord in position:
if not (isinstance(coord, int) or isinstance(coord, float)):
raise TypeError('Coordinates must be integers or floats')
+
+
+def metric(value):
+ return value * MILLIMETERS_PER_INCH
+
+def inch(value):
+ return value / MILLIMETERS_PER_INCH