aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoropiopan <opiopan@gmail.com>2019-04-24 22:55:23 +0900
committeropiopan <opiopan@gmail.com>2019-04-24 22:55:23 +0900
commit6ec58842030b0bbe6aa3391456f017d71b74aeaa (patch)
tree0c70aba68412d5f0f6ab5e7e47175e7196759da6
parent0d91ed834d7a28b249b86081294a9c1b95e8f39c (diff)
downloadpcb-tools-extension-6ec58842030b0bbe6aa3391456f017d71b74aeaa.tar.gz
pcb-tools-extension-6ec58842030b0bbe6aa3391456f017d71b74aeaa.tar.bz2
pcb-tools-extension-6ec58842030b0bbe6aa3391456f017d71b74aeaa.zip
fix a genarating closed path issue
-rw-r--r--gerberex/dxf_path.py17
-rw-r--r--setup.py8
2 files changed, 21 insertions, 4 deletions
diff --git a/gerberex/dxf_path.py b/gerberex/dxf_path.py
index 2825c58..ca48d00 100644
--- a/gerberex/dxf_path.py
+++ b/gerberex/dxf_path.py
@@ -173,9 +173,20 @@ class DxfPath(object):
def generate_closed_paths(statements, error_range=0):
from gerberex.dxf import DxfLineStatement, DxfArcStatement
- paths = [DxfPath(s, error_range) \
- for s in filter(lambda s: isinstance(s, DxfLineStatement) or \
- isinstance(s, DxfArcStatement), statements)]
+ unique_statements = []
+ redundant = 0
+ for statement in statements:
+ for target in unique_statements:
+ if not isinstance(statement, DxfLineStatement) and \
+ not isinstance(statement, DxfArcStatement):
+ break
+ if statement.is_equal_to(target, error_range):
+ redundant += 1
+ break
+ else:
+ unique_statements.append(statement)
+
+ paths = [DxfPath(s, error_range) for s in unique_statements]
prev_paths_num = 0
while prev_paths_num != len(paths):
diff --git a/setup.py b/setup.py
index 9e14473..8a26d38 100644
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@ def read(fname):
METADATA = {
'name': 'pcb-tools-extension',
- 'version': "0.1.4",
+ 'version': "0.1.5",
'author': 'Hiroshi Murayama <opiopan@gmail.com>',
'author_email': "opiopan@gmail.com",
'description': ("Extension for pcb-tools package to panelize gerber files"),
@@ -24,10 +24,16 @@ METADATA = {
"Development Status :: 3 - Alpha",
"Topic :: Utilities",
"License :: OSI Approved :: Apache Software License",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 2",
'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
],
}