kopia lustrzana https://gitlab.com/gerbolyze/gerbonara
Add support for more excellon formats. Dont consider line width when determinging region bounding box
rodzic
60784dfa21
commit
e84f131720
|
@ -461,6 +461,8 @@ class ExcellonParser(object):
|
|||
stmt = UnitStmt.from_excellon(line)
|
||||
self.units = stmt.units
|
||||
self.zeros = stmt.zeros
|
||||
if stmt.format:
|
||||
self.format = stmt.format
|
||||
self.statements.append(stmt)
|
||||
|
||||
elif line[:3] == 'M71' or line [:3] == 'M72':
|
||||
|
|
|
@ -601,14 +601,24 @@ class UnitStmt(ExcellonStatement):
|
|||
def from_excellon(cls, line, **kwargs):
|
||||
units = 'inch' if 'INCH' in line else 'metric'
|
||||
zeros = 'leading' if 'LZ' in line else 'trailing'
|
||||
return cls(units, zeros, **kwargs)
|
||||
if '0000.00' in line:
|
||||
format = (4, 2)
|
||||
elif '000.000' in line:
|
||||
format = (3, 3)
|
||||
elif '00.0000' in line:
|
||||
format = (2, 4)
|
||||
else:
|
||||
format = None
|
||||
return cls(units, zeros, format, **kwargs)
|
||||
|
||||
def __init__(self, units='inch', zeros='leading', **kwargs):
|
||||
def __init__(self, units='inch', zeros='leading', format=None, **kwargs):
|
||||
super(UnitStmt, self).__init__(**kwargs)
|
||||
self.units = units.lower()
|
||||
self.zeros = zeros
|
||||
self.format = format
|
||||
|
||||
def to_excellon(self, settings=None):
|
||||
# TODO This won't export the invalid format statement if it exists
|
||||
stmt = '%s,%s' % ('INCH' if self.units == 'inch' else 'METRIC',
|
||||
'LZ' if self.zeros == 'leading'
|
||||
else 'TZ')
|
||||
|
|
|
@ -827,7 +827,7 @@ class Region(Primitive):
|
|||
|
||||
@property
|
||||
def bounding_box(self):
|
||||
xlims, ylims = zip(*[p.bounding_box for p in self.primitives])
|
||||
xlims, ylims = zip(*[p.bounding_box_no_aperture for p in self.primitives])
|
||||
minx, maxx = zip(*xlims)
|
||||
miny, maxy = zip(*ylims)
|
||||
min_x = min(minx)
|
||||
|
|
Ładowanie…
Reference in New Issue