aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi Murayama <opiopan@gmail.com>2019-09-28 20:42:11 +0900
committerHiroshi Murayama <opiopan@gmail.com>2019-09-28 20:42:11 +0900
commit48b35377b1cce897a70d1d037b3e73b616af9be7 (patch)
tree483238db68f4387e26c826ddc9cb858c30d14024
parenta3c750fc060c6ff6b071dca2a7c765b8629efe8a (diff)
downloadpcb-tools-extension-48b35377b1cce897a70d1d037b3e73b616af9be7.tar.gz
pcb-tools-extension-48b35377b1cce897a70d1d037b3e73b616af9be7.tar.bz2
pcb-tools-extension-48b35377b1cce897a70d1d037b3e73b616af9be7.zip
minor refactoring
-rw-r--r--gerberex/dxf.py2
-rw-r--r--gerberex/dxf_path.py14
-rw-r--r--tests/expects/dxf_offset.gtl2
-rw-r--r--tests/expects/dxf_rotate.gtl2
-rw-r--r--tests/expects/dxf_save_fill.gtl2
-rw-r--r--tests/expects/dxf_save_line.gtl2
-rw-r--r--tests/expects/dxf_to_inch.gtl2
7 files changed, 14 insertions, 12 deletions
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:
diff --git a/tests/expects/dxf_offset.gtl b/tests/expects/dxf_offset.gtl
index 634664e..ff0cdda 100644
--- a/tests/expects/dxf_offset.gtl
+++ b/tests/expects/dxf_offset.gtl
@@ -36,6 +36,6 @@ X119171Y125107D01*
G01*
X119171Y100000D02*
G75*
-G02*
+G03*
X119171Y100000I-3000J0D01*
M02*
diff --git a/tests/expects/dxf_rotate.gtl b/tests/expects/dxf_rotate.gtl
index 71e1647..c6449ca 100644
--- a/tests/expects/dxf_rotate.gtl
+++ b/tests/expects/dxf_rotate.gtl
@@ -36,6 +36,6 @@ X23162Y45543D01*
G01*
X31749Y21950D02*
G75*
-G02*
+G03*
X31749Y21950I-2819J-1026D01*
M02*
diff --git a/tests/expects/dxf_save_fill.gtl b/tests/expects/dxf_save_fill.gtl
index 3cd2572..f18c9f7 100644
--- a/tests/expects/dxf_save_fill.gtl
+++ b/tests/expects/dxf_save_fill.gtl
@@ -37,7 +37,7 @@ X9171Y75107D01*
G01*
X9171Y50000D02*
G75*
-G02*
+G03*
X9171Y50000I-3000J0D01*
G37*
M02*
diff --git a/tests/expects/dxf_save_line.gtl b/tests/expects/dxf_save_line.gtl
index eb993f4..d1966ad 100644
--- a/tests/expects/dxf_save_line.gtl
+++ b/tests/expects/dxf_save_line.gtl
@@ -36,6 +36,6 @@ X9171Y75107D01*
G01*
X9171Y50000D02*
G75*
-G02*
+G03*
X9171Y50000I-3000J0D01*
M02*
diff --git a/tests/expects/dxf_to_inch.gtl b/tests/expects/dxf_to_inch.gtl
index 16a94cf..aa862bf 100644
--- a/tests/expects/dxf_to_inch.gtl
+++ b/tests/expects/dxf_to_inch.gtl
@@ -36,6 +36,6 @@ X3610Y29570D01*
G01*
X3610Y19685D02*
G75*
-G02*
+G03*
X3610Y19685I-1181J0D01*
M02*