Merged in marius_stanciu/flatcam (pull request #24)

Bug fixed: Toolchange Z parameter was not saved in defaults / Issue #188 changed the sorting so it uses lambda function instead operator module
This commit is contained in:
jpcgt 2016-02-17 09:31:28 -05:00
commit 4e0fa74245
3 changed files with 21 additions and 11 deletions

View File

@ -221,6 +221,7 @@ class App(QtCore.QObject):
"excellon_travelz": self.defaults_form.excellon_group.travelz_entry,
"excellon_feedrate": self.defaults_form.excellon_group.feedrate_entry,
"excellon_spindlespeed": self.defaults_form.excellon_group.spindlespeed_entry,
"excellon_toolchangez": self.defaults_form.excellon_group.toolchangez_entry,
"geometry_plot": self.defaults_form.geometry_group.plot_cb,
"geometry_cutz": self.defaults_form.geometry_group.cutz_entry,
"geometry_travelz": self.defaults_form.geometry_group.travelz_entry,
@ -262,6 +263,7 @@ class App(QtCore.QObject):
"excellon_travelz": 0.1,
"excellon_feedrate": 3.0,
"excellon_spindlespeed": None,
"excellon_toolchangez": 1.0,
"geometry_plot": True,
"geometry_cutz": -0.002,
"geometry_travelz": 0.1,
@ -346,6 +348,7 @@ class App(QtCore.QObject):
"excellon_travelz": self.options_form.excellon_group.travelz_entry,
"excellon_feedrate": self.options_form.excellon_group.feedrate_entry,
"excellon_spindlespeed": self.options_form.excellon_group.spindlespeed_entry,
"excellon_toolchangez": self.options_form.excellon_group.toolchangez_entry,
"geometry_plot": self.options_form.geometry_group.plot_cb,
"geometry_cutz": self.options_form.geometry_group.cutz_entry,
"geometry_travelz": self.options_form.geometry_group.travelz_entry,
@ -386,6 +389,7 @@ class App(QtCore.QObject):
"excellon_travelz": 0.1,
"excellon_feedrate": 3.0,
"excellon_spindlespeed": None,
"excellon_toolchangez": 1.0,
"geometry_plot": True,
"geometry_cutz": -0.002,
"geometry_travelz": 0.1,
@ -1146,7 +1150,7 @@ class App(QtCore.QObject):
# Options to scale
dimensions = ['gerber_isotooldia', 'gerber_cutoutmargin', 'gerber_cutoutgapsize',
'gerber_noncoppermargin', 'gerber_bboxmargin', 'excellon_drillz',
'excellon_travelz', 'excellon_feedrate', 'cncjob_tooldia',
'excellon_travelz', 'excellon_feedrate', 'excellon_toolchangez', 'cncjob_tooldia',
'geometry_cutz', 'geometry_travelz', 'geometry_feedrate',
'geometry_cnctooldia', 'geometry_painttooldia', 'geometry_paintoverlap',
'geometry_paintmargin']

View File

@ -586,14 +586,22 @@ class ExcellonOptionsGroupUI(OptionsGroupUI):
self.feedrate_entry = LengthEntry()
grid1.addWidget(self.feedrate_entry, 2, 1)
toolchangezlabel = QtGui.QLabel('Toolchange Z:')
toolchangezlabel.setToolTip(
"Tool Z where user can change drill bit\n"
)
grid1.addWidget(toolchangezlabel, 3, 0)
self.toolchangez_entry = LengthEntry()
grid1.addWidget(self.toolchangez_entry, 3, 1)
spdlabel = QtGui.QLabel('Spindle speed:')
spdlabel.setToolTip(
"Speed of the spindle\n"
"in RPM (optional)"
)
grid1.addWidget(spdlabel, 3, 0)
grid1.addWidget(spdlabel, 4, 0)
self.spindlespeed_entry = IntEntry(allow_empty=True)
grid1.addWidget(self.spindlespeed_entry, 3, 1)
grid1.addWidget(self.spindlespeed_entry, 4, 1)
class GeometryOptionsGroupUI(OptionsGroupUI):

View File

@ -55,8 +55,6 @@ from svgparse import *
import logging
import operator
log = logging.getLogger('base2')
log.setLevel(logging.DEBUG)
# log.setLevel(logging.WARNING)
@ -2711,16 +2709,16 @@ class CNCjob(Geometry):
# Tools
#sort the tools list by the second item in tuple (here we have a dict with diameter of the tool)
#so we actually are sorting the tools by diameter
sorted_tools = sorted(exobj.tools.items(), key = operator.itemgetter(1))
# sort the tools list by the second item in tuple (here we have a dict with diameter of the tool)
# so we actually are sorting the tools by diameter
sorted_tools = sorted(exobj.tools.items(), key = lambda x: x[1])
if tools == "all":
tools = str([i[0] for i in sorted_tools]) #we get a string of ordered tools
tools = str([i[0] for i in sorted_tools]) # we get a string of ordered tools
log.debug("Tools 'all' and sorted are: %s" % str(tools))
else:
selected_tools = [x.strip() for x in tools.split(",")] #we strip spaces and also separate the tools by ','
selected_tools = [x.strip() for x in tools.split(",")] # we strip spaces and also separate the tools by ','
selected_tools = filter(lambda i: i in selected_tools, selected_tools)
tools = [i for i,j in sorted_tools for k in selected_tools if i == k] #create a sorted list of selected tools from the sorted_tools list
tools = [i for i,j in sorted_tools for k in selected_tools if i == k] # create a sorted list of selected tools from the sorted_tools list
log.debug("Tools selected and sorted are: %s" % str(tools))
# Points (Group by tool)