- in Drilling Plugin fixed a situation when having tools with the same diameter will get them multiplied by the number of those tools
This commit is contained in:
@@ -7,6 +7,10 @@ CHANGELOG for FlatCAM Evo beta
|
|||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
7.11.2022
|
||||||
|
|
||||||
|
- in Drilling Plugin fixed a situation when having tools with the same diameter will get them multiplied by the number of those tools
|
||||||
|
|
||||||
6.11.2022
|
6.11.2022
|
||||||
|
|
||||||
- if PikePDF module is not available then show an error but run the app (currently, for Python 3.11 is the only module not available)
|
- if PikePDF module is not available then show an error but run the app (currently, for Python 3.11 is the only module not available)
|
||||||
|
|||||||
@@ -654,29 +654,47 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
self.app.log.debug("ToolDrilling.build_tool_ui()")
|
self.app.log.debug("ToolDrilling.build_tool_ui()")
|
||||||
self.ui_disconnect()
|
self.ui_disconnect()
|
||||||
|
|
||||||
# order the tools by tool diameter if it's the case
|
# # order the tools by tool diameter if it's the case
|
||||||
sorted_tools = []
|
# sorted_tools = []
|
||||||
for k, v in self.excellon_tools.items():
|
# for k, v in self.excellon_tools.items():
|
||||||
sorted_tools.append(self.dec_format(float(v['tooldia'])))
|
# sorted_tools.append(self.dec_format(float(v['tooldia'])))
|
||||||
|
#
|
||||||
|
# order = self.ui.order_combo.get_value()
|
||||||
|
# if order == 1: # 'fwd'
|
||||||
|
# sorted_tools.sort(reverse=False)
|
||||||
|
# elif order == 2: # 'rev'
|
||||||
|
# sorted_tools.sort(reverse=True)
|
||||||
|
# else:
|
||||||
|
# pass
|
||||||
|
#
|
||||||
|
# # remake the excellon_tools dict in the order above
|
||||||
|
# new_id = 1
|
||||||
|
# new_tools = {}
|
||||||
|
# for tooldia in sorted_tools:
|
||||||
|
# for old_tool in self.excellon_tools:
|
||||||
|
# if self.dec_format(float(self.excellon_tools[old_tool]['tooldia'])) == tooldia:
|
||||||
|
# new_tools[new_id] = deepcopy(self.excellon_tools[old_tool])
|
||||||
|
# new_id += 1
|
||||||
|
|
||||||
order = self.ui.order_combo.get_value()
|
order = self.ui.order_combo.get_value()
|
||||||
if order == 1: # 'fwd'
|
if order == 1: # 'fwd'
|
||||||
sorted_tools.sort(reverse=False)
|
new_tools = {
|
||||||
elif order == 2: # 'rev'
|
k: v for k, v in sorted(self.excellon_tools.items(), key=lambda it: it[1]['tooldia'], reverse=False)
|
||||||
sorted_tools.sort(reverse=True)
|
}
|
||||||
|
for idx, v in enumerate(new_tools.values(), start=1):
|
||||||
|
self.excellon_tools[idx] = v
|
||||||
|
elif order == 2: # 'rev'
|
||||||
|
new_tools = {
|
||||||
|
k: v for k, v in sorted(self.excellon_tools.items(), key=lambda it: it[1]['tooldia'], reverse=True)
|
||||||
|
}
|
||||||
|
for idx, v in enumerate(new_tools.values(), start=1):
|
||||||
|
self.excellon_tools[idx] = v
|
||||||
else:
|
else:
|
||||||
pass
|
try:
|
||||||
|
self.excellon_tools = self.excellon_obj.tools
|
||||||
# remake the excellon_tools dict in the order above
|
except AttributeError:
|
||||||
new_id = 1
|
# when no object was loaded yet
|
||||||
new_tools = {}
|
pass
|
||||||
for tooldia in sorted_tools:
|
|
||||||
for old_tool in self.excellon_tools:
|
|
||||||
if self.dec_format(float(self.excellon_tools[old_tool]['tooldia'])) == tooldia:
|
|
||||||
new_tools[new_id] = deepcopy(self.excellon_tools[old_tool])
|
|
||||||
new_id += 1
|
|
||||||
|
|
||||||
self.excellon_tools = new_tools
|
|
||||||
|
|
||||||
if self.excellon_obj and self.excellon_tools:
|
if self.excellon_obj and self.excellon_tools:
|
||||||
self.ui.exc_param_frame.setDisabled(False)
|
self.ui.exc_param_frame.setDisabled(False)
|
||||||
|
|||||||
Reference in New Issue
Block a user