diff options
author | opiopan <opiopan@gmail.com> | 2019-04-03 00:30:00 +0900 |
---|---|---|
committer | opiopan <opiopan@gmail.com> | 2019-04-03 00:30:00 +0900 |
commit | cb420e39e278f7ab6f002600a7698d7be101eb7d (patch) | |
tree | 1d82fcd72627c71715ec0b9724c8f976a49bdfdd /gerberex/rs274x.py | |
parent | b72d891998cc87273b9dd8bfe4d864cbe6a8cc62 (diff) | |
download | gerbonara-cb420e39e278f7ab6f002600a7698d7be101eb7d.tar.gz gerbonara-cb420e39e278f7ab6f002600a7698d7be101eb7d.tar.bz2 gerbonara-cb420e39e278f7ab6f002600a7698d7be101eb7d.zip |
fix a rotaion issue
Diffstat (limited to 'gerberex/rs274x.py')
-rw-r--r-- | gerberex/rs274x.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gerberex/rs274x.py b/gerberex/rs274x.py index 4b477d3..4eb317d 100644 --- a/gerberex/rs274x.py +++ b/gerberex/rs274x.py @@ -30,11 +30,25 @@ class GerberFile(gerber.rs274x.GerberFile): if angle % 360 == 0: return self._generalize_aperture() + last_x = 0 + last_y = 0 + last_rx = 0 + last_ry = 0 for statement in self.statements: if isinstance(statement, AMParamStmtEx): statement.rotate(angle, center) elif isinstance(statement, CoordStmt) and statement.x != None and statement.y != None: - statement.x, statement.y = rotate(statement.x, statement.y, angle, center) + if statement.i != None and statement.j != None: + cx = last_x + statement.i + cy = last_y + statement.j + cx, cy = rotate(cx, cy, angle, center) + statement.i = cx - last_rx + statement.j = cy - last_ry + last_x = statement.x + last_y = statement.y + last_rx, last_ry = rotate(statement.x, statement.y, angle, center) + statement.x = last_rx + statement.y = last_ry def _generalize_aperture(self): RECTANGLE = 0 |