- aperture keys in the gerber 'tools' dictionary are now stored as integers instead of strings as before; need to check the application especially the Gerber Editor

- fixed issues in Gerber Editor (using the '0' insteadd of 'REG' type for apertures)
This commit is contained in:
Marius Stanciu
2021-03-04 17:45:47 +02:00
parent cda5f830be
commit 0986ef143c
19 changed files with 217 additions and 205 deletions

View File

@@ -752,8 +752,8 @@ class ExcellonObject(FlatCAMObj, Excellon):
exc_y_formatted = exc_y_formatted.partition('.')
# left padd the 'whole' part with zeros
x_whole = exc_x_formatted[0].rjust(whole, '0')
y_whole = exc_y_formatted[0].rjust(whole, '0')
x_whole = exc_x_formatted[0].rjust(whole, 0)
y_whole = exc_y_formatted[0].rjust(whole, 0)
# restore the coordinate padded in the left with 0 and added the decimal part
# without the decinal dot
@@ -770,8 +770,8 @@ class ExcellonObject(FlatCAMObj, Excellon):
exc_y_formatted = "{:.{dec}f}".format(drill_y, dec=fract).replace('.', '')
# pad with rear zeros
exc_x_formatted.ljust(length, '0')
exc_y_formatted.ljust(length, '0')
exc_x_formatted.ljust(length, 0)
exc_y_formatted.ljust(length, 0)
excellon_code += "X{xform}Y{yform}\n".format(xform=exc_x_formatted,
yform=exc_y_formatted)
@@ -825,10 +825,10 @@ class ExcellonObject(FlatCAMObj, Excellon):
stop_slot_y_formatted = stop_slot_y_formatted.partition('.')
# left padd the 'whole' part with zeros
start_x_whole = start_slot_x_formatted[0].rjust(whole, '0')
start_y_whole = start_slot_y_formatted[0].rjust(whole, '0')
stop_x_whole = stop_slot_x_formatted[0].rjust(whole, '0')
stop_y_whole = stop_slot_y_formatted[0].rjust(whole, '0')
start_x_whole = start_slot_x_formatted[0].rjust(whole, 0)
start_y_whole = start_slot_y_formatted[0].rjust(whole, 0)
stop_x_whole = stop_slot_x_formatted[0].rjust(whole, 0)
stop_y_whole = stop_slot_y_formatted[0].rjust(whole, 0)
# restore the coordinate padded in the left with 0 and added the decimal part
# without the decinal dot
@@ -860,10 +860,10 @@ class ExcellonObject(FlatCAMObj, Excellon):
stop_slot_y_formatted = "{:.{dec}f}".format(stop_slot_y, dec=fract).replace('.', '')
# pad with rear zeros
start_slot_x_formatted.ljust(length, '0')
start_slot_y_formatted.ljust(length, '0')
stop_slot_x_formatted.ljust(length, '0')
stop_slot_y_formatted.ljust(length, '0')
start_slot_x_formatted.ljust(length, 0)
start_slot_y_formatted.ljust(length, 0)
stop_slot_x_formatted.ljust(length, 0)
stop_slot_y_formatted.ljust(length, 0)
if slot_type == 'routing':
excellon_code += "G00X{xstart}Y{ystart}\nM15\n".format(xstart=start_slot_x_formatted,

View File

@@ -1269,9 +1269,9 @@ class GerberObject(FlatCAMObj, Gerber):
# apertures processing
try:
length = whole + fract
if '0' in self.tools:
if 'geometry' in self.tools['0']:
for geo_elem in self.tools['0']['geometry']:
if 0 in self.tools:
if 'geometry' in self.tools[0]:
for geo_elem in self.tools[0]['geometry']:
if 'solid' in geo_elem:
geo = geo_elem['solid']
if not geo.is_empty and not isinstance(geo, LineString) and \
@@ -1381,7 +1381,8 @@ class GerberObject(FlatCAMObj, Gerber):
# gerber_code += "D02*\n"
except Exception as e:
self.app.log.error(
"FlatCAMObj.GerberObject.export_gerber() 'follow' --> %s" % str(e))
"FlatCAMObj.GerberObject.export_gerber() 'follow' for 0 aperture --> %s" %
str(e))
if 'clear' in geo_elem:
geo = geo_elem['clear']
if not geo.is_empty:
@@ -1415,10 +1416,10 @@ class GerberObject(FlatCAMObj, Gerber):
gerber_code += 'G37*\n'
gerber_code += '%LPD*%\n'
except Exception as e:
self.app.log.error("FlatCAMObj.GerberObject.export_gerber() '0' aperture --> %s" % str(e))
self.app.log.error("FlatCAMObj.GerberObject.export_gerber() 0 aperture --> %s" % str(e))
for apid in self.tools:
if apid == '0':
if apid == 0:
continue
elif self.tools[apid]['type'] == 'AM':
if 'geometry' in self.tools[apid]:
@@ -1534,7 +1535,7 @@ class GerberObject(FlatCAMObj, Gerber):
# gerber_code += "D02*\n"
except Exception as e:
self.app.log.error(
"FlatCAMObj.GerberObject.export_gerber() 'follow' --> %s" % str(e))
"FlatCAMObj.GerberObject.export_gerber() 'follow' for AM --> %s" % str(e))
if 'clear' in geo_elem:
geo = geo_elem['clear']
if not geo.is_empty:
@@ -1613,7 +1614,8 @@ class GerberObject(FlatCAMObj, Gerber):
# gerber_code += "D02*\n"
except Exception as e:
self.app.log.error("FlatCAMObj.GerberObject.export_gerber() 'follow' --> %s" % str(e))
self.app.log.error(
"FlatCAMObj.GerberObject.export_gerber() 'follow' normal aperture--> %s" % str(e))
try:
if 'clear' in geo_elem: