kopia lustrzana https://gitlab.com/gerbolyze/gerbonara
Fix gerber-to-excellon conversion
rodzic
f1ac559eb3
commit
7ded0d6d6f
|
@ -518,7 +518,7 @@ class LayerStack:
|
||||||
return self.bounding_box(unit=unit, default=default)
|
return self.bounding_box(unit=unit, default=default)
|
||||||
|
|
||||||
def merge_drill_layers(self):
|
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:
|
for layer in self.drill_layers:
|
||||||
if isinstance(layer, GerberFile):
|
if isinstance(layer, GerberFile):
|
||||||
|
|
|
@ -63,14 +63,14 @@ class GerberFile(CamFile):
|
||||||
new_objs = []
|
new_objs = []
|
||||||
new_tools = {}
|
new_tools = {}
|
||||||
for obj in self.objects:
|
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):
|
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))):
|
if not (new_tool := new_tools.get(id(obj.aperture))):
|
||||||
# TODO plating?
|
# TODO plating?
|
||||||
new_tool = new_tools[id(obj.aperture)] = apertures.ExcellonTool(obj.aperture.diameter, plated=plated)
|
new_tool = new_tools[id(obj.aperture)] = apertures.ExcellonTool(obj.aperture.diameter, plated=plated, unit=obj.aperture.unit)
|
||||||
new_obj = dataclasses.replace(obj, aperture=new_tool)
|
new_objs.append(dataclasses.replace(obj, aperture=new_tool))
|
||||||
|
|
||||||
return ExcellonFile(objects=new_objs, comments=self.comments)
|
return ExcellonFile(objects=new_objs, comments=self.comments)
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue