- in Milling Tool fixed the UI change as a result of preprocessor change
- in Isolation Tool added possibility to have tools with the same diameter; remade the sorting of the tools storage
This commit is contained in:
@@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta
|
|||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
1.12.2020
|
||||||
|
|
||||||
|
- in Milling Tool fixed the UI change as a result of preprocessor change
|
||||||
|
- in Isolation Tool added possibility to have tools with the same diameter; remade the sorting of the tools storage
|
||||||
|
|
||||||
29.11.2020
|
29.11.2020
|
||||||
|
|
||||||
- in Geometry Editor - improvements and some issues are solved
|
- in Geometry Editor - improvements and some issues are solved
|
||||||
|
|||||||
@@ -456,52 +456,41 @@ class ToolIsolation(AppTool, Gerber):
|
|||||||
self.ui_disconnect()
|
self.ui_disconnect()
|
||||||
|
|
||||||
# updated units
|
# updated units
|
||||||
self.units = self.app.defaults['units'].upper()
|
units = self.app.defaults['units'].upper()
|
||||||
|
self.units = units
|
||||||
|
|
||||||
sorted_tools = []
|
self.sort_iso_tools()
|
||||||
for k, v in self.iso_tools.items():
|
|
||||||
sorted_tools.append(self.app.dec_format(float(v['tooldia']), self.decimals))
|
|
||||||
|
|
||||||
order = self.ui.order_radio.get_value()
|
n = len(self.iso_tools)
|
||||||
if order == 'fwd':
|
|
||||||
sorted_tools.sort(reverse=False)
|
|
||||||
elif order == 'rev':
|
|
||||||
sorted_tools.sort(reverse=True)
|
|
||||||
else:
|
|
||||||
pass
|
|
||||||
|
|
||||||
n = len(sorted_tools)
|
|
||||||
self.ui.tools_table.setRowCount(n)
|
self.ui.tools_table.setRowCount(n)
|
||||||
tool_id = 0
|
tool_id = 0
|
||||||
|
|
||||||
for tool_sorted in sorted_tools:
|
for tooluid_key, tooluid_value in self.iso_tools.items():
|
||||||
for tooluid_key, tooluid_value in self.iso_tools.items():
|
tool_id += 1
|
||||||
truncated_dia = self.app.dec_format(tooluid_value['tooldia'], self.decimals)
|
|
||||||
if truncated_dia == tool_sorted:
|
|
||||||
tool_id += 1
|
|
||||||
|
|
||||||
# Tool name/id
|
# Tool name/id
|
||||||
id_ = QtWidgets.QTableWidgetItem('%d' % int(tool_id))
|
id_ = QtWidgets.QTableWidgetItem('%d' % int(tool_id))
|
||||||
id_.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
id_.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
||||||
row_no = tool_id - 1
|
row_no = tool_id - 1
|
||||||
self.ui.tools_table.setItem(row_no, 0, id_)
|
self.ui.tools_table.setItem(row_no, 0, id_)
|
||||||
|
|
||||||
# Diameter
|
# Diameter
|
||||||
dia = QtWidgets.QTableWidgetItem(str(truncated_dia))
|
truncated_dia = self.app.dec_format(tooluid_value['tooldia'], self.decimals)
|
||||||
dia.setFlags(QtCore.Qt.ItemIsEnabled)
|
dia = QtWidgets.QTableWidgetItem(str(truncated_dia))
|
||||||
self.ui.tools_table.setItem(row_no, 1, dia)
|
dia.setFlags(QtCore.Qt.ItemIsEnabled)
|
||||||
|
self.ui.tools_table.setItem(row_no, 1, dia)
|
||||||
|
|
||||||
# Tool Type
|
# Tool Type
|
||||||
tool_type_item = FCComboBox()
|
tool_type_item = FCComboBox()
|
||||||
tool_type_item.addItems(self.tool_type_item_options)
|
tool_type_item.addItems(self.tool_type_item_options)
|
||||||
idx = tool_type_item.findText(tooluid_value['tool_type'])
|
idx = tool_type_item.findText(tooluid_value['tool_type'])
|
||||||
tool_type_item.setCurrentIndex(idx)
|
tool_type_item.setCurrentIndex(idx)
|
||||||
self.ui.tools_table.setCellWidget(row_no, 2, tool_type_item)
|
self.ui.tools_table.setCellWidget(row_no, 2, tool_type_item)
|
||||||
|
|
||||||
# Tool unique ID
|
# Tool unique ID
|
||||||
# REMEMBER: THIS COLUMN IS HIDDEN
|
# REMEMBER: THIS COLUMN IS HIDDEN
|
||||||
tool_uid_item = QtWidgets.QTableWidgetItem(str(int(tooluid_key)))
|
tool_uid_item = QtWidgets.QTableWidgetItem(str(int(tooluid_key)))
|
||||||
self.ui.tools_table.setItem(row_no, 3, tool_uid_item)
|
self.ui.tools_table.setItem(row_no, 3, tool_uid_item)
|
||||||
|
|
||||||
# make the diameter column editable
|
# make the diameter column editable
|
||||||
for row in range(tool_id):
|
for row in range(tool_id):
|
||||||
@@ -631,6 +620,27 @@ class ToolIsolation(AppTool, Gerber):
|
|||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def sort_iso_tools(self):
|
||||||
|
order = self.ui.order_radio.get_value()
|
||||||
|
if order == 'no':
|
||||||
|
return
|
||||||
|
|
||||||
|
# sort the tools dictionary having the 'tooldia' as sorting key
|
||||||
|
new_tools_list = []
|
||||||
|
if order == 'fwd':
|
||||||
|
new_tools_list = deepcopy(sorted(self.iso_tools.items(), key=lambda x: x[1]['tooldia'], reverse=False))
|
||||||
|
elif order == 'rev':
|
||||||
|
new_tools_list = deepcopy(sorted(self.iso_tools.items(), key=lambda x: x[1]['tooldia'], reverse=True))
|
||||||
|
|
||||||
|
# clear the tools dictionary
|
||||||
|
self.iso_tools.clear()
|
||||||
|
|
||||||
|
# recreate the tools dictionary in a ordered fashion
|
||||||
|
new_toolid = 0
|
||||||
|
for tool in new_tools_list:
|
||||||
|
new_toolid += 1
|
||||||
|
self.iso_tools[new_toolid] = tool[1]
|
||||||
|
|
||||||
def on_toggle_all_rows(self):
|
def on_toggle_all_rows(self):
|
||||||
"""
|
"""
|
||||||
will toggle the selection of all rows in Tools table
|
will toggle the selection of all rows in Tools table
|
||||||
@@ -883,8 +893,7 @@ class ToolIsolation(AppTool, Gerber):
|
|||||||
self.ui.rest_cb.setDisabled(False)
|
self.ui.rest_cb.setDisabled(False)
|
||||||
|
|
||||||
def on_order_changed(self, order):
|
def on_order_changed(self, order):
|
||||||
if order != 'no':
|
self.build_ui()
|
||||||
self.build_ui()
|
|
||||||
|
|
||||||
def on_rest_machining_check(self, state):
|
def on_rest_machining_check(self, state):
|
||||||
if state:
|
if state:
|
||||||
@@ -1173,10 +1182,10 @@ class ToolIsolation(AppTool, Gerber):
|
|||||||
truncated_tooldia = self.app.dec_format(tool_dia, self.decimals)
|
truncated_tooldia = self.app.dec_format(tool_dia, self.decimals)
|
||||||
|
|
||||||
# if new tool diameter already in the Tool List then abort
|
# if new tool diameter already in the Tool List then abort
|
||||||
if truncated_tooldia in tool_dias:
|
# if truncated_tooldia in tool_dias:
|
||||||
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Tool already in Tool Table."))
|
# self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Tool already in Tool Table."))
|
||||||
self.blockSignals(False)
|
# self.blockSignals(False)
|
||||||
return
|
# return
|
||||||
|
|
||||||
# load the database tools from the file
|
# load the database tools from the file
|
||||||
try:
|
try:
|
||||||
@@ -1260,10 +1269,10 @@ class ToolIsolation(AppTool, Gerber):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# if new tool diameter found in Tools Database already in the Tool List then abort
|
# if new tool diameter found in Tools Database already in the Tool List then abort
|
||||||
if updated_tooldia is not None and updated_tooldia in tool_dias:
|
# if updated_tooldia is not None and updated_tooldia in tool_dias:
|
||||||
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Tool already in Tool Table."))
|
# self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Tool already in Tool Table."))
|
||||||
self.blockSignals(False)
|
# self.blockSignals(False)
|
||||||
return
|
# return
|
||||||
|
|
||||||
new_tdia = deepcopy(updated_tooldia) if updated_tooldia is not None else deepcopy(truncated_tooldia)
|
new_tdia = deepcopy(updated_tooldia) if updated_tooldia is not None else deepcopy(truncated_tooldia)
|
||||||
self.iso_tools.update({
|
self.iso_tools.update({
|
||||||
@@ -1317,13 +1326,14 @@ class ToolIsolation(AppTool, Gerber):
|
|||||||
tool_dias.append(self.app.dec_format(v[tool_v], self.decimals))
|
tool_dias.append(self.app.dec_format(v[tool_v], self.decimals))
|
||||||
|
|
||||||
truncated_tooldia = self.app.dec_format(tool_dia, self.decimals)
|
truncated_tooldia = self.app.dec_format(tool_dia, self.decimals)
|
||||||
if truncated_tooldia in tool_dias:
|
# if truncated_tooldia in tool_dias:
|
||||||
if muted is None:
|
# if muted is None:
|
||||||
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Tool already in Tool Table."))
|
# self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Tool already in Tool Table."))
|
||||||
# self.ui.tools_table.itemChanged.connect(self.on_tool_edit)
|
# # self.ui.tools_table.itemChanged.connect(self.on_tool_edit)
|
||||||
self.blockSignals(False)
|
# self.blockSignals(False)
|
||||||
return
|
# return
|
||||||
|
|
||||||
|
# print("before", self.iso_tools)
|
||||||
self.iso_tools.update({
|
self.iso_tools.update({
|
||||||
int(self.tooluid): {
|
int(self.tooluid): {
|
||||||
'tooldia': truncated_tooldia,
|
'tooldia': truncated_tooldia,
|
||||||
@@ -1335,6 +1345,7 @@ class ToolIsolation(AppTool, Gerber):
|
|||||||
'solid_geometry': []
|
'solid_geometry': []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
# print("after", self.iso_tools)
|
||||||
|
|
||||||
self.blockSignals(False)
|
self.blockSignals(False)
|
||||||
self.build_ui()
|
self.build_ui()
|
||||||
@@ -2741,10 +2752,10 @@ class ToolIsolation(AppTool, Gerber):
|
|||||||
tool_dias.append(self.app.dec_format(v[tool_v], self.decimals))
|
tool_dias.append(self.app.dec_format(v[tool_v], self.decimals))
|
||||||
|
|
||||||
truncated_tooldia = self.app.dec_format(tooldia, self.decimals)
|
truncated_tooldia = self.app.dec_format(tooldia, self.decimals)
|
||||||
if truncated_tooldia in tool_dias:
|
# if truncated_tooldia in tool_dias:
|
||||||
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Tool already in Tool Table."))
|
# self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Tool already in Tool Table."))
|
||||||
self.ui_connect()
|
# self.ui_connect()
|
||||||
return 'fail'
|
# return 'fail'
|
||||||
|
|
||||||
self.iso_tools.update({
|
self.iso_tools.update({
|
||||||
tooluid: {
|
tooluid: {
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
self.grid_status_memory = self.app.ui.grid_snap_btn.isChecked()
|
self.grid_status_memory = self.app.ui.grid_snap_btn.isChecked()
|
||||||
|
|
||||||
# store here the state of the exclusion checkbox state to be restored after building the UI
|
# store here the state of the exclusion checkbox state to be restored after building the UI
|
||||||
# TODO add this in the sel.app.defaults dict and in Preferences
|
# TODO add this in the self.app.defaults dict and in Preferences
|
||||||
self.exclusion_area_cb_is_checked = False
|
self.exclusion_area_cb_is_checked = False
|
||||||
|
|
||||||
# store here solid_geometry when there are tool with isolation job
|
# store here solid_geometry when there are tool with isolation job
|
||||||
@@ -211,6 +211,7 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
# #############################################################################
|
# #############################################################################
|
||||||
self.builduiSig.connect(self.build_ui)
|
self.builduiSig.connect(self.build_ui)
|
||||||
|
|
||||||
|
# add Tool
|
||||||
self.ui.search_and_add_btn.clicked.connect(self.on_tool_add)
|
self.ui.search_and_add_btn.clicked.connect(self.on_tool_add)
|
||||||
self.ui.deltool_btn.clicked.connect(self.on_tool_delete)
|
self.ui.deltool_btn.clicked.connect(self.on_tool_delete)
|
||||||
self.ui.addtool_from_db_btn.clicked.connect(self.on_tool_add_from_db_clicked)
|
self.ui.addtool_from_db_btn.clicked.connect(self.on_tool_add_from_db_clicked)
|
||||||
@@ -218,6 +219,7 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
self.ui.target_radio.activated_custom.connect(self.on_target_changed)
|
self.ui.target_radio.activated_custom.connect(self.on_target_changed)
|
||||||
self.ui.operation_type_combo.currentIndexChanged.connect(self.on_operation_changed)
|
self.ui.operation_type_combo.currentIndexChanged.connect(self.on_operation_changed)
|
||||||
self.ui.offset_type_combo.currentIndexChanged.connect(self.on_offset_type_changed)
|
self.ui.offset_type_combo.currentIndexChanged.connect(self.on_offset_type_changed)
|
||||||
|
self.ui.pp_geo_name_cb.activated.connect(self.on_pp_changed)
|
||||||
|
|
||||||
# V tool shape params changed
|
# V tool shape params changed
|
||||||
self.ui.tipdia_entry.valueChanged.connect(self.on_update_cutz)
|
self.ui.tipdia_entry.valueChanged.connect(self.on_update_cutz)
|
||||||
@@ -2194,23 +2196,19 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
if 'laser' in current_pp.lower():
|
if 'laser' in current_pp.lower():
|
||||||
self.ui.cutzlabel.hide()
|
self.ui.cutzlabel.hide()
|
||||||
self.ui.cutz_entry.hide()
|
self.ui.cutz_entry.hide()
|
||||||
|
|
||||||
|
self.ui.endz_label.hide()
|
||||||
|
self.ui.endz_entry.hide()
|
||||||
|
|
||||||
|
self.ui.travelzlabel.hide()
|
||||||
|
self.ui.travelz_entry.hide()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.ui.mpass_cb.hide()
|
self.ui.mpass_cb.hide()
|
||||||
self.ui.maxdepth_entry.hide()
|
self.ui.maxdepth_entry.hide()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if 'marlin' in current_pp.lower():
|
|
||||||
self.ui.travelzlabel.setText('%s:' % _("Focus Z"))
|
|
||||||
self.ui.endz_label.show()
|
|
||||||
self.ui.endz_entry.show()
|
|
||||||
else:
|
|
||||||
self.ui.travelzlabel.hide()
|
|
||||||
self.ui.travelz_entry.hide()
|
|
||||||
|
|
||||||
self.ui.endz_label.hide()
|
|
||||||
self.ui.endz_entry.hide()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.ui.frzlabel.hide()
|
self.ui.frzlabel.hide()
|
||||||
self.ui.feedrate_z_entry.hide()
|
self.ui.feedrate_z_entry.hide()
|
||||||
@@ -2231,7 +2229,6 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
self.ui.travelzlabel.setText('%s:' % _('Travel Z'))
|
self.ui.travelzlabel.setText('%s:' % _('Travel Z'))
|
||||||
|
|
||||||
self.ui.travelzlabel.show()
|
self.ui.travelzlabel.show()
|
||||||
self.ui.travelz_entry.show()
|
self.ui.travelz_entry.show()
|
||||||
|
|
||||||
@@ -2248,6 +2245,14 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
|
|
||||||
self.ui.spindle_label.setText('%s:' % _('Spindle speed'))
|
self.ui.spindle_label.setText('%s:' % _('Spindle speed'))
|
||||||
|
|
||||||
|
if ('marlin' in current_pp.lower() and 'laser' in current_pp.lower()) or 'z_laser' in current_pp.lower():
|
||||||
|
self.ui.travelzlabel.setText('%s:' % _("Focus Z"))
|
||||||
|
self.ui.travelzlabel.show()
|
||||||
|
self.ui.travelz_entry.show()
|
||||||
|
|
||||||
|
self.ui.endz_label.show()
|
||||||
|
self.ui.endz_entry.show()
|
||||||
|
|
||||||
def on_cnc_button_click(self):
|
def on_cnc_button_click(self):
|
||||||
self.obj_name = self.ui.object_combo.currentText()
|
self.obj_name = self.ui.object_combo.currentText()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user