diff options
author | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2015-02-18 04:31:23 -0500 |
---|---|---|
committer | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2015-02-18 04:31:23 -0500 |
commit | 288ac27084b47166ac662402ea340d0aa25d8f56 (patch) | |
tree | 792374b99932120fb08e1d689518eed69e0feccb /gerber/am_statements.py | |
parent | bc532997aecc60f5a939f9ca6ba55dd3eae27a42 (diff) | |
download | gerbonara-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/am_statements.py')
-rw-r--r-- | gerber/am_statements.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/gerber/am_statements.py b/gerber/am_statements.py index dc97dfa..bdb12dd 100644 --- a/gerber/am_statements.py +++ b/gerber/am_statements.py @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .utils import validate_coordinates +from .utils import validate_coordinates, inch, metric # TODO: Add support for aperture macro variables @@ -26,12 +26,6 @@ __all__ = ['AMPrimitive', 'AMCommentPrimitive', 'AMCirclePrimitive', 'AMMoirePrimitive', 'AMThermalPrimitive', 'AMCenterLinePrimitive', 'AMLowerLeftLinePrimitive', 'AMUnsupportPrimitive'] -def metric(value): - return value * 25.4 - -def inch(value): - return value / 25.4 - class AMPrimitive(object): """ Aperture Macro Primitive Base Class @@ -58,7 +52,7 @@ class AMPrimitive(object): TypeError, ValueError """ def __init__(self, code, exposure=None): - VALID_CODES = (0, 1, 2, 4, 5, 6, 7, 20, 21, 22) + VALID_CODES = (0, 1, 2, 4, 5, 6, 7, 20, 21, 22, 9999) if not isinstance(code, int): raise TypeError('Aperture Macro Primitive code must be an integer') elif code not in VALID_CODES: @@ -74,6 +68,8 @@ class AMPrimitive(object): def to_metric(self): raise NotImplementedError('Subclass must implement `to-metric`') + def __eq__(self, other): + return self.__dict__ == other.__dict__ class AMCommentPrimitive(AMPrimitive): """ Aperture Macro Comment primitive. Code 0 @@ -818,11 +814,12 @@ class AMUnsupportPrimitive(AMPrimitive): return cls(primitive) def __init__(self, primitive): + super(AMUnsupportPrimitive, self).__init__(9999) self.primitive = primitive def to_inch(self): pass - + def to_metric(self): pass |