- working on the Drilling Tool - started to create a new data structure that will hold the Excellon object data
This commit is contained in:
@@ -18,6 +18,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
- Tool Isolation - fixed a UI minor issue: 'forced rest' checkbox state at startup was always enabled
|
- Tool Isolation - fixed a UI minor issue: 'forced rest' checkbox state at startup was always enabled
|
||||||
- started working in moving the Excellon drilling in its own Application Tool
|
- started working in moving the Excellon drilling in its own Application Tool
|
||||||
- created a new App Tool named Drilling Tool where I will move the drilling out of the Excellon UI
|
- created a new App Tool named Drilling Tool where I will move the drilling out of the Excellon UI
|
||||||
|
- working on the Drilling Tool - started to create a new data structure that will hold the Excellon object data
|
||||||
|
|
||||||
14.06.2020
|
14.06.2020
|
||||||
|
|
||||||
|
|||||||
@@ -171,6 +171,8 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
# #############################################################################
|
# #############################################################################
|
||||||
# ############################ SIGNALS ########################################
|
# ############################ SIGNALS ########################################
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
|
||||||
|
self.ui.object_combo.currentIndexChanged.connect(self.on_object_changed)
|
||||||
self.ui.apply_param_to_all.clicked.connect(self.on_apply_param_to_all_clicked)
|
self.ui.apply_param_to_all.clicked.connect(self.on_apply_param_to_all_clicked)
|
||||||
self.ui.generate_cnc_button.clicked.connect(self.on_cnc_button_click)
|
self.ui.generate_cnc_button.clicked.connect(self.on_cnc_button_click)
|
||||||
self.ui.tools_table.drag_drop_sig.connect(self.rebuild_ui)
|
self.ui.tools_table.drag_drop_sig.connect(self.rebuild_ui)
|
||||||
@@ -363,28 +365,7 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
if opt_key.find('geometry_') == 0:
|
if opt_key.find('geometry_') == 0:
|
||||||
self.default_data[opt_key] = deepcopy(opt_val)
|
self.default_data[opt_key] = deepcopy(opt_val)
|
||||||
|
|
||||||
sort = []
|
self.on_object_changed()
|
||||||
for k, v in list(self.tools.items()):
|
|
||||||
sort.append((k, float('%.*f' % (self.decimals, float(v.get('C'))))))
|
|
||||||
dias = [i[0] for i in sort]
|
|
||||||
|
|
||||||
if not dias:
|
|
||||||
log.error("At least one tool diameter needed. Excellon object might be empty.")
|
|
||||||
return
|
|
||||||
|
|
||||||
tooluid = 0
|
|
||||||
|
|
||||||
self.excellon_tools.clear()
|
|
||||||
for tool_dia in dias:
|
|
||||||
tooluid += 1
|
|
||||||
self.excellon_tools.update({
|
|
||||||
int(tooluid): {
|
|
||||||
'tooldia': float('%.*f' % (self.decimals, tool_dia)),
|
|
||||||
|
|
||||||
'data': deepcopy(self.default_data),
|
|
||||||
'solid_geometry': []
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
self.obj_name = ""
|
self.obj_name = ""
|
||||||
self.excellon_obj = None
|
self.excellon_obj = None
|
||||||
@@ -435,22 +416,24 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve object"), str(self.obj_name)))
|
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve object"), str(self.obj_name)))
|
||||||
return "Could not retrieve object: %s with error: %s" % (self.obj_name, str(e))
|
return "Could not retrieve object: %s with error: %s" % (self.obj_name, str(e))
|
||||||
|
|
||||||
# if self.excellon_obj is None:
|
if self.excellon_obj:
|
||||||
# return
|
self.ui.exc_param_frame.setDisabled(False)
|
||||||
|
|
||||||
sort = []
|
sort = []
|
||||||
for k, v in list(self.tools.items()):
|
for k, v in list(self.excellon_obj.tools.items()):
|
||||||
sort.append((k, float('%.*f' % (self.decimals, float(v.get('C'))))))
|
sort.append((k, float('%.*f' % (self.decimals, float(v.get('C'))))))
|
||||||
order = self.ui.order_radio.get_value()
|
order = self.ui.order_radio.get_value()
|
||||||
if order == 'fwd':
|
if order == 'fwd':
|
||||||
sorted_tools = sorted(sort, key=lambda t1: t1[1])
|
sorted_tools = sorted(sort, key=lambda t1: t1[1])
|
||||||
elif order == 'rev':
|
elif order == 'rev':
|
||||||
sorted_tools = sorted(sort, key=lambda t1: t1[1], reverse=True)
|
sorted_tools = sorted(sort, key=lambda t1: t1[1], reverse=True)
|
||||||
|
else:
|
||||||
|
sorted_tools = sort
|
||||||
|
tools = [i[0] for i in sorted_tools]
|
||||||
else:
|
else:
|
||||||
sorted_tools = sort
|
tools = []
|
||||||
tools = [i[0] for i in sorted_tools]
|
|
||||||
|
|
||||||
n = len(sorted_tools)
|
n = len(tools)
|
||||||
# we have (n+2) rows because there are 'n' tools, each a row, plus the last 2 rows for totals.
|
# we have (n+2) rows because there are 'n' tools, each a row, plus the last 2 rows for totals.
|
||||||
self.ui.tools_table.setRowCount(n + 2)
|
self.ui.tools_table.setRowCount(n + 2)
|
||||||
self.tool_row = 0
|
self.tool_row = 0
|
||||||
@@ -650,6 +633,45 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
"<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("Multiple Tools"))
|
"<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("Multiple Tools"))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def on_object_changed(self):
|
||||||
|
# load the Excellon object
|
||||||
|
self.obj_name = self.ui.object_combo.currentText()
|
||||||
|
|
||||||
|
# Get source object.
|
||||||
|
try:
|
||||||
|
self.excellon_obj = self.app.collection.get_by_name(self.obj_name)
|
||||||
|
except Exception as e:
|
||||||
|
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve object"), str(self.obj_name)))
|
||||||
|
return "Could not retrieve object: %s with error: %s" % (self.obj_name, str(e))
|
||||||
|
|
||||||
|
if self.excellon_obj is None:
|
||||||
|
self.ui.exc_param_frame.setDisabled(True)
|
||||||
|
else:
|
||||||
|
self.ui.exc_param_frame.setDisabled(False)
|
||||||
|
sort = []
|
||||||
|
for k, v in list(self.excellon_obj.tools.items()):
|
||||||
|
sort.append((k, float('%.*f' % (self.decimals, float(v.get('C'))))))
|
||||||
|
dias = [i[0] for i in sort]
|
||||||
|
|
||||||
|
if not dias:
|
||||||
|
log.error("At least one tool diameter needed. Excellon object might be empty.")
|
||||||
|
return
|
||||||
|
|
||||||
|
tooluid = 0
|
||||||
|
|
||||||
|
self.excellon_tools.clear()
|
||||||
|
for tool_dia in dias:
|
||||||
|
tooluid += 1
|
||||||
|
self.excellon_tools.update({
|
||||||
|
int(tooluid): {
|
||||||
|
'tooldia': float('%.*f' % (self.decimals, tool_dia)),
|
||||||
|
|
||||||
|
'data': deepcopy(self.default_data),
|
||||||
|
'solid_geometry': []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
self.build_ui()
|
||||||
|
|
||||||
def ui_connect(self):
|
def ui_connect(self):
|
||||||
|
|
||||||
# Area Exception - exclusion shape added signal
|
# Area Exception - exclusion shape added signal
|
||||||
@@ -1299,7 +1321,6 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def on_cnc_button_click(self):
|
def on_cnc_button_click(self):
|
||||||
self.read_form()
|
|
||||||
self.obj_name = self.ui.object_combo.currentText()
|
self.obj_name = self.ui.object_combo.currentText()
|
||||||
|
|
||||||
# Get source object.
|
# Get source object.
|
||||||
|
|||||||
Reference in New Issue
Block a user