- fixed the Extract Tool to work with apertures (tools) keys as integers

- fixed the Copper Thieving Tool to work with apertures (tools) keys as integers
- fixed the Corners Tool to work with apertures (tools) keys as integers
- fixed the Fiducials Tool to work with apertures (tools) keys as integers
This commit is contained in:
Marius Stanciu
2021-03-05 12:33:04 +02:00
committed by Marius
parent f103cc0a70
commit de3cd919bb
7 changed files with 23 additions and 18 deletions

View File

@@ -273,7 +273,7 @@ class ToolCopperThieving(AppTool):
else:
ap_keys = list(new_apertures.keys())
if ap_keys:
new_apid = str(int(max(ap_keys)) + 1)
new_apid = int(max(ap_keys)) + 1
else:
new_apid = 10
@@ -1082,7 +1082,7 @@ class ToolCopperThieving(AppTool):
ap_keys = list(new_apertures.keys())
max_apid = int(max(ap_keys))
if ap_keys and max_apid != 0:
new_apid = str(max_apid + 1)
new_apid = max_apid + 1
else:
new_apid = 10
@@ -1102,7 +1102,6 @@ class ToolCopperThieving(AppTool):
# and then set the total plated area value to the GUI element
# the area is in mm2 when using Metric units, make it in cm2 for Metric units
print(plated_area)
if self.units.lower() == 'mm':
plated_area /= 100
self.ui.plated_area_entry.set_value(plated_area)

View File

@@ -347,14 +347,15 @@ class ToolCorners(AppTool):
else:
ap_keys = list(new_apertures.keys())
if ap_keys:
new_apid = str(int(max(ap_keys)) + 1)
new_apid = int(max(ap_keys)) + 1
else:
new_apid = 10
new_apertures[new_apid] = {}
new_apertures[new_apid]['type'] = 'C'
new_apertures[new_apid]['size'] = line_thickness
new_apertures[new_apid]['geometry'] = []
new_apertures[new_apid] = {
'type': 'C',
'size': line_thickness,
'geometry': []
}
for geo in geo_list:
geo_buff = geo.buffer(line_thickness / 2.0, resolution=self.grb_steps_per_circle, join_style=3)
@@ -471,6 +472,7 @@ class ToolCorners(AppTool):
1: {
"tooldia": tooldia,
"drills": drill_list,
"slots": [],
"solid_geometry": []
}
}
@@ -565,6 +567,7 @@ class ToolCorners(AppTool):
1: {
"tooldia": tooldia,
"drills": drill_list,
"slots": [],
'data': {},
"solid_geometry": []
}

View File

@@ -253,7 +253,7 @@ class ToolExtract(AppTool):
continue
# Aperture CODE
ap_code_item = QtWidgets.QTableWidgetItem(ap_code)
ap_code_item = QtWidgets.QTableWidgetItem(str(ap_code))
ap_code_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
# Aperture TYPE
@@ -379,7 +379,7 @@ class ToolExtract(AppTool):
# selected codes in the apertures UI table
sel_apid = []
for it in self.ui.apertures_table.selectedItems():
sel_apid.append(it.text())
sel_apid.append(int(it.text()))
if mode == 'fixed':
tools = {
@@ -648,7 +648,7 @@ class ToolExtract(AppTool):
# selected codes in the apertures UI table
sel_apid = []
for it in self.ui.apertures_table.selectedItems():
sel_apid.append(it.text())
sel_apid.append(int(it.text()))
for apid, apid_value in obj.tools.items():
if apid in sel_apid:
@@ -844,7 +844,7 @@ class ToolExtract(AppTool):
return
try:
aperture = self.ui.apertures_table.item(cw_row, 0).text()
aperture = int(self.ui.apertures_table.item(cw_row, 0).text())
except AttributeError:
return

View File

@@ -355,7 +355,7 @@ class ToolFiducials(AppTool):
else:
ap_keys = list(g_obj.tools.keys())
if ap_keys:
new_apid = str(int(max(ap_keys)) + 1)
new_apid = int(max(ap_keys)) + 1
else:
new_apid = 10
@@ -413,7 +413,7 @@ class ToolFiducials(AppTool):
else:
ap_keys = list(g_obj.tools.keys())
if ap_keys:
new_apid = str(int(max(ap_keys)) + 1)
new_apid = int(max(ap_keys)) + 1
else:
new_apid = 10
@@ -487,7 +487,7 @@ class ToolFiducials(AppTool):
else:
ap_keys = list(g_obj.tools.keys())
if ap_keys:
new_apid = str(int(max(ap_keys)) + 1)
new_apid = int(max(ap_keys)) + 1
else:
new_apid = 10

View File

@@ -316,8 +316,7 @@ class ToolFollow(AppTool, Gerber):
'solid_geometry': new_obj.solid_geometry
}
}
for d in new_data:
print(d, new_data[d])
ret = self.app.app_obj.new_object("geometry", outname, follow_init)
if ret == 'fail':
self.app.inform.emit("[ERROR_NOTCL] %s" % _("Failed to create Follow Geometry."))

View File

@@ -150,7 +150,7 @@ class ToolInvertGerber(AppTool):
if 0 not in new_apertures:
new_apertures[0] = {
'type': 'C',
'type': 'REG',
'size': 0.0,
'geometry': []
}