Explorar o código

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

Marius Stanciu %!s(int64=7) %!d(string=hai) anos
pai
achega
c7db9aa566
Modificáronse 6 ficheiros con 43 adicións e 23 borrados
  1. 1 1
      FlatCAMApp.py
  2. 27 9
      FlatCAMObj.py
  3. 6 1
      README.md
  4. 3 4
      postprocessors/grbl_11.py
  5. 3 4
      postprocessors/manual_toolchange.py
  6. 3 4
      postprocessors/marlin.py

+ 1 - 1
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
 

+ 27 - 9
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'

+ 6 - 1
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

+ 3 - 4
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

+ 3 - 4
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

+ 3 - 4
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}