- 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)
This commit is contained in:
Marius Stanciu 2019-01-07 02:56:55 +02:00 committed by Marius S
parent 954bd9097a
commit c7db9aa566
6 changed files with 43 additions and 23 deletions

View File

@ -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

View File

@ -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'

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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}