diff options
author | opiopan <opiopan@gmail.com> | 2019-03-23 21:59:13 +0900 |
---|---|---|
committer | opiopan <opiopan@gmail.com> | 2019-03-23 21:59:13 +0900 |
commit | 690df56bb71020901167605a87ec451081fa18d7 (patch) | |
tree | c1faba9ba0cb75d64d8353a94d87edbcbb8174c3 /gerberex/excellon.py | |
parent | 9febca7da6a730b3b3ca3a54129a9f88e5c44d14 (diff) | |
download | gerbonara-690df56bb71020901167605a87ec451081fa18d7.tar.gz gerbonara-690df56bb71020901167605a87ec451081fa18d7.tar.bz2 gerbonara-690df56bb71020901167605a87ec451081fa18d7.zip |
add rotation fuction
Diffstat (limited to 'gerberex/excellon.py')
-rw-r--r-- | gerberex/excellon.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gerberex/excellon.py b/gerberex/excellon.py index 78e6e5f..90d6742 100644 --- a/gerberex/excellon.py +++ b/gerberex/excellon.py @@ -6,6 +6,7 @@ from gerber.excellon import (ExcellonParser, detect_excellon_format, ExcellonFile) from gerber.excellon_statements import UnitStmt from gerber.cam import FileSettings +from gerberex.utility import rotate def loads(data, filename=None, settings=None, tools=None, format=None): if not settings: @@ -27,6 +28,12 @@ class ExcellonFileEx(ExcellonFile): def __init__(self, statements, tools, hits, settings, filename=None): super(ExcellonFileEx, self).__init__(statements, tools, hits, settings, filename) + def rotate(self, angle, center=(0,0)): + if angle % 360 == 0: + return + for hit in self.hits: + hit.position = rotate(hit.position[0], hit.position[1], angle, center) + class UnitStmtEx(UnitStmt): @classmethod def from_statement(cls, stmt): |