summaryrefslogtreecommitdiff
path: root/gerbonara
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-06-19 00:51:06 +0200
committerjaseg <git@jaseg.de>2022-06-19 00:51:06 +0200
commit7ded0d6d6f50924566def7cb7a9f46de6f24229b (patch)
tree4cd0267b72d0a1252e268eed7395d561c2e8c632 /gerbonara
parentf1ac559eb340a81279688338fe4f70b415f799c9 (diff)
downloadgerbonara-7ded0d6d6f50924566def7cb7a9f46de6f24229b.tar.gz
gerbonara-7ded0d6d6f50924566def7cb7a9f46de6f24229b.tar.bz2
gerbonara-7ded0d6d6f50924566def7cb7a9f46de6f24229b.zip
Fix gerber-to-excellon conversion
Diffstat (limited to 'gerbonara')
-rw-r--r--gerbonara/layers.py2
-rw-r--r--gerbonara/rs274x.py8
2 files changed, 5 insertions, 5 deletions
diff --git a/gerbonara/layers.py b/gerbonara/layers.py
index 77ca064..552ac8b 100644
--- a/gerbonara/layers.py
+++ b/gerbonara/layers.py
@@ -518,7 +518,7 @@ class LayerStack:
return self.bounding_box(unit=unit, default=default)
def merge_drill_layers(self):
- target = ExcellonFile(comments='Drill files merged by gerbonara')
+ target = ExcellonFile(comments=['Drill files merged by gerbonara'])
for layer in self.drill_layers:
if isinstance(layer, GerberFile):
diff --git a/gerbonara/rs274x.py b/gerbonara/rs274x.py
index b0f7e7c..af008b6 100644
--- a/gerbonara/rs274x.py
+++ b/gerbonara/rs274x.py
@@ -63,14 +63,14 @@ class GerberFile(CamFile):
new_objs = []
new_tools = {}
for obj in self.objects:
- if not isinstance(obj, go.Line) or isinstance(obj, go.Arc) or isinstance(obj, go.Flash) or \
+ if (not isinstance(obj, go.Line) and isinstance(obj, go.Arc) and isinstance(obj, go.Flash)) or \
not isinstance(obj.aperture, apertures.CircleAperture):
- raise ValueError(f'Cannot convert {type(obj)} to excellon!')
+ raise ValueError(f'Cannot convert {obj} to excellon!')
if not (new_tool := new_tools.get(id(obj.aperture))):
# TODO plating?
- new_tool = new_tools[id(obj.aperture)] = apertures.ExcellonTool(obj.aperture.diameter, plated=plated)
- new_obj = dataclasses.replace(obj, aperture=new_tool)
+ new_tool = new_tools[id(obj.aperture)] = apertures.ExcellonTool(obj.aperture.diameter, plated=plated, unit=obj.aperture.unit)
+ new_objs.append(dataclasses.replace(obj, aperture=new_tool))
return ExcellonFile(objects=new_objs, comments=self.comments)