From 48b35377b1cce897a70d1d037b3e73b616af9be7 Mon Sep 17 00:00:00 2001 From: Hiroshi Murayama Date: Sat, 28 Sep 2019 20:42:11 +0900 Subject: minor refactoring --- gerberex/dxf.py | 2 +- gerberex/dxf_path.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'gerberex') diff --git a/gerberex/dxf.py b/gerberex/dxf.py index 8f0b984..eca246c 100644 --- a/gerberex/dxf.py +++ b/gerberex/dxf.py @@ -120,7 +120,7 @@ class DxfArcStatement(DxfStatement): self.start = (self.center[0] + self.radius, self.center[1]) self.end = self.start self.start_angle = 0 - self.end_angle = -360 + self.end_angle = 360 self.is_closed = True elif entity.dxftype == 'ARC': self.start_angle = self.entity.start_angle diff --git a/gerberex/dxf_path.py b/gerberex/dxf_path.py index 0a92287..1307411 100644 --- a/gerberex/dxf_path.py +++ b/gerberex/dxf_path.py @@ -202,20 +202,22 @@ class DxfPath(object): def to_excellon(self, settings=FileSettings(), pitch=0, width=0): from gerberex.dxf import DxfArcStatement if pitch == 0: - x, y = self.statements[0].start + x0, y0 = self.statements[0].start excellon = 'G00{0}\nM15\n'.format( - CoordinateStmtEx(x=x, y=y).to_excellon(settings)) + CoordinateStmtEx(x=x0, y=y0).to_excellon(settings)) for statement in self.statements: - x, y = statement.end + x0, y0 = statement.start + x1, y1 = statement.end if isinstance(statement, DxfArcStatement): - r = statement.radius + i = statement.center[0] - x0 + j = statement.center[1] - y0 excellon += '{0}{1}\n'.format( 'G03' if statement.end_angle > statement.start_angle else 'G02', - CoordinateStmtEx(x=x, y=y, radius=r).to_excellon(settings)) + CoordinateStmtEx(x=x1, y=y1, i=i, j=j).to_excellon(settings)) else: excellon += 'G01{0}\n'.format( - CoordinateStmtEx(x=x, y=y).to_excellon(settings)) + CoordinateStmtEx(x=x1, y=y1).to_excellon(settings)) excellon += 'M16\nG05\n' else: -- cgit