- Milling Tool - working on the data structure - wip

This commit is contained in:
Marius Stanciu
2020-12-06 23:54:11 +02:00
committed by Marius
parent ef11bced6d
commit b0298c02c1
3 changed files with 15 additions and 9 deletions

View File

@@ -256,9 +256,8 @@ class AppObject(QtCore.QObject):
if opt_key.find('geometry' + "_") == 0: if opt_key.find('geometry' + "_") == 0:
oname = opt_key[len('geometry') + 1:] oname = opt_key[len('geometry') + 1:]
default_data[oname] = self.app.options[opt_key] default_data[oname] = self.app.options[opt_key]
if opt_key.find('tools_mill' + "_") == 0: if opt_key.find('tools_') == 0:
oname = opt_key[len('tools_mill') + 1:] default_data[opt_key] = self.app.options[opt_key]
default_data[oname] = self.app.options[opt_key]
new_obj.tools = { new_obj.tools = {
1: { 1: {

View File

@@ -289,7 +289,7 @@ class ToolMilling(AppTool, Excellon):
# Geometry properties # Geometry properties
"cnctooldia": self.ui.addtool_entry, "cnctooldia": self.ui.addtool_entry,
"tool_type": self.ui.geo_tools_table.cellWidget(self.current_row, 2), "tools_mill_tool_type": self.ui.geo_tools_table.cellWidget(self.current_row, 2),
"offset_type": self.ui.offset_type_combo, "offset_type": self.ui.offset_type_combo,
"offset": self.ui.offset_entry, "offset": self.ui.offset_entry,
@@ -392,7 +392,7 @@ class ToolMilling(AppTool, Excellon):
"polish_overlap": 10, "polish_overlap": 10,
"polish_method": _("Standard"), "polish_method": _("Standard"),
"tool_type": 'C1', "tools_mill_tool_type": 'C1',
"vtipdia": 0.1, "vtipdia": 0.1,
"vtipangle": 30, "vtipangle": 30,
@@ -662,7 +662,7 @@ class ToolMilling(AppTool, Excellon):
tool_type_item = FCComboBox(policy=False) tool_type_item = FCComboBox(policy=False)
for item in ["C1", "C2", "C3", "C4", "B", "V"]: for item in ["C1", "C2", "C3", "C4", "B", "V"]:
tool_type_item.addItem(item) tool_type_item.addItem(item)
idx = tool_type_item.findText(tooluid_value['tool_type']) idx = tool_type_item.findText(tooluid_value['data']['tools_mill_tool_type'])
# protection against having this translated or loading a project with translated values # protection against having this translated or loading a project with translated values
if idx == -1: if idx == -1:
tool_type_item.setCurrentIndex(0) tool_type_item.setCurrentIndex(0)
@@ -1374,9 +1374,10 @@ class ToolMilling(AppTool, Excellon):
"area_shape", "area_strategy", "area_overz"]: "area_shape", "area_strategy", "area_overz"]:
try: try:
# widgets in the tools table # widgets in the tools table
if storage_key == 'tool_type': if storage_key == 'tools_mill_tool_type':
print(dict_storage['tools_mill_tool_type'])
form_val = self.ui.geo_tools_table.cellWidget(self.current_row, 2) form_val = self.ui.geo_tools_table.cellWidget(self.current_row, 2)
form_val.set_value(dict_storage[storage_key]) form_val.set_value(dict_storage['tools_mill_tool_type'])
else: else:
self.form_fields[storage_key].set_value(dict_storage[storage_key]) self.form_fields[storage_key].set_value(dict_storage[storage_key])
except Exception as e: except Exception as e:
@@ -1434,7 +1435,7 @@ class ToolMilling(AppTool, Excellon):
try: try:
# widgets in the tools table # widgets in the tools table
if form_key == 'tool_type': if form_key == 'tools_mill_tool_type':
tt_wdg = self.ui.geo_tools_table.cellWidget(self.current_row, 2) tt_wdg = self.ui.geo_tools_table.cellWidget(self.current_row, 2)
self.target_obj.tools[tooluid_key]['data'][form_key] = tt_wdg.get_value() self.target_obj.tools[tooluid_key]['data'][form_key] = tt_wdg.get_value()
else: else:
@@ -1463,6 +1464,8 @@ class ToolMilling(AppTool, Excellon):
tool_type = self.ui.geo_tools_table.cellWidget(cw_row, 2).currentText() tool_type = self.ui.geo_tools_table.cellWidget(cw_row, 2).currentText()
self.ui_update_v_shape(tool_type) self.ui_update_v_shape(tool_type)
self.form_to_storage()
def ui_update_v_shape(self, tool_type_txt): def ui_update_v_shape(self, tool_type_txt):
if tool_type_txt == 'V': if tool_type_txt == 'V':
self.ui.tipdialabel.show() self.ui.tipdialabel.show()
@@ -2048,6 +2051,7 @@ class ToolMilling(AppTool, Excellon):
self.target_obj.ser_attrs.append('tools') self.target_obj.ser_attrs.append('tools')
self.ui_connect() self.ui_connect()
self.build_ui() self.build_ui()
self.target_obj.build_ui() self.target_obj.build_ui()
self.app.inform.emit('[success] %s' % _("Tool was deleted in Tool Table.")) self.app.inform.emit('[success] %s' % _("Tool was deleted in Tool Table."))

View File

@@ -462,6 +462,9 @@ class FlatCAMDefaults:
"tools_drill_area_strategy": "over", "tools_drill_area_strategy": "over",
"tools_drill_area_overz": 1.0, "tools_drill_area_overz": 1.0,
# Milling Tool
"tools_mill_tool_type": 'C1',
# NCC Tool # NCC Tool
"tools_ncc_tools": "1.0, 0.5", "tools_ncc_tools": "1.0, 0.5",
"tools_ncc_order": 'rev', "tools_ncc_order": 'rev',