- in ParseExcellon.Excellon the self.tools dict has now a key 'data' which holds a dict with all the default values for Excellon and Geometry

- Excellon and Geometry objects, when started with multiple tools selected, the parameters tool name reflect this situation
This commit is contained in:
Marius Stanciu 2020-01-16 16:43:39 +02:00
parent 0221a9cfb6
commit b71d4e8c45
3 changed files with 44 additions and 7 deletions

View File

@ -2622,9 +2622,10 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
# sort the tool diameter column
# self.ui.tools_table.sortItems(1)
# all the tools are selected by default
self.ui.tools_table.selectColumn(0)
#
self.ui.tools_table.resizeColumnsToContents()
self.ui.tools_table.resizeRowsToContents()
@ -2686,6 +2687,16 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
except (TypeError, AttributeError):
pass
# set the text on tool_data_label after loading the object
sel_rows = list()
sel_items = self.ui.tools_table.selectedItems()
for it in sel_items:
sel_rows.append(it.row())
if len(sel_rows) > 1:
self.ui.tool_data_label.setText(
"<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("Multiple Tools"))
)
self.ui_connect()
def set_ui(self, ui):
@ -3855,6 +3866,16 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
self.ui.e_cut_entry.setDisabled(False) if self.ui.extracut_cb.get_value() else \
self.ui.e_cut_entry.setDisabled(True)
# set the text on tool_data_label after loading the object
sel_rows = list()
sel_items = self.ui.geo_tools_table.selectedItems()
for it in sel_items:
sel_rows.append(it.row())
if len(sel_rows) > 1:
self.ui.tool_data_label.setText(
"<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("Multiple Tools"))
)
def set_ui(self, ui):
FlatCAMObj.set_ui(self, ui)

View File

@ -17,6 +17,8 @@ CAD program, and create G-Code for Isolation routing.
- a small change in the Excellon UI
- updated the Excellon and Geometry UI to be similar
- put bases for future changes to Excellon Object UI such that each tool will hold it's own parameters
- in ParseExcellon.Excellon the self.tools dict has now a key 'data' which holds a dict with all the default values for Excellon and Geometry
- Excellon and Geometry objects, when started with multiple tools selected, the parameters tool name reflect this situation
15.01.2020

View File

@ -121,6 +121,9 @@ class Excellon(Geometry):
self.zeros_found = deepcopy(self.zeros)
self.units_found = deepcopy(self.units)
# default set of data to be added to each tool in self.tools as self.tools[tool]['data'] = self.default_data
self.default_data = dict()
# this will serve as a default if the Excellon file has no info regarding of tool diameters (this info may be
# in another file like for PCB WIzard ECAD software
self.toolless_diam = 1.0
@ -261,6 +264,14 @@ class Excellon(Geometry):
except Exception:
return "fail"
# fill in self.default_data values from self.options
for opt_key, opt_val in self.app.options.items():
if opt_key.find('excellon_') == 0:
self.default_data[opt_key] = deepcopy(opt_val)
for opt_key, opt_val in self.app.options.items():
if opt_key.find('geometry_') == 0:
self.default_data[opt_key] = deepcopy(opt_val)
def parse_lines(self, elines):
"""
Main Excellon parser.
@ -961,10 +972,8 @@ class Excellon(Geometry):
try:
# clear the solid_geometry in self.tools
for tool in self.tools:
try:
self.tools[tool]['solid_geometry'][:] = []
except KeyError:
self.tools[tool]['solid_geometry'] = []
self.tools[tool]['solid_geometry'] = list()
self.tools[tool]['data'] = dict()
for drill in self.drills:
# poly = drill['point'].buffer(self.tools[drill['tool']]["C"]/2.0)
@ -979,7 +988,10 @@ class Excellon(Geometry):
tooldia = self.tools[drill['tool']]['C']
poly = drill['point'].buffer(tooldia / 2.0, int(int(self.geo_steps_per_circle) / 4))
self.solid_geometry.append(poly)
self.tools[drill['tool']]['solid_geometry'].append(poly)
tool_in_drills = drill['tool']
self.tools[tool_in_drills]['solid_geometry'].append(poly)
self.tools[tool_in_drills]['data'] = deepcopy(self.default_data)
for slot in self.slots:
slot_tooldia = self.tools[slot['tool']]['C']
@ -989,8 +1001,10 @@ class Excellon(Geometry):
lines_string = LineString([start, stop])
poly = lines_string.buffer(slot_tooldia / 2.0, int(int(self.geo_steps_per_circle) / 4))
self.solid_geometry.append(poly)
self.tools[slot['tool']]['solid_geometry'].append(poly)
tool_in_slots = slot['tool']
self.tools[tool_in_slots]['solid_geometry'].append(poly)
self.tools[tool_in_slots]['data'] = deepcopy(self.default_data)
except Exception as e:
log.debug("flatcamParsers.ParseExcellon.Excellon.create_geometry() -> "
"Excellon geometry creation failed due of ERROR: %s" % str(e))