diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 4d9c9381..d5cf4c18 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -87,7 +87,7 @@ class App(QtCore.QObject): log.addHandler(handler) # Version - version = 8.6 + version = 9.0 version_date = "2019/01/06" beta = True diff --git a/FlatCAMObj.py b/FlatCAMObj.py index d1032c01..1fe8b020 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -2775,6 +2775,21 @@ class FlatCAMGeometry(FlatCAMObj, Geometry): return dwg + def get_selected_tools_table_items(self): + """ + Returns a list of lists, each list in the list is made out of row elements + + :return: List of table_tools items. + :rtype: list + """ + table_tools_items = [] + for x in self.ui.geo_tools_table.selectedItems(): + table_tools_items.append([self.ui.geo_tools_table.item(x.row(), column).text() + for column in range(0, self.ui.geo_tools_table.columnCount())]) + for item in table_tools_items: + item[0] = str(item[0]) + return table_tools_items + def on_generatecnc_button_click(self, *args): self.app.report_usage("geometry_on_generatecnc_button") @@ -2838,6 +2853,8 @@ class FlatCAMGeometry(FlatCAMObj, Geometry): job_obj.cnc_tools.clear() # job_obj.create_geometry() + job_obj.options['Tools_in_use'] = self.get_selected_tools_table_items() + for tooluid_key in self.sel_tools: tool_cnt += 1 app_obj.progress.emit(20) @@ -3796,25 +3813,26 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob): self.app.ui.show() def gcode_header(self): + log.debug("FlatCAMCNCJob.gcode_header()") time_str = "{:%A, %d %B %Y at %H:%M}".format(datetime.now()) marlin = False try: - for key in self.cnc_tools[0]: - if self.cnc_tools[0][key]['data']['ppname_g'] == 'marlin': + for key in self.cnc_tools: + if self.cnc_tools[key]['data']['ppname_g'] == 'marlin': marlin = True break - except: + except Exception as e: + log.debug("FlatCAMCNCJob.gcode_header() error: --> %s" % str(e)) try: - for key in self.cnc_tools[0]: - if self.cnc_tools[0][key]['data']['ppname_e'] == 'marlin': + for key in self.cnc_tools: + if self.cnc_tools[key]['data']['ppname_e'] == 'marlin': marlin = True break except: pass if marlin is False: - - gcode = '(G-CODE GENERATED BY FLATCAM - www.flatcam.org 2018)\n' + '\n' + gcode = '(G-CODE GENERATED BY FLATCAM - www.flatcam.org %s)\n' % str(self.app.version_date) + '\n' gcode += '(Name: ' + str(self.options['name']) + ')\n' gcode += '(Type: ' + "G-code from " + str(self.options['type']) + ')\n' @@ -3826,10 +3844,10 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob): gcode += '(Created on ' + time_str + ')\n' + '\n' else: - gcode = ';G-CODE GENERATED BY FLATCAM - www.flatcam.org 2018\n' + '\n' + gcode = ';G-CODE GENERATED BY FLATCAM - www.flatcam.org %s\n' % str(self.app.version_date) + '\n' gcode += ';Name: ' + str(self.options['name']) + '\n' - gcode += ';Type: ' + "G-code from " + str(p['options']['type']) + '\n' + gcode += ';Type: ' + "G-code from " + str(self.options['type']) + '\n' # if str(p['options']['type']) == 'Excellon' or str(p['options']['type']) == 'Excellon Geometry': # gcode += '(Tools in use: ' + str(p['options']['Tools_in_use']) + ')\n' diff --git a/README.md b/README.md index c37657c3..5c587376 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,12 @@ CAD program, and create G-Code for Isolation routing. ================================================= +6.01.2019 + +- fixed the Marlin postprocessor detection in GCode header +- the version date in GCode header is now the one set in FlatCAMApp.App.version_date +- fixed bug in postprocessor files: number of drills is now calculated only for the Excellon objects in toolchange function (only Excellon objects have drills) + 5.01.2019 - fixed cncjob TclCommand - it used the default values for parameters @@ -18,7 +24,6 @@ CAD program, and create G-Code for Isolation routing. - added a new name (mine: for good and/or bad) to the contributors list - fixed the Join function to work on Gerber and Excellon, Gerber and Gerber, Excellon and Excelon combination of objects. The merged property is the solid_geometry and the result is a FlatCAMGeometry object. - 3.01.2019 - initial merge into FlatCAM regular diff --git a/postprocessors/grbl_11.py b/postprocessors/grbl_11.py index b3d0dded..77770912 100644 --- a/postprocessors/grbl_11.py +++ b/postprocessors/grbl_11.py @@ -71,11 +71,10 @@ class grbl_11(FlatCAMPostProc): else: toolC_formatted = format(p.toolC, '.4f') - for i in p['options']['Tools_in_use']: - if i[0] == p.tool: - no_drills = i[2] - if str(p['options']['type']) == 'Excellon': + for i in p['options']['Tools_in_use']: + if i[0] == p.tool: + no_drills = i[2] return """G00 Z{toolchangez} T{tool} M5 diff --git a/postprocessors/manual_toolchange.py b/postprocessors/manual_toolchange.py index 78ae0705..9d846a16 100644 --- a/postprocessors/manual_toolchange.py +++ b/postprocessors/manual_toolchange.py @@ -75,11 +75,10 @@ class manual_toolchange(FlatCAMPostProc): else: toolC_formatted = format(p.toolC, '.4f') - for i in p['options']['Tools_in_use']: - if i[0] == p.tool: - no_drills = i[2] - if str(p['options']['type']) == 'Excellon': + for i in p['options']['Tools_in_use']: + if i[0] == p.tool: + no_drills = i[2] return """G00 Z{toolchangez} T{tool} M5 diff --git a/postprocessors/marlin.py b/postprocessors/marlin.py index 09150437..cbf8be1e 100644 --- a/postprocessors/marlin.py +++ b/postprocessors/marlin.py @@ -69,11 +69,10 @@ class marlin(FlatCAMPostProc): else: toolC_formatted = format(p.toolC, '.4f') - for i in p['options']['Tools_in_use']: - if i[0] == p.tool: - no_drills = i[2] - if str(p['options']['type']) == 'Excellon': + for i in p['options']['Tools_in_use']: + if i[0] == p.tool: + no_drills = i[2] return """G0 Z{toolchangez} M5 M0 Change to Tool Dia = {toolC}, Total drills for current tool = {t_drills}