diff --git a/CHANGELOG.md b/CHANGELOG.md index 602d2985..6718e949 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ CHANGELOG for FlatCAM beta - some changes in data tools structure ('tool_type' to ['data']['tools_mill_job_type]) - some strings changes +- working on data structures (offset, offset_value, job_type, shape) and on the Tools Database 4.07.2021 diff --git a/appDatabase.py b/appDatabase.py index 00e40053..288ef77d 100644 --- a/appDatabase.py +++ b/appDatabase.py @@ -361,12 +361,12 @@ class ToolsDB2UI: "Out = offset outside by half of tool diameter\n" "Custom = custom offset using the Custom Offset value")) - self.mill_tooloffset_combo = FCComboBox() - self.mill_tooloffset_combo.addItems(self.offset_item_options) - self.mill_tooloffset_combo.setObjectName('gdb_tool_offset') + self.mill_tooloffset_type_combo = FCComboBox() + self.mill_tooloffset_type_combo.addItems(self.offset_item_options) + self.mill_tooloffset_type_combo.setObjectName('gdb_tool_offset_type') self.grid0.addWidget(self.tooloffset_label, 12, 0) - self.grid0.addWidget(self.mill_tooloffset_combo, 12, 1) + self.grid0.addWidget(self.mill_tooloffset_type_combo, 12, 1) # Custom Offset self.custom_offset_label = FCLabel('%s:' % _("Custom Offset")) @@ -1386,8 +1386,6 @@ class ToolsDB2(QtWidgets.QWidget): 'tooldia': self.app.defaults["tools_mill_tooldia"] 'offset': 'Path' 'offset_value': 0.0 - 'type': 'Rough', - 'tool_type': 'C1' 'data': dict() } } @@ -1421,7 +1419,7 @@ class ToolsDB2(QtWidgets.QWidget): "tooldia": self.ui.dia_entry, # Milling - "tools_mill_tool_type": self.ui.mill_shape_combo, + "tools_mill_shape": self.ui.mill_shape_combo, "tools_mill_cutz": self.ui.mill_cutz_entry, "tools_mill_multidepth": self.ui.mill_multidepth_cb, "tools_mill_depthperpass": self.ui.mill_multidepth_entry, @@ -1432,8 +1430,8 @@ class ToolsDB2(QtWidgets.QWidget): "tools_mill_dwell": self.ui.mill_dwell_cb, "tools_mill_dwelltime": self.ui.mill_dwelltime_entry, - "tools_mill_type": self.ui.job_type_combo, - "tools_mill_offset": self.ui.mill_tooloffset_combo, + "tools_mill_job_type": self.ui.job_type_combo, + "tools_mill_offset_type": self.ui.mill_tooloffset_type_combo, "tools_mill_offset_value": self.ui.mill_custom_offset_entry, "tools_mill_vtipdia": self.ui.mill_vdia_entry, "tools_mill_vtipangle": self.ui.mill_vangle_entry, @@ -1504,25 +1502,25 @@ class ToolsDB2(QtWidgets.QWidget): "gdb_dia": "tooldia", # Milling - "gdb_shape": "tool_type", - "gdb_cutz": "cutz", - "gdb_multidepth": "multidepth", - "gdb_multidepth_entry": "depthperpass", - "gdb_travelz": "travelz", - "gdb_frxy": "feedrate", - "gdb_frz": "feedrate_z", - "gdb_spindle": "spindlespeed", - "gdb_dwell": "dwell", - "gdb_dwelltime": "dwelltime", + "gdb_shape": "tools_mill_shape", + "gdb_cutz": "tools_mill_cutz", + "gdb_multidepth": "tools_mill_multidepth", + "gdb_multidepth_entry": "tools_mill_depthperpass", + "gdb_travelz": "tools_mill_travelz", + "gdb_frxy": "tools_mill_feedrate", + "gdb_frz": "tools_mill_feedrate_z", + "gdb_spindle": "tools_mill_spindlespeed", + "gdb_dwell": "tools_mill_dwell", + "gdb_dwelltime": "tools_mill_dwelltime", - "gdb_job": "job", - "gdb_tool_offset": "offset", - "gdb_custom_offset": "offset_value", - "gdb_vdia": "vtipdia", - "gdb_vangle": "vtipangle", - "gdb_frapids": "feedrate_rapid", - "gdb_ecut": "extracut", - "gdb_ecut_length": "extracut_length", + "gdb_job": "tools_mill_job_type", + "gdb_tool_offset_type": "tools_mill_offset_type", + "gdb_custom_offset": "tools_mill_offset_value", + "gdb_vdia": "tools_mill_vtipdia", + "gdb_vangle": "tools_mill_vtipangle", + "gdb_frapids": "tools_mill_feedrate_rapid", + "gdb_ecut": "tools_mill_extracut", + "gdb_ecut_length": "tools_mill_extracut_length", # NCC "gdb_n_operation": "tools_ncc_operation", @@ -1925,6 +1923,11 @@ class ToolsDB2(QtWidgets.QWidget): "tol_max": 0.0, # Milling + "tools_mill_shape": self.app.defaults["tools_mill_shape"], + "tools_mill_job_type": self.app.defaults["tools_mill_job_type"], + "tools_mill_offset_type": self.app.defaults["tools_mill_offset_type"], + "tools_mill_offset_value": float(self.app.defaults["tools_mill_offset_value"]), + "tools_mill_cutz": float(self.app.defaults["tools_mill_cutz"]), "tools_mill_multidepth": self.app.defaults["tools_mill_multidepth"], "tools_mill_depthperpass": float(self.app.defaults["tools_mill_depthperpass"]), @@ -2039,9 +2042,6 @@ class ToolsDB2(QtWidgets.QWidget): self.app.log.error("ToolDB.on_tool_add() --> %s" % str(e)) return - dict_elem['offset'] = 'Path' - dict_elem['offset_value'] = 0.0 - dict_elem['tool_type'] = 'C1' dict_elem['data'] = default_data new_toolid = len(self.db_tool_dict) + 1 @@ -2511,10 +2511,6 @@ class ToolsDB2(QtWidgets.QWidget): self.db_tool_dict[tool_id]['name'] = val elif wdg_name == "gdb_dia": self.db_tool_dict[tool_id]['tooldia'] = val - elif wdg_name == "gdb_tool_offset": - self.db_tool_dict[tool_id]['offset'] = val - elif wdg_name == "gdb_custom_offset": - self.db_tool_dict[tool_id]['offset_value'] = val elif wdg_name == "gdb_job": self.db_tool_dict[tool_id]['data']['job'] = val elif wdg_name == "gdb_shape": @@ -2528,6 +2524,11 @@ class ToolsDB2(QtWidgets.QWidget): elif wdg_name == "gdb_tol_max": self.db_tool_dict[tool_id]['data']['tol_max'] = val + elif wdg_name == "gdb_tool_offset_type": + self.db_tool_dict[tool_id]['data']['tools_mill_offset_type'] = val + elif wdg_name == "gdb_custom_offset": + self.db_tool_dict[tool_id]['tools_mill_offset_value'] = val + elif wdg_name == "gdb_cutz": self.db_tool_dict[tool_id]['data']['cutz'] = val elif wdg_name == "gdb_multidepth": diff --git a/appGUI/preferences/PreferencesUIManager.py b/appGUI/preferences/PreferencesUIManager.py index 87bc2a21..c7b62b0f 100644 --- a/appGUI/preferences/PreferencesUIManager.py +++ b/appGUI/preferences/PreferencesUIManager.py @@ -312,7 +312,7 @@ class PreferencesUIManager: # Milling Plugin Options "tools_mill_tooldia": self.ui.plugin_pref_form.tools_mill_group.cnctooldia_entry, # "tools_mill_offset_type": 0, # _('Path') - # "tools_mill_offset": 0.0, + # "tools_mill_offset_value": 0.0, # "tools_mill_job_type": 0, # 'Rough' "tools_mill_vtipdia": self.ui.plugin_pref_form.tools_mill_group.tipdia_entry, "tools_mill_vtipangle": self.ui.plugin_pref_form.tools_mill_group.tipangle_entry, diff --git a/appPlugins/ToolMilling.py b/appPlugins/ToolMilling.py index 6c175e29..26d71344 100644 --- a/appPlugins/ToolMilling.py +++ b/appPlugins/ToolMilling.py @@ -444,7 +444,7 @@ class ToolMilling(AppTool, Excellon): # Geometry properties # "tools_mill_tooldia": self.ui.addtool_entry, "tools_mill_offset_type": self.ui.offset_type_combo, - "tools_mill_offset": self.ui.offset_entry, + "tools_mill_offset_value": self.ui.offset_entry, "tools_mill_tool_type": self.ui.tool_shape_combo, "tools_mill_job_type": self.ui.job_type_combo, @@ -496,7 +496,7 @@ class ToolMilling(AppTool, Excellon): "milling_dia": "tools_mill_milling_dia", "mill_offset_type": "tools_mill_offset_type", - "mill_offset": "tools_mill_offset", + "mill_offset": "tools_mill_offset_value", "mill_tool_type": "tools_mill_tool_type", "mill_job_type": "tools_mill_job_type", @@ -586,7 +586,7 @@ class ToolMilling(AppTool, Excellon): # "tools_mill_tooldia": 0.1, # # "tools_mill_offset_type": 0, # _("Path") - # "tools_mill_offset": 0.0, + # "tools_mill_offset_value": 0.0, # # "tools_mill_milling_type": "drills", # "tools_mill_milling_dia": 0.04, @@ -746,7 +746,7 @@ class ToolMilling(AppTool, Excellon): tool_data = self.target_obj.tools[tool]['data'] tool_data['tools_mill_offset_type'] = 'Path' - tool_data['tools_mill_offset'] = 0.0 + tool_data['tools_mill_offset_value'] = 0.0 tool_data['tools_mill_job_type'] = 'Rough' tool_data['tools_mill_multidepth'] = False @@ -811,7 +811,7 @@ class ToolMilling(AppTool, Excellon): tool_data = self.target_obj.tools[tool]['data'] tool_data['tools_mill_offset_type'] = app_defaults['tools_mill_offset_type'] - tool_data['tools_mill_offset'] = app_defaults['tools_mill_offset'] + tool_data['tools_mill_offset_value'] = app_defaults['tools_mill_offset_value'] tool_data['tools_mill_job_type'] = app_defaults['tools_mill_job_type'] tool_data['tools_mill_multidepth'] = app_defaults['tools_mill_multidepth'] @@ -2895,11 +2895,11 @@ class ToolMilling(AppTool, Excellon): def_optimization_type = self.target_obj.options["tools_mill_optimization_type"] tools_dict[tooluid_key]['data']["tools_mill_optimization_type"] = def_optimization_type - if dia_cnc_dict['data']['tools_mill_offset'] == 1: # 'in' + if dia_cnc_dict['data']['tools_mill_offset_type'] == 1: # 'in' tool_offset = -dia_cnc_dict['tools_mill_tooldia'] / 2 - elif dia_cnc_dict['data']['tools_mill_offset'] == 2: # 'out' + elif dia_cnc_dict['data']['tools_mill_offset_type'] == 2: # 'out' tool_offset = dia_cnc_dict['tools_mill_tooldia'] / 2 - elif dia_cnc_dict['data']['tools_mill_offset'] == 3: # 'custom' + elif dia_cnc_dict['data']['tools_mill_offset_type'] == 3: # 'custom' try: offset_value = float(self.ui.offset_entry.get_value()) except ValueError: diff --git a/appPlugins/ToolPaint.py b/appPlugins/ToolPaint.py index 7892ffdf..38ac6743 100644 --- a/appPlugins/ToolPaint.py +++ b/appPlugins/ToolPaint.py @@ -890,14 +890,12 @@ class ToolPaint(AppTool, Gerber): offset = 'Path' offset_val = 0.0 - tool_type = 'V' # look in database tools if tools_db_dict: for db_tool, db_tool_val in tools_db_dict.items(): offset = db_tool_val['data']['tools_mill_offset_type'] - offset_val = db_tool_val['data']['tools_mill_offset'] - tool_type = db_tool_val['tool_type'] + offset_val = db_tool_val['data']['tools_mill_offset_value'] db_tooldia = db_tool_val['tooldia'] low_limit = float(db_tool_val['data']['tol_min']) @@ -958,7 +956,6 @@ class ToolPaint(AppTool, Gerber): 'tooldia': new_tdia, 'offset': deepcopy(offset), 'offset_value': deepcopy(offset_val), - 'tool_type': deepcopy(tool_type), 'data': deepcopy(new_tools_dict), 'solid_geometry': [] } diff --git a/camlib.py b/camlib.py index 1a86ec92..72902b81 100644 --- a/camlib.py +++ b/camlib.py @@ -3576,11 +3576,11 @@ class CNCjob(Geometry): p = self.pp_geometry # Offset the Geometry if it is the case - if tool_dict['tools_mill_offset'] == 1: # 'in' + if tool_dict['tools_mill_offset_type'] == 1: # 'in' tool_offset = -float(tool_dict['tools_mill_tooldia']) / 2.0 - elif tool_dict['tools_mill_offset'] == 2: # 'out' + elif tool_dict['tools_mill_offset_type'] == 2: # 'out' tool_offset = float(tool_dict['tools_mill_tooldia']) / 2.0 - elif tool_dict['tools_mill_offset'] == 3: # 'custom' + elif tool_dict['tools_mill_offset_type'] == 3: # 'custom' tool_offset = tool_dict['tools_mill_offset_value'] else: tool_offset = 0.0 diff --git a/defaults.py b/defaults.py index ef1648ec..cd86f40b 100644 --- a/defaults.py +++ b/defaults.py @@ -414,8 +414,9 @@ class FlatCAMDefaults: # Milling Plugin Options "tools_mill_tooldia": "2.4", "tools_mill_offset_type": 0, # _('Path') - "tools_mill_offset": 0.0, + "tools_mill_offset_value": 0.0, "tools_mill_job_type": 0, # 'Roughing' + "tools_mill_shape": 'C1', "tools_mill_cutz": -2.4, "tools_mill_vtipdia": 0.1,