aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoropiopan <opiopan@gmail.com>2019-03-31 18:16:34 +0900
committeropiopan <opiopan@gmail.com>2019-03-31 18:16:34 +0900
commit53816574a986722d7af26c5597248d9c96f31bd3 (patch)
treea2c5f2dc6f1da8f081eb173191ab456abb919b44
parent900d992fa3af05f93ac7a4cf717f28598e1a868d (diff)
downloadpcb-tools-extension-53816574a986722d7af26c5597248d9c96f31bd3.tar.gz
pcb-tools-extension-53816574a986722d7af26c5597248d9c96f31bd3.tar.bz2
pcb-tools-extension-53816574a986722d7af26c5597248d9c96f31bd3.zip
fix a minor issue
-rw-r--r--README.md10
-rw-r--r--gerberex/dxf.py8
-rw-r--r--gerberex/dxf_path.py3
3 files changed, 11 insertions, 10 deletions
diff --git a/README.md b/README.md
index d6e31a8..a3ddf50 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ This library is designed based on [pcb-tools](https://github.com/curtacircuitos/
pcb-tools-extension adds following function to pcb-tools.
- Rotate PCB data
-- Write back loded PCB data (original PCB tools does not work completely)
+- Write back loaded PCB data (original pcb-tools does not work in some condition)
- Merge multiple PCB data
- Translate DXF file to gerber data
@@ -39,7 +39,7 @@ ctx.merge(metal2)
ctx.dump('panelized-board.gtl')
```
-```rotate()``` method can be used to rotate PCB data counterclockwise. you have to specify angle in degree<br>
+```rotate()``` method can be used to rotate PCB data counterclockwise. you have to specify angle in degree.<br>
```offset()``` method can be used to move PCB data. Specified offset values are interpreted according to unit setting of PCB data. In case of the above code, ```board2.gtl``` move to 30mm left since ```to_metric()``` is called.
In case of Excellon drill data, you have to use ```DrillCompositon``` instead of ```GerberComposition```.
@@ -88,7 +88,11 @@ dxf.write('outline.gml')
```
You can also translate DXF closed shape such as circle to RX-274x polygon fill sequence.<br>
-In order to fill closed shape, ```DM_FILL``` has to be set to ```drawing_mode``` property. In this mode, All object except circle and closed polyline will be ignored.<br>
+In order to fill closed shape, ```DM_FILL``` has to be set to ```drawing_mode``` property. In this mode, All object except closed shapes listed below are ignored.
+
+- circle
+- closed polyline
+- closed path which consist of lines and arcs
```python
import gerberex
diff --git a/gerberex/dxf.py b/gerberex/dxf.py
index e6eb971..e863238 100644
--- a/gerberex/dxf.py
+++ b/gerberex/dxf.py
@@ -259,7 +259,7 @@ class DxfPolylineStatement(DxfStatement):
if self.is_closed:
self.end = self.start
else:
- self.start = (self.entity.points[-1][0], self.entity.points[-1][1])
+ self.end = (self.entity.points[-1][0], self.entity.points[-1][1])
def to_gerber(self, settings=FileSettings(), pitch=0, width=0):
if pitch:
@@ -364,16 +364,14 @@ class DxfStatements(object):
def gerbers():
yield 'D{0}*'.format(self.dcode)
if self.draw_mode == DxfFile.DM_FILL:
+ yield 'G36*'
for statement in self.statements:
- yield 'G36*'
if isinstance(statement, DxfCircleStatement) or \
(isinstance(statement, DxfPolylineStatement) and statement.entity.is_closed):
yield statement.to_gerber(settings)
- yield 'G37*'
for path in self.paths:
- yield 'G36*'
yield path.to_gerber(settings)
- yield 'G37*'
+ yield 'G37*'
else:
for statement in self.statements:
yield statement.to_gerber(
diff --git a/gerberex/dxf_path.py b/gerberex/dxf_path.py
index b066b08..930d8d2 100644
--- a/gerberex/dxf_path.py
+++ b/gerberex/dxf_path.py
@@ -184,7 +184,7 @@ def generate_closed_paths(statements, error_range=0):
working = []
for i in range(len(paths)):
mergee = paths[i]
- for j in range(i + 1, len(paths) - 1):
+ for j in range(i + 1, len(paths)):
target = paths[j]
if target.merge(mergee, error_range):
break
@@ -192,6 +192,5 @@ def generate_closed_paths(statements, error_range=0):
working.append(mergee)
prev_paths_num = len(paths)
paths = working
-
return list(filter(lambda p: p.is_closed, paths))