From 263ec736c3b4ced42988d4dd393250b79dc1030b Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 3 Nov 2020 02:19:01 +0200 Subject: [PATCH] - fixed an issue in Tool Isolation used with tools from the Tools Database: the set offset value was not used - updated the Tools Database to include all the Geometry keys in the every tool from database - made sure that the Operation Type values ('Iso', 'Rough' and 'Finish') are not translated as this may create issues all over the application --- CHANGELOG.md | 6 ++++++ appDatabase.py | 28 +++++++++++++++++++++++++--- appObjects/AppObject.py | 2 +- appObjects/FlatCAMGeometry.py | 14 +++++++------- appObjects/FlatCAMGerber.py | 4 ++-- appTools/ToolCutOut.py | 4 ++-- appTools/ToolDrilling.py | 2 +- appTools/ToolIsolation.py | 17 ++++++++++------- appTools/ToolMilling.py | 2 +- appTools/ToolNCC.py | 4 ++-- appTools/ToolPaint.py | 4 ++-- camlib.py | 4 ++-- 12 files changed, 61 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7f400fb..54bae503 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ CHANGELOG for FlatCAM beta ================================================= +3.11.2020 + +- fixed an issue in Tool Isolation used with tools from the Tools Database: the set offset value was not used +- updated the Tools Database to include all the Geometry keys in the every tool from database +- made sure that the Operation Type values ('Iso', 'Rough' and 'Finish') are not translated as this may create issues all over the application + 2.11.2020 - fixed the Tcl Command AlignDrill diff --git a/appDatabase.py b/appDatabase.py index bea177df..eb8a0f01 100644 --- a/appDatabase.py +++ b/appDatabase.py @@ -26,7 +26,7 @@ class ToolsDB2UI: self.decimals = self.app.decimals self.offset_item_options = ["Path", "In", "Out", "Custom"] - self.type_item_options = [_("Iso"), _("Rough"), _("Finish")] + self.type_item_options = ['Iso', 'Rough', 'Finish'] self.tool_type_item_options = ["C1", "C2", "C3", "C4", "B", "V"] settings = QtCore.QSettings("Open Source", "FlatCAM") @@ -1417,7 +1417,7 @@ class ToolsDB2(QtWidgets.QWidget): 'tooldia': self.app.defaults["geometry_cnctooldia"] 'offset': 'Path' 'offset_value': 0.0 - 'type': _('Rough'), + 'type': 'Rough', 'tool_type': 'C1' 'data': dict() } @@ -1907,6 +1907,28 @@ class ToolsDB2(QtWidgets.QWidget): "toolchangez": float(self.app.defaults["geometry_toolchangez"]), "startz": self.app.defaults["geometry_startz"], "endz": float(self.app.defaults["geometry_endz"]), + "endxy": self.app.defaults["geometry_endxy"], + "search_time": int(self.app.defaults["geometry_search_time"]), + "z_pdepth": float(self.app.defaults["geometry_z_pdepth"]), + "f_plunge": float(self.app.defaults["geometry_f_plunge"]), + + "spindledir": self.app.defaults["geometry_spindledir"], + "optimization_type": self.app.defaults["geometry_optimization_type"], + "feedrate_probe": self.app.defaults["geometry_feedrate_probe"], + + "segx": self.app.defaults["geometry_segx"], + "segy": self.app.defaults["geometry_segy"], + "area_exclusion": self.app.defaults["geometry_area_exclusion"], + "area_shape": self.app.defaults["geometry_area_shape"], + "area_strategy": self.app.defaults["geometry_area_strategy"], + "area_overz": self.app.defaults["geometry_area_overz"], + "polish": self.app.defaults["geometry_polish"], + "polish_dia": self.app.defaults["geometry_polish_dia"], + "polish_pressure": self.app.defaults["geometry_polish_pressure"], + "polish_travelz": self.app.defaults["geometry_polish_travelz"], + "polish_margin": self.app.defaults["geometry_polish_margin"], + "polish_overlap": self.app.defaults["geometry_polish_overlap"], + "polish_method": self.app.defaults["geometry_polish_method"], # NCC "tools_ncc_operation": self.app.defaults["tools_ncc_operation"], @@ -2642,7 +2664,7 @@ class ToolsDB2(QtWidgets.QWidget): # 'tooldia': self.app.defaults["geometry_cnctooldia"] # 'offset': 'Path' # 'offset_value': 0.0 -# 'type': _('Rough'), +# 'type': 'Rough', # 'tool_type': 'C1' # 'data': dict() # } diff --git a/appObjects/AppObject.py b/appObjects/AppObject.py index 6899765b..c810354c 100644 --- a/appObjects/AppObject.py +++ b/appObjects/AppObject.py @@ -256,7 +256,7 @@ class AppObject(QtCore.QObject): 'tooldia': float(app.defaults["geometry_cnctooldia"]), 'offset': 'Path', 'offset_value': 0.0, - 'type': _('Rough'), + 'type': 'Rough', 'tool_type': 'C1', 'data': deepcopy(default_data), 'solid_geometry': [] diff --git a/appObjects/FlatCAMGeometry.py b/appObjects/FlatCAMGeometry.py index 55228611..893d46dc 100644 --- a/appObjects/FlatCAMGeometry.py +++ b/appObjects/FlatCAMGeometry.py @@ -128,7 +128,7 @@ class GeometryObject(FlatCAMObj, Geometry): self.sel_tools = {} self.offset_item_options = ["Path", "In", "Out", "Custom"] - self.type_item_options = [_("Iso"), _("Rough"), _("Finish")] + self.type_item_options = ['Iso', 'Rough', 'Finish'] self.tool_type_item_options = ["C1", "C2", "C3", "C4", "B", "V"] # flag to store if the V-Shape tool is selected in self.ui.geo_tools_table @@ -534,7 +534,7 @@ class GeometryObject(FlatCAMObj, Geometry): 'tooldia': self.app.dec_format(float(toold), self.decimals), 'offset': 'Path', 'offset_value': 0.0, - 'type': _('Rough'), + 'type': 'Rough', 'tool_type': self.tool_type, 'data': new_data, 'solid_geometry': self.solid_geometry @@ -1069,7 +1069,7 @@ class GeometryObject(FlatCAMObj, Geometry): offset = 'Path' offset_val = 0.0 - typ = _("Rough") + typ = 'Rough' tool_type = 'C1' # look in database tools for db_tool, db_tool_val in tools_db_dict.items(): @@ -1199,7 +1199,7 @@ class GeometryObject(FlatCAMObj, Geometry): 'tooldia': tooldia, 'offset': 'Path', 'offset_value': 0.0, - 'type': _('Rough'), + 'type': 'Rough', 'tool_type': 'C1', 'data': deepcopy(self.default_data), 'solid_geometry': self.solid_geometry @@ -1587,8 +1587,8 @@ class GeometryObject(FlatCAMObj, Geometry): elif cw_col == 3: # force toolpath type as 'Iso' if the tool type is V-Shape if self.ui.geo_tools_table.cellWidget(cw_row, 4).currentText() == 'V': - tooluid_value['type'] = _('Iso') - idx = self.ui.geo_tools_table.cellWidget(cw_row, 3).findText(_('Iso')) + tooluid_value['type'] = 'Iso' + idx = self.ui.geo_tools_table.cellWidget(cw_row, 3).findText('Iso') self.ui.geo_tools_table.cellWidget(cw_row, 3).setCurrentIndex(idx) else: tooluid_value['type'] = cb_txt @@ -1597,7 +1597,7 @@ class GeometryObject(FlatCAMObj, Geometry): # if the tool_type selected is V-Shape then autoselect the toolpath type as Iso if cb_txt == 'V': - idx = self.ui.geo_tools_table.cellWidget(cw_row, 3).findText(_('Iso')) + idx = self.ui.geo_tools_table.cellWidget(cw_row, 3).findText('Iso') self.ui.geo_tools_table.cellWidget(cw_row, 3).setCurrentIndex(idx) else: self.ui.cutz_entry.set_value(self.old_cutz) diff --git a/appObjects/FlatCAMGerber.py b/appObjects/FlatCAMGerber.py index f5c3d2b1..4cbcd032 100644 --- a/appObjects/FlatCAMGerber.py +++ b/appObjects/FlatCAMGerber.py @@ -536,7 +536,7 @@ class GerberObject(FlatCAMObj, Gerber): 'tooldia': dia, 'offset': 'Path', 'offset_value': 0.0, - 'type': _('Rough'), + 'type': 'Rough', 'tool_type': tool_type, 'data': default_data, 'solid_geometry': geo_obj.solid_geometry @@ -682,7 +682,7 @@ class GerberObject(FlatCAMObj, Gerber): 'tooldia': dia, 'offset': 'Path', 'offset_value': 0.0, - 'type': _('Rough'), + 'type': 'Rough', 'tool_type': tool_type, 'data': default_data, 'solid_geometry': geo_obj.solid_geometry diff --git a/appTools/ToolCutOut.py b/appTools/ToolCutOut.py index 80411fe9..a57d2b3e 100644 --- a/appTools/ToolCutOut.py +++ b/appTools/ToolCutOut.py @@ -311,7 +311,7 @@ class CutOut(AppTool): offset = 'Path' offset_val = 0.0 - typ = _("Rough") + typ = 'Rough' tool_type = 'V' # look in database tools for db_tool, db_tool_val in tools_db_dict.items(): @@ -445,7 +445,7 @@ class CutOut(AppTool): 'tooldia': dia, 'offset': 'Path', 'offset_value': 0.0, - 'type': _('Rough'), + 'type': 'Rough', 'tool_type': 'C1', 'data': deepcopy(self.default_data), 'solid_geometry': [] diff --git a/appTools/ToolDrilling.py b/appTools/ToolDrilling.py index b9f25578..be73a025 100644 --- a/appTools/ToolDrilling.py +++ b/appTools/ToolDrilling.py @@ -1213,7 +1213,7 @@ class ToolDrilling(AppTool, Excellon): # if the sender is in the column with index 2 then we update the tool_type key if cw_col == 2: tt = cw.currentText() - typ = 'Iso' if tt == 'V' else _("Rough") + typ = 'Iso' if tt == 'V' else 'Rough' self.excellon_tools[current_uid].update({ 'type': typ, diff --git a/appTools/ToolIsolation.py b/appTools/ToolIsolation.py index 4cd119f6..8250cc0b 100644 --- a/appTools/ToolIsolation.py +++ b/appTools/ToolIsolation.py @@ -900,7 +900,7 @@ class ToolIsolation(AppTool, Gerber): # if the sender is in the column with index 2 then we update the tool_type key if cw_col == 2: tt = cw.currentText() - typ = 'Iso' if tt == 'V' else _("Rough") + typ = 'Iso' if tt == 'V' else 'Rough' self.iso_tools[currenuid].update({ 'type': typ, @@ -1095,7 +1095,7 @@ class ToolIsolation(AppTool, Gerber): offset = 'Path' offset_val = 0.0 - typ = _("Rough") + typ = 'Rough' tool_type = 'V' # look in database tools for db_tool, db_tool_val in tools_db_dict.items(): @@ -1626,7 +1626,7 @@ class ToolIsolation(AppTool, Gerber): 'tooldia': float(tool_dia), 'offset': 'Path', 'offset_value': 0.0, - 'type': _('Rough'), + 'type': 'Rough', 'tool_type': tool_type, 'data': tool_data, 'solid_geometry': geo_obj.solid_geometry @@ -1788,7 +1788,7 @@ class ToolIsolation(AppTool, Gerber): 'tooldia': float(tool_dia), 'offset': 'Path', 'offset_value': 0.0, - 'type': _('Rough'), + 'type': 'Rough', 'tool_type': tool_type, 'data': tool_data, 'solid_geometry': deepcopy(new_solid_geo) @@ -1905,7 +1905,10 @@ class ToolIsolation(AppTool, Gerber): for tool in sorted_tools: tool_dia = tools_storage[tool]['tooldia'] + tool_has_offset = tools_storage[tool]['offset'] + tool_offset_value = tools_storage[tool]['offset_value'] tool_type = tools_storage[tool]['tool_type'] + tool_cut_type = tools_storage[tool]['type'] tool_data = tools_storage[tool]['data'] to_follow = tool_data['tools_iso_follow'] @@ -1979,9 +1982,9 @@ class ToolIsolation(AppTool, Gerber): tools_storage.update({ tool: { 'tooldia': float(tool_dia), - 'offset': 'Path', - 'offset_value': 0.0, - 'type': _('Rough'), + 'offset': tool_has_offset, + 'offset_value': tool_offset_value, + 'type': tool_cut_type, 'tool_type': tool_type, 'data': tool_data, 'solid_geometry': deepcopy(new_solid_geo) diff --git a/appTools/ToolMilling.py b/appTools/ToolMilling.py index 7a494305..dd37f14f 100644 --- a/appTools/ToolMilling.py +++ b/appTools/ToolMilling.py @@ -980,7 +980,7 @@ class ToolMilling(AppTool, Excellon): # if the sender is in the column with index 2 then we update the tool_type key if cw_col == 2: tt = cw.currentText() - typ = 'Iso' if tt == 'V' else _("Rough") + typ = 'Iso' if tt == 'V' else 'Rough' self.iso_tools[current_uid].update({ 'type': typ, diff --git a/appTools/ToolNCC.py b/appTools/ToolNCC.py index f02a87e5..48766635 100644 --- a/appTools/ToolNCC.py +++ b/appTools/ToolNCC.py @@ -837,7 +837,7 @@ class NonCopperClear(AppTool, Gerber): # if the sender is in the column with index 2 then we update the tool_type key if cw_col == 2: tt = cw.currentText() - typ = 'Iso' if tt == 'V' else _("Rough") + typ = 'Iso' if tt == 'V' else 'Rough' self.ncc_tools[current_uid].update({ 'type': typ, @@ -1043,7 +1043,7 @@ class NonCopperClear(AppTool, Gerber): offset = 'Path' offset_val = 0.0 - typ = _("Rough") + typ = 'Rough' tool_type = 'V' # look in database tools for db_tool, db_tool_val in tools_db_dict.items(): diff --git a/appTools/ToolPaint.py b/appTools/ToolPaint.py index bae71a79..d9842e2d 100644 --- a/appTools/ToolPaint.py +++ b/appTools/ToolPaint.py @@ -412,7 +412,7 @@ class ToolPaint(AppTool, Gerber): # if the sender is in the column with index 2 then we update the tool_type key if cw_col == 2: tt = cw.currentText() - typ = 'Iso' if tt == 'V' else _("Rough") + typ = 'Iso' if tt == 'V' else 'Rough' self.paint_tools[current_uid].update({ 'type': typ, @@ -730,7 +730,7 @@ class ToolPaint(AppTool, Gerber): offset = 'Path' offset_val = 0.0 - typ = _("Rough") + typ = 'Rough' tool_type = 'V' # look in database tools for db_tool, db_tool_val in tools_db_dict.items(): diff --git a/camlib.py b/camlib.py index 4fd0cc0c..c68df842 100644 --- a/camlib.py +++ b/camlib.py @@ -1228,7 +1228,7 @@ class Geometry(object): 'tooldia': tooldia, 'offset': 'Path', 'offset_value': 0.0, - 'type': _('Rough'), + 'type': 'Rough', 'tool_type': 'C1', 'data': deepcopy(new_data), 'solid_geometry': self.solid_geometry @@ -1289,7 +1289,7 @@ class Geometry(object): 'tooldia': tooldia, 'offset': 'Path', 'offset_value': 0.0, - 'type': _('Rough'), + 'type': 'Rough', 'tool_type': 'C1', 'data': deepcopy(new_data), 'solid_geometry': self.solid_geometry