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