From 6dc107e4621399ecdac6020881ea61a7699baa19 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 16 Feb 2016 22:47:21 +0200 Subject: [PATCH 1/4] Bug fixed: the Toolchange Z parameter is not saved in the program/project defaults. Solution: Added: 'Toolchange Z' entry in the Options -> Excellon Options Also made sure that the "Toolchange Z" parameter is saved in the defaults.json file and also loaded. Added it into the dimensions list so it can be converted in between IN and MM units. --- FlatCAMApp.py | 6 +++++- FlatCAMGUI.py | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 28a69412..7c72897f 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -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'] diff --git a/FlatCAMGUI.py b/FlatCAMGUI.py index 64cdac0f..8bb2445e 100644 --- a/FlatCAMGUI.py +++ b/FlatCAMGUI.py @@ -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): From 1a7e001a6690c46d74e8da3c20e569063b600f9f Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 16 Feb 2016 22:53:01 +0200 Subject: [PATCH 2/4] Added spaces after '#' in the comments --- camlib.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/camlib.py b/camlib.py index 325d1205..1296f4f3 100644 --- a/camlib.py +++ b/camlib.py @@ -2711,16 +2711,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 + # 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)) 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) From 1be364d065a6e3a884ffae3eee5800075fbd49dc Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 16 Feb 2016 23:25:58 +0200 Subject: [PATCH 3/4] Issue #188: Adopted the solution suggested by JP to not use the operator module when performing the sorting on exobj,tools and use instead the lambda function. --- camlib.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/camlib.py b/camlib.py index 1296f4f3..d4c82400 100644 --- a/camlib.py +++ b/camlib.py @@ -55,8 +55,6 @@ from svgparse import * import logging -import operator - log = logging.getLogger('base2') log.setLevel(logging.DEBUG) # log.setLevel(logging.WARNING) @@ -2713,7 +2711,7 @@ class CNCjob(Geometry): # 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)) + 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 log.debug("Tools 'all' and sorted are: %s" % str(tools)) From 71a81173bdfdbcf575f8cc80247139043141ca9a Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 16 Feb 2016 21:59:54 +0000 Subject: [PATCH 4/4] camlib.py edited online with Bitbucket; removed the paranthesis around lambda function as it was making an tuple which it was not the intention. --- camlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camlib.py b/camlib.py index d4c82400..7d756a12 100644 --- a/camlib.py +++ b/camlib.py @@ -2711,7 +2711,7 @@ class CNCjob(Geometry): # 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])) + 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 log.debug("Tools 'all' and sorted are: %s" % str(tools))