From 71bde37b1d7c631702f8ab09ab025807a63e4e83 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Thu, 4 Mar 2021 23:39:59 +0200 Subject: [PATCH] - fixed Punch Gerber Tool to work in new conditions - fixed creating positive films in Film Tool, because of recent changes --- CHANGELOG.md | 4 +++- appPlugins/ToolFilm.py | 6 ++---- appPlugins/ToolPunchGerber.py | 40 +++++++++++++++++------------------ 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31104284..7c76911c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,9 @@ CHANGELOG for FlatCAM beta - fixed errors on project load, in ParseGerber and Extract and Punch Gerber Plugins due of refactoring the 'apertures' attribute to 'tools' - 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) +- fixed issues in Gerber Editor (using the '0' instead of 'REG' type for apertures) +- fixed Punch Gerber Tool to work in new conditions +- fixed creating positive films in Film Tool, because of recent changes 2.03.2021 diff --git a/appPlugins/ToolFilm.py b/appPlugins/ToolFilm.py index b1a018c0..808578b3 100644 --- a/appPlugins/ToolFilm.py +++ b/appPlugins/ToolFilm.py @@ -1068,8 +1068,7 @@ class Film(AppTool): def job_thread_film(): with self.app.proc_container.new(_("Working...")): try: - make_positive_film(p_size=p_size, orientation=orientation, color=color, - transparency_level=transparency_level, + make_positive_film(color=color, transparency_level=transparency_level, scale_factor_x=scale_factor_x, scale_factor_y=scale_factor_y) except Exception as e: self.app.log.error("export_positive() process -> %s" % str(e)) @@ -1077,8 +1076,7 @@ class Film(AppTool): self.app.worker_task.emit({'fcn': job_thread_film, 'params': []}) else: - make_positive_film(p_size=p_size, orientation=orientation, color=color, - transparency_level=transparency_level, + make_positive_film(color=color, transparency_level=transparency_level, scale_factor_x=scale_factor_x, scale_factor_y=scale_factor_y) def reset_fields(self): diff --git a/appPlugins/ToolPunchGerber.py b/appPlugins/ToolPunchGerber.py index c3ca63d1..a318ba46 100644 --- a/appPlugins/ToolPunchGerber.py +++ b/appPlugins/ToolPunchGerber.py @@ -292,7 +292,7 @@ class ToolPunchGerber(AppTool, Gerber): 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 @@ -568,7 +568,7 @@ class ToolPunchGerber(AppTool, Gerber): # 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())) # this is the punching geometry exc_solid_geometry = MultiPolygon(exc_obj.solid_geometry) @@ -639,7 +639,7 @@ class ToolPunchGerber(AppTool, Gerber): # size and add there the clear geometry for hole_size, ap_val in holes_apertures.items(): new_apid += 1 - new_apertures[str(new_apid)] = deepcopy(ap_val) + new_apertures[new_apid] = deepcopy(ap_val) def init_func(new_obj, app_obj): new_obj.options.update(new_options) @@ -673,7 +673,7 @@ class ToolPunchGerber(AppTool, Gerber): # 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())) # this is the punching geometry exc_solid_geometry = MultiPolygon(exc_obj.solid_geometry) @@ -760,7 +760,7 @@ class ToolPunchGerber(AppTool, Gerber): # size and add there the clear geometry for hole_size, ap_val in holes_apertures.items(): new_apid += 1 - new_apertures[str(new_apid)] = deepcopy(ap_val) + new_apertures[new_apid] = deepcopy(ap_val) def init_func(new_obj, app_obj): new_obj.options.update(new_options) @@ -792,7 +792,7 @@ class ToolPunchGerber(AppTool, Gerber): # 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())) punching_geo = [] for apid in grb_obj.tools: @@ -893,7 +893,7 @@ class ToolPunchGerber(AppTool, Gerber): # size and add there the clear geometry for hole_size, ap_val in holes_apertures.items(): new_apid += 1 - new_apertures[str(new_apid)] = deepcopy(ap_val) + new_apertures[new_apid] = deepcopy(ap_val) def init_func(new_obj, app_obj): new_obj.options.update(new_options) @@ -925,7 +925,7 @@ class ToolPunchGerber(AppTool, Gerber): # 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())) # this is the punching geometry punching_geo = [] @@ -988,7 +988,7 @@ class ToolPunchGerber(AppTool, Gerber): # size and add there the clear geometry for hole_size, ap_val in holes_apertures.items(): new_apid += 1 - new_apertures[str(new_apid)] = deepcopy(ap_val) + new_apertures[new_apid] = deepcopy(ap_val) def init_func(new_obj, app_obj): new_obj.options.update(new_options) @@ -1032,7 +1032,7 @@ class ToolPunchGerber(AppTool, Gerber): # 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())) # store here the clear geometry, the key is the new aperture size holes_apertures = {} @@ -1137,7 +1137,7 @@ class ToolPunchGerber(AppTool, Gerber): # size and add there the clear geometry for hole_size, ap_val in holes_apertures.items(): new_apid += 1 - new_apertures[str(new_apid)] = deepcopy(ap_val) + new_apertures[new_apid] = deepcopy(ap_val) def init_func(new_obj, app_obj): new_obj.options.update(new_options) @@ -1181,7 +1181,7 @@ class ToolPunchGerber(AppTool, Gerber): # 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())) # store here the clear geometry, the key is the new aperture size holes_apertures = {} @@ -1277,7 +1277,7 @@ class ToolPunchGerber(AppTool, Gerber): # size and add there the clear geometry for hole_size, ap_val in holes_apertures.items(): new_apid += 1 - new_apertures[str(new_apid)] = deepcopy(ap_val) + new_apertures[new_apid] = deepcopy(ap_val) def init_func(new_obj, app_obj): new_obj.options.update(new_options) @@ -1316,7 +1316,7 @@ class ToolPunchGerber(AppTool, Gerber): # 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())) # store here the clear geometry, the key is the new aperture size holes_apertures = {} @@ -1421,7 +1421,7 @@ class ToolPunchGerber(AppTool, Gerber): # size and add there the clear geometry for hole_size, ap_val in holes_apertures.items(): new_apid += 1 - new_apertures[str(new_apid)] = deepcopy(ap_val) + new_apertures[new_apid] = deepcopy(ap_val) def init_func(new_obj, app_obj): new_obj.options.update(new_options) @@ -1460,7 +1460,7 @@ class ToolPunchGerber(AppTool, Gerber): # 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())) # store here the clear geometry, the key is the new aperture size holes_apertures = {} @@ -1557,7 +1557,7 @@ class ToolPunchGerber(AppTool, Gerber): # size and add there the clear geometry for hole_size, ap_val in holes_apertures.items(): new_apid += 1 - new_apertures[str(new_apid)] = deepcopy(ap_val) + new_apertures[new_apid] = deepcopy(ap_val) def init_func(new_obj, app_obj): new_obj.options.update(new_options) @@ -1580,7 +1580,7 @@ class ToolPunchGerber(AppTool, Gerber): # 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 self.grb_obj.tools.items(): if apid in sel_apid: @@ -1848,7 +1848,7 @@ class ToolPunchGerber(AppTool, Gerber): 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 @@ -1884,7 +1884,7 @@ class ToolPunchGerber(AppTool, Gerber): # 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())) self.manual_pads = [] for apid, apid_value in self.grb_obj.tools.items():