Procházet zdrojové kódy

- added a new parameter to set the feedrate of the probing in case the used postprocessor does probing (has toolchange_probe in it's name)
- fixed bug in Marlin postprocessor for the Excellon files; the header and toolchange event always used the parenthesis witch is not compatible with GCode for Marlin
- fixed a issue with a move to Z_move before any toolchange

Marius Stanciu před 7 roky
rodič
revize
3b8b7d470a

+ 4 - 0
FlatCAMApp.py

@@ -350,6 +350,7 @@ class App(QtCore.QObject):
             "excellon_travelz": self.excellon_defaults_form.excellon_opt_group.travelz_entry,
             "excellon_feedrate": self.excellon_defaults_form.excellon_opt_group.feedrate_entry,
             "excellon_feedrate_rapid": self.excellon_defaults_form.excellon_opt_group.feedrate_rapid_entry,
+            "excellon_feedrate_probe": self.excellon_defaults_form.excellon_opt_group.feedrate_probe_entry,
             "excellon_spindlespeed": self.excellon_defaults_form.excellon_opt_group.spindlespeed_entry,
             "excellon_dwell": self.excellon_defaults_form.excellon_opt_group.dwell_cb,
             "excellon_dwelltime": self.excellon_defaults_form.excellon_opt_group.dwelltime_entry,
@@ -376,6 +377,7 @@ class App(QtCore.QObject):
             "geometry_feedrate": self.geometry_defaults_form.geometry_opt_group.cncfeedrate_entry,
             "geometry_feedrate_z": self.geometry_defaults_form.geometry_opt_group.cncplunge_entry,
             "geometry_feedrate_rapid": self.geometry_defaults_form.geometry_opt_group.cncfeedrate_rapid_entry,
+            "geometry_feedrate_probe": self.geometry_defaults_form.geometry_opt_group.feedrate_probe_entry,
             "geometry_spindlespeed": self.geometry_defaults_form.geometry_opt_group.cncspindlespeed_entry,
             "geometry_dwell": self.geometry_defaults_form.geometry_opt_group.dwell_cb,
             "geometry_dwelltime": self.geometry_defaults_form.geometry_opt_group.dwelltime_entry,
@@ -535,6 +537,7 @@ class App(QtCore.QObject):
             "excellon_travelz": 0.1,
             "excellon_feedrate": 3.0,
             "excellon_feedrate_rapid": 3.0,
+            "excellon_feedrate_probe": 3.0,
             "excellon_spindlespeed": None,
             "excellon_dwell": False,
             "excellon_dwelltime": 1,
@@ -563,6 +566,7 @@ class App(QtCore.QObject):
             "geometry_feedrate": 3.0,
             "geometry_feedrate_z": 3.0,
             "geometry_feedrate_rapid": 3.0,
+            "geometry_feedrate_probe": 3.0,
             "geometry_cnctooldia": 0.016,
             "geometry_spindlespeed": None,
             "geometry_dwell": False,

+ 28 - 10
FlatCAMGUI.py

@@ -2697,6 +2697,15 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
         self.pdepth_entry = FCEntry()
         grid2.addWidget(self.pdepth_entry, 13, 1)
 
+        # Probe feedrate
+        self.feedrate_probe_label = QtWidgets.QLabel("Feedrate Probe:")
+        self.feedrate_probe_label.setToolTip(
+            "The feedrate used while the probe is probing."
+        )
+        grid2.addWidget(self.feedrate_probe_label, 14, 0)
+        self.feedrate_probe_entry = FCEntry()
+        grid2.addWidget(self.feedrate_probe_entry, 14, 1)
+
         fplungelabel = QtWidgets.QLabel('Fast Plunge:')
         fplungelabel.setToolTip(
             "By checking this, the vertical move from\n"
@@ -2705,8 +2714,8 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
             "WARNING: the move is done at Toolchange X,Y coords."
         )
         self.fplunge_cb = FCCheckBox()
-        grid2.addWidget(fplungelabel, 14, 0)
-        grid2.addWidget(self.fplunge_cb, 14, 1)
+        grid2.addWidget(fplungelabel, 15, 0)
+        grid2.addWidget(self.fplunge_cb, 15, 1)
 
         #### Choose what to use for Gcode creation: Drills, Slots or Both
         excellon_gcode_type_label = QtWidgets.QLabel('<b>Gcode:    </b>')
@@ -2719,8 +2728,8 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
         self.excellon_gcode_type_radio = RadioSet([{'label': 'Drills', 'value': 'drills'},
                                           {'label': 'Slots', 'value': 'slots'},
                                           {'label': 'Both', 'value': 'both'}])
-        grid2.addWidget(excellon_gcode_type_label, 15, 0)
-        grid2.addWidget(self.excellon_gcode_type_radio, 15, 1)
+        grid2.addWidget(excellon_gcode_type_label, 16, 0)
+        grid2.addWidget(self.excellon_gcode_type_radio, 16, 1)
 
         # until I decide to implement this feature those remain disabled
         excellon_gcode_type_label.setDisabled(True)
@@ -3014,6 +3023,15 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
         self.pdepth_entry = FCEntry()
         grid1.addWidget(self.pdepth_entry, 17, 1)
 
+        # Probe feedrate
+        self.feedrate_probe_label = QtWidgets.QLabel("Feedrate Probe:")
+        self.feedrate_probe_label.setToolTip(
+            "The feedrate used while the probe is probing."
+        )
+        grid1.addWidget(self.feedrate_probe_label, 18, 0)
+        self.feedrate_probe_entry = FCEntry()
+        grid1.addWidget(self.feedrate_probe_entry, 18, 1)
+
         # Fast Move from Z Toolchange
         fplungelabel = QtWidgets.QLabel('Fast Plunge:')
         fplungelabel.setToolTip(
@@ -3023,8 +3041,8 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
             "WARNING: the move is done at Toolchange X,Y coords."
         )
         self.fplunge_cb = FCCheckBox()
-        grid1.addWidget(fplungelabel, 18, 0)
-        grid1.addWidget(self.fplunge_cb, 18, 1)
+        grid1.addWidget(fplungelabel, 19, 0)
+        grid1.addWidget(self.fplunge_cb, 19, 1)
 
         # Size of trace segment on X axis
         segx_label = QtWidgets.QLabel("Seg. X size:")
@@ -3033,9 +3051,9 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
             "Useful for auto-leveling.\n"
             "A value of 0 means no segmentation on the X axis."
         )
-        grid1.addWidget(segx_label, 19, 0)
+        grid1.addWidget(segx_label, 20, 0)
         self.segx_entry = FCEntry()
-        grid1.addWidget(self.segx_entry, 19, 1)
+        grid1.addWidget(self.segx_entry, 20, 1)
 
         # Size of trace segment on Y axis
         segy_label = QtWidgets.QLabel("Seg. Y size:")
@@ -3044,9 +3062,9 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
             "Useful for auto-leveling.\n"
             "A value of 0 means no segmentation on the Y axis."
         )
-        grid1.addWidget(segy_label, 20, 0)
+        grid1.addWidget(segy_label, 21, 0)
         self.segy_entry = FCEntry()
-        grid1.addWidget(self.segy_entry, 21, 1)
+        grid1.addWidget(self.segy_entry, 22, 1)
 
         self.layout.addStretch()
 

+ 95 - 7
FlatCAMObj.py

@@ -857,6 +857,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
             "dwelltime": 1000,
             "ppname_e": 'defaults',
             "z_pdepth": -0.02,
+            "feedrate_probe": 3.0,
             "optimization_type": "R",
             "gcode_type": "drills"
         })
@@ -1240,6 +1241,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
             "endz": self.ui.eendz_entry,
             "ppname_e": self.ui.pp_excellon_name_cb,
             "z_pdepth": self.ui.pdepth_entry,
+            "feedrate_probe": self.ui.feedrate_probe_entry,
             "gcode_type": self.ui.excellon_gcode_type_radio
         })
 
@@ -1637,10 +1639,16 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
         if "toolchange_probe" in current_pp.lower():
             self.ui.pdepth_entry.setVisible(True)
             self.ui.pdepth_label.show()
+
+            self.ui.feedrate_probe_entry.setVisible(True)
+            self.ui.feedrate_probe_label.show()
         else:
             self.ui.pdepth_entry.setVisible(False)
             self.ui.pdepth_label.hide()
 
+            self.ui.feedrate_probe_entry.setVisible(False)
+            self.ui.feedrate_probe_label.hide()
+
     def on_create_cncjob_button_click(self, *args):
         self.app.report_usage("excellon_on_create_cncjob_button")
         self.read_form()
@@ -1674,6 +1682,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
 
             job_obj.options['Tools_in_use'] = tool_table_items
             job_obj.options['type'] = 'Excellon'
+            job_obj.options['ppname_e'] = pp_excellon_name
 
             app_obj.progress.emit(20)
             job_obj.z_cut = self.options["drillz"]
@@ -1704,6 +1713,17 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
                     self.app.inform.emit(
                         '[ERROR_NOTCL]Wrong value format for self.defaults["z_pdepth"] or self.options["z_pdepth"]')
 
+            try:
+                job_obj.feedrate_probe = float(self.options["feedrate_probe"])
+            except ValueError:
+                # try to convert comma to decimal point. if it's still not working error message and return
+                try:
+                    job_obj.feedrate_rapid = float(self.options["feedrate_probe"].replace(',', '.'))
+                except ValueError:
+                    self.app.inform.emit(
+                        '[ERROR_NOTCL]Wrong value format for self.defaults["feedrate_probe"] '
+                        'or self.options["feedrate_probe"]')
+
             # There could be more than one drill size...
             # job_obj.tooldia =   # TODO: duplicate variable!
             # job_obj.options["tooldia"] =
@@ -1973,6 +1993,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
             "startz": None,
             "ppname_g": 'default',
             "z_pdepth": -0.02,
+            "feedrate_probe": 3.0,
         })
 
         if "cnctooldia" not in self.options:
@@ -2186,6 +2207,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
             "multidepth": self.ui.mpass_cb,
             "ppname_g": self.ui.pp_geometry_name_cb,
             "z_pdepth": self.ui.pdepth_entry,
+            "feedrate_probe": self.ui.feedrate_probe_entry,
             "depthperpass": self.ui.maxdepth_entry,
             "extracut": self.ui.extracut_cb,
             "toolchange": self.ui.toolchangeg_cb,
@@ -3036,10 +3058,16 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         if "toolchange_probe" in current_pp.lower():
             self.ui.pdepth_entry.setVisible(True)
             self.ui.pdepth_label.show()
+
+            self.ui.feedrate_probe_entry.setVisible(True)
+            self.ui.feedrate_probe_label.show()
         else:
             self.ui.pdepth_entry.setVisible(False)
             self.ui.pdepth_label.hide()
 
+            self.ui.feedrate_probe_entry.setVisible(False)
+            self.ui.feedrate_probe_label.hide()
+
     def on_generatecnc_button_click(self, *args):
 
         self.app.report_usage("geometry_on_generatecnc_button")
@@ -3133,6 +3161,17 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                     self.app.inform.emit(
                         '[ERROR_NOTCL]Wrong value format for self.defaults["z_pdepth"] or self.options["z_pdepth"]')
 
+            try:
+                job_obj.feedrate_probe = float(self.options["feedrate_probe"])
+            except ValueError:
+                # try to convert comma to decimal point. if it's still not working error message and return
+                try:
+                    job_obj.feedrate_rapid = float(self.options["feedrate_probe"].replace(',', '.'))
+                except ValueError:
+                    self.app.inform.emit(
+                        '[ERROR_NOTCL]Wrong value format for self.defaults["feedrate_probe"] '
+                        'or self.options["feedrate_probe"]')
+
             for tooluid_key in self.sel_tools:
                 tool_cnt += 1
                 app_obj.progress.emit(20)
@@ -3320,6 +3359,17 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                     self.app.inform.emit(
                         '[ERROR_NOTCL]Wrong value format for self.defaults["z_pdepth"] or self.options["z_pdepth"]')
 
+            try:
+                job_obj.feedrate_probe = float(self.options["feedrate_probe"])
+            except ValueError:
+                # try to convert comma to decimal point. if it's still not working error message and return
+                try:
+                    job_obj.feedrate_rapid = float(self.options["feedrate_probe"].replace(',', '.'))
+                except ValueError:
+                    self.app.inform.emit(
+                        '[ERROR_NOTCL]Wrong value format for self.defaults["feedrate_probe"] '
+                        'or self.options["feedrate_probe"]')
+
             for tooluid_key in self.sel_tools:
                 tool_cnt += 1
                 app_obj.progress.emit(20)
@@ -3604,6 +3654,17 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                     self.app.inform.emit(
                         '[ERROR_NOTCL]Wrong value format for self.defaults["z_pdepth"] or self.options["z_pdepth"]')
 
+            try:
+                job_obj.feedrate_probe = float(self.options["feedrate_probe"])
+            except ValueError:
+                # try to convert comma to decimal point. if it's still not working error message and return
+                try:
+                    job_obj.feedrate_rapid = float(self.options["feedrate_probe"].replace(',', '.'))
+                except ValueError:
+                    self.app.inform.emit(
+                        '[ERROR_NOTCL]Wrong value format for self.defaults["feedrate_probe"] '
+                        'or self.options["feedrate_probe"]')
+
             # TODO: The tolerance should not be hard coded. Just for testing.
             job_obj.generate_from_geometry_2(self, tooldia=tooldia, offset=offset, tolerance=0.0005,
                                              z_cut=z_cut, z_move=z_move,
@@ -4254,6 +4315,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
         time_str = "{:%A, %d %B %Y at %H:%M}".format(datetime.now())
         marlin = False
         hpgl = False
+        probe_pp = False
 
         try:
             for key in self.cnc_tools:
@@ -4263,15 +4325,23 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
                 if self.cnc_tools[key]['data']['ppname_g'] == 'hpgl':
                     hpgl = True
                     break
+                if "toolchange_probe" in self.cnc_tools[key]['data']['ppname_g'].lower():
+                    probe_pp = True
+                    break
         except Exception as e:
             log.debug("FlatCAMCNCJob.gcode_header() error: --> %s" % str(e))
-            try:
-                for key in self.cnc_tools:
-                    if self.cnc_tools[key]['data']['ppname_e'] == 'marlin':
-                        marlin = True
-                        break
-            except:
-                pass
+
+        try:
+            if self.options['ppname_e'] == 'marlin':
+                marlin = True
+        except Exception as e:
+            log.debug("FlatCAMCNCJob.gcode_header(): --> %s" % str(e))
+
+        try:
+            if "toolchange_probe" in self.options['ppname_e'].lower():
+                probe_pp = True
+        except Exception as e:
+            log.debug("FlatCAMCNCJob.gcode_header(): --> %s" % str(e))
 
         if marlin is True:
             gcode = ';Marlin G-CODE GENERATED BY FLATCAM v%s - www.flatcam.org - Version Date:    %s\n' % \
@@ -4297,6 +4367,24 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
 
             gcode += 'CO "Units: ' + self.units.upper() + '";\n'
             gcode += 'CO "Created on ' + time_str + '";\n'
+        elif probe_pp is True:
+            gcode = '(G-CODE GENERATED BY FLATCAM v%s - www.flatcam.org - Version Date: %s)\n' % \
+                    (str(self.app.version), str(self.app.version_date)) + '\n'
+
+            gcode += '(This GCode tool change is done by using a Probe.)\n' \
+                     '(Make sure that before you start the job you first do a rough zero for Z axis.)\n' \
+                     '(This means that you need to zero the CNC axis and then jog to the toolchange X, Y location,)\n' \
+                     '(mount the probe and adjust the Z so more or less the probe tip touch the plate. ' \
+                     'Then zero the Z axis.)\n' + '\n'
+
+            gcode += '(Name: ' + str(self.options['name']) + ')\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'
+
+            gcode += '(Units: ' + self.units.upper() + ')\n' + "\n"
+            gcode += '(Created on ' + time_str + ')\n' + '\n'
         else:
             gcode = '(G-CODE GENERATED BY FLATCAM v%s - www.flatcam.org - Version Date: %s)\n' % \
                     (str(self.app.version), str(self.app.version_date)) + '\n'

+ 24 - 2
ObjectUI.py

@@ -556,7 +556,7 @@ class ExcellonObjectUI(ObjectUI):
         self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
 
         # postprocessor selection
-        pp_excellon_label = QtWidgets.QLabel("Postprocessor")
+        pp_excellon_label = QtWidgets.QLabel("Postprocessor:")
         pp_excellon_label.setToolTip(
             "The json file that dictates\n"
             "gcode output."
@@ -578,6 +578,17 @@ class ExcellonObjectUI(ObjectUI):
         self.pdepth_label.hide()
         self.pdepth_entry.setVisible(False)
 
+        # Probe feedrate
+        self.feedrate_probe_label = QtWidgets.QLabel("Feedrate Probe:")
+        self.feedrate_probe_label.setToolTip(
+            "The feedrate used while the probe is probing."
+        )
+        grid1.addWidget(self.feedrate_probe_label, 12, 0)
+        self.feedrate_probe_entry = FCEntry()
+        grid1.addWidget(self.feedrate_probe_entry, 12, 1)
+        self.feedrate_probe_label.hide()
+        self.feedrate_probe_entry.setVisible(False)
+
         choose_tools_label = QtWidgets.QLabel(
             "Select from the Tools Table above\n"
             "the tools you want to include."
@@ -1030,11 +1041,22 @@ class GeometryObjectUI(ObjectUI):
         self.pdepth_label.hide()
         self.pdepth_entry.setVisible(False)
 
+        # Probe feedrate
+        self.feedrate_probe_label = QtWidgets.QLabel("Feedrate Probe:")
+        self.feedrate_probe_label.setToolTip(
+            "The feedrate used while the probe is probing."
+        )
+        self.grid3.addWidget(self.feedrate_probe_label, 18, 0)
+        self.feedrate_probe_entry = FCEntry()
+        self.grid3.addWidget(self.feedrate_probe_entry, 18, 1)
+        self.feedrate_probe_label.hide()
+        self.feedrate_probe_entry.setVisible(False)
+
         warning_lbl = QtWidgets.QLabel(
             "Add at least one tool in the tool-table.\n"
             "Click the header to select all, or Ctrl + LMB\n"
             "for custom selection of tools.")
-        self.grid3.addWidget(warning_lbl, 18, 0, 1, 2)
+        self.grid3.addWidget(warning_lbl, 19, 0, 1, 2)
 
         # Button
         self.generate_cnc_button = QtWidgets.QPushButton('Generate')

+ 3 - 0
README.md

@@ -16,6 +16,9 @@ CAD program, and create G-Code for Isolation routing.
 - added possibility to use the shortcut key for shortcut list in the Notebook tabs
 - added a way to set the Probe depth if Toolchange_Probe postprocessors are selected
 - finished the postprocessor file for MACH3 tool probing on toolchange event
+- added a new parameter to set the feedrate of the probing in case the used postprocessor does probing (has toolchange_probe in it's name)
+- fixed bug in Marlin postprocessor for the Excellon files; the header and toolchange event always used the parenthesis witch is not compatible with GCode for Marlin
+- fixed a issue with a move to Z_move before any toolchange
 
 4.02.2019
 

+ 18 - 11
camlib.py

@@ -4370,7 +4370,7 @@ class CNCjob(Geometry):
     def __init__(self,
                  units="in", kind="generic", tooldia=0.0,
                  z_cut=-0.002, z_move=0.1,
-                 feedrate=3.0, feedrate_z=3.0, feedrate_rapid=3.0,
+                 feedrate=3.0, feedrate_z=3.0, feedrate_rapid=3.0, feedrate_probe=3.0,
                  pp_geometry_name='default', pp_excellon_name='default',
                  depthpercut=0.1,z_pdepth=-0.02,
                  spindlespeed=None, dwell=True, dwelltime=1000,
@@ -4425,6 +4425,9 @@ class CNCjob(Geometry):
         # how much depth the probe can probe before error
         self.z_pdepth = z_pdepth if z_pdepth else None
 
+        # the feedrate(speed) with which the probel travel while probing
+        self.feedrate_probe = feedrate_probe if feedrate_probe else None
+
         self.spindlespeed = spindlespeed
         self.dwell = dwell
         self.dwelltime = dwelltime
@@ -4614,12 +4617,13 @@ class CNCjob(Geometry):
         gcode = self.doformat(p.start_code)
         gcode += self.doformat(p.feedrate_code)
 
-        if self.toolchange_xy is not None:
-            gcode += self.doformat(p.lift_code, x=self.toolchange_xy[0], y=self.toolchange_xy[1])
-            gcode += self.doformat(p.startz_code, x=self.toolchange_xy[0], y=self.toolchange_xy[1])
-        else:
-            gcode += self.doformat(p.lift_code, x=0.0, y=0.0)
-            gcode += self.doformat(p.startz_code, x=0.0, y=0.0)
+        if toolchange is False:
+            if self.toolchange_xy is not None:
+                gcode += self.doformat(p.lift_code, x=self.toolchange_xy[0], y=self.toolchange_xy[1])
+                gcode += self.doformat(p.startz_code, x=self.toolchange_xy[0], y=self.toolchange_xy[1])
+            else:
+                gcode += self.doformat(p.lift_code, x=0.0, y=0.0)
+                gcode += self.doformat(p.startz_code, x=0.0, y=0.0)
 
         # Distance callback
         class CreateDistanceCallback(object):
@@ -4989,8 +4993,10 @@ class CNCjob(Geometry):
         self.gcode = self.doformat(p.start_code)
 
         self.gcode += self.doformat(p.feedrate_code)        # sets the feed rate
-        self.gcode += self.doformat(p.lift_code, x=0, y=0)  # Move (up) to travel height
-        self.gcode += self.doformat(p.startz_code, x=0, y=0)
+
+        if toolchange is False:
+            self.gcode += self.doformat(p.lift_code, x=0, y=0)  # Move (up) to travel height
+            self.gcode += self.doformat(p.startz_code, x=0, y=0)
 
         if toolchange:
             # if "line_xyz" in self.pp_geometry_name:
@@ -5187,8 +5193,9 @@ class CNCjob(Geometry):
 
         self.gcode += self.doformat(p.feedrate_code)        # sets the feed rate
 
-        self.gcode += self.doformat(p.lift_code, x=self.oldx , y=self.oldy )  # Move (up) to travel height
-        self.gcode += self.doformat(p.startz_code, x=self.oldx , y=self.oldy )
+        if toolchange is False:
+            self.gcode += self.doformat(p.lift_code, x=self.oldx , y=self.oldy )  # Move (up) to travel height
+            self.gcode += self.doformat(p.startz_code, x=self.oldx , y=self.oldy )
 
         if toolchange:
             # if "line_xyz" in self.pp_geometry_name:

+ 22 - 16
postprocessors/Toolchange_Probe_MACH3.py

@@ -25,6 +25,7 @@ class Toolchange_Probe_MACH3(FlatCAMPostProc):
             gcode += '(Feedrate_Z: ' + str(p['feedrate_z']) + units + '/min' + ')\n'
 
         gcode += '(Feedrate rapids ' + str(p['feedrate_rapid']) + units + '/min' + ')\n' + '\n'
+        gcode += '(Feedrate Probe ' + str(p['feedrate_probe']) + units + '/min' + ')\n' + '\n'
         gcode += '(Z_Cut: ' + str(p['z_cut']) + units + ')\n'
 
         if str(p['options']['type']) == 'Geometry':
@@ -42,6 +43,7 @@ class Toolchange_Probe_MACH3(FlatCAMPostProc):
 
         gcode += '(Z Start: ' + str(p['startz']) + units + ')\n'
         gcode += '(Z End: ' + str(p['endz']) + units + ')\n'
+        gcode += '(Z Probe Depth: ' + str(p['z_pdepth']) + units + ')\n'
         gcode += '(Steps per circle: ' + str(p['steps_per_circle']) + ')\n'
 
         if str(p['options']['type']) == 'Excellon' or str(p['options']['type']) == 'Excellon Geometry':
@@ -99,16 +101,17 @@ class Toolchange_Probe_MACH3(FlatCAMPostProc):
                 gcode = """               
 T{tool}
 M5
+M6
 G00 Z{toolchangez}
 G00 X{toolchangex} Y{toolchangey}
 (MSG, Change to Tool Dia = {toolC} ||| Drills for this tool = {t_drills} ||| Tool Probing MACH3)
 M0
 G00 Z{z_move}
-F{fr}
+F{feedrate_probe}
 G31 Z{z_pdepth}
 G92 Z0
 G00 Z{z_move}
-F{fr_slow}
+F{feedrate_probe_slow}
 G31 Z{z_pdepth}
 G92 Z0
 (MSG, Remove any clips or other devices used for probing. CNC work is resuming ...)
@@ -118,8 +121,8 @@ G00 Z{z_move}
            toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
            toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
            z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
-           fr=str(self.feedrate_format %(p.fr_decimals, p.feedrate)),
-           fr_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate / 2))),
+           feedrate_probe=str(self.feedrate_format %(p.fr_decimals, p.feedrate_probe)),
+           feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))),
            z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth),
            tool=int(p.tool),
            t_drills=no_drills,
@@ -128,15 +131,16 @@ G00 Z{z_move}
                 gcode = """
 T{tool}
 M5
+M6
 G00 Z{toolchangez}
 (MSG, Change to Tool Dia = {toolC} ||| Drills for this tool = {t_drills} ||| Tool Probing MACH3)
 M0
 G00 Z{z_move}
-F{fr}
+F{feedrate_probe}
 G31 Z{z_pdepth}
 G92 Z0
 G00 Z{z_move}
-F{fr_slow}
+F{feedrate_probe_slow}
 G31 Z{z_pdepth}
 G92 Z0
 (MSG, Remove any clips or other devices used for probing. CNC work is resuming ...)
@@ -144,8 +148,8 @@ M0
 G00 Z{z_move}
 """.format(toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
            z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
-           fr=str(self.feedrate_format %(p.fr_decimals, p.feedrate)),
-           fr_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate / 2))),
+           feedrate_probe=str(self.feedrate_format %(p.fr_decimals, p.feedrate_probe)),
+           feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))),
            z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth),
            tool=int(p.tool),
            t_drills=no_drills,
@@ -160,16 +164,17 @@ G00 Z{z_move}
                 gcode = """
 T{tool}
 M5
+M6
 G00 Z{toolchangez}
 G00 X{toolchangex} Y{toolchangey}
 (MSG, Change to Tool Dia = {toolC} ||| Tool Probing MACH3)
 M0
 G00 Z{z_move}
-F{fr}
+F{feedrate_probe}
 G31 Z{z_pdepth}
 G92 Z0
 G00 Z{z_move}
-F{fr_slow}
+F{feedrate_probe_slow}
 G31 Z{z_pdepth}
 G92 Z0
 (MSG, Remove any clips or other devices used for probing. CNC work is resuming ...)
@@ -179,8 +184,8 @@ G00 Z{z_move}
            toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
            toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
            z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
-           fr=str(self.feedrate_format % (p.fr_decimals, p.feedrate)),
-           fr_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate / 2))),
+           feedrate_probe=str(self.feedrate_format %(p.fr_decimals, p.feedrate_probe)),
+           feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))),
            z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth),
            tool=int(p.tool),
            toolC=toolC_formatted)
@@ -188,15 +193,16 @@ G00 Z{z_move}
                 gcode = """
 T{tool}
 M5
+M6
 G00 Z{toolchangez}
 (MSG, Change to Tool Dia = {toolC} ||| Tool Probing MACH3)
 M0
 G00 Z{z_move}
-F{fr}
+F{feedrate_probe}
 G31 Z{z_pdepth}
 G92 Z0
 G00 Z{z_move}
-F{fr_slow}
+F{feedrate_probe_slow}
 G31 Z{z_pdepth}
 G92 Z0
 (MSG, Remove any clips or other devices used for probing. CNC work is resuming ...)
@@ -204,8 +210,8 @@ M0
 G00 Z{z_move}
 """.format(toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
            z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
-           fr=str(self.feedrate_format %(p.fr_decimals, p.feedrate)),
-           fr_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate / 2))),
+           feedrate_probe=str(self.feedrate_format %(p.fr_decimals, p.feedrate_probe)),
+           feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))),
            z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth),
            tool=int(p.tool),
            toolC=toolC_formatted)

+ 5 - 6
postprocessors/Toolchange_Probe_general.py

@@ -108,17 +108,17 @@ M0
              tool=int(p.tool),
              t_drills=no_drills,
              toolC=toolC_formatted)
-                gcode += 'M0'
+
             else:
                 gcode = """
 T{tool}
 M5
 M6
 (MSG, Change to Tool Dia = {toolC} ||| Total drills for tool T{tool} = {t_drills})
-M0""".format(tool=int(p.tool),
+M0
+""".format(tool=int(p.tool),
              t_drills=no_drills,
              toolC=toolC_formatted)
-                gcode += 'M0'
 
             if f_plunge is True:
                 gcode += '\nG00 Z%.*f' % (p.coords_decimals, p.z_move)
@@ -132,11 +132,11 @@ T{tool}
 M5
 M6    
 (MSG, Change to Tool Dia = {toolC})
-M0""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
+M0
+""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
              toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
              tool=int(p.tool),
              toolC=toolC_formatted)
-                gcode += 'M0'
             else:
                 gcode = """
 T{tool}
@@ -145,7 +145,6 @@ M6
 (MSG, Change to Tool Dia = {toolC})
 M0""".format(tool=int(p.tool),
              toolC=toolC_formatted)
-                gcode += 'M0'
 
             if f_plunge is True:
                 gcode += '\nG00 Z%.*f' % (p.coords_decimals, p.z_move)

+ 2 - 1
postprocessors/Toolchange_manual.py

@@ -43,7 +43,7 @@ class Toolchange_manual(FlatCAMPostProc):
         gcode += '(Steps per circle: ' + str(p['steps_per_circle']) + ')\n'
 
         if str(p['options']['type']) == 'Excellon' or str(p['options']['type']) == 'Excellon Geometry':
-            gcode += '(Postprocessor Excellon: ' + str(p['pp_excellon_name']) + ')\n'
+            gcode += '(Postprocessor Excellon: ' + str(p['pp_excellon_name']) + ')\n' + '\n'
         else:
             gcode += '(Postprocessor Geometry: ' + str(p['pp_geometry_name']) + ')\n' + '\n'
 
@@ -54,6 +54,7 @@ class Toolchange_manual(FlatCAMPostProc):
 
         gcode += ('G20\n' if p.units.upper() == 'IN' else 'G21\n')
         gcode += 'G90\n'
+        gcode += 'G17\n'
         gcode += 'G94\n'
 
         return gcode

+ 4 - 4
postprocessors/marlin.py

@@ -103,7 +103,7 @@ G0 X{toolchangex} Y{toolchangey}
 T{tool}
 M5
 M6
-(MSG, Change to Tool Dia = {toolC}, Total drills for tool T{tool} = {t_drills})
+;MSG, Change to Tool Dia = {toolC}, Total drills for tool T{tool} = {t_drills}
 M0""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
              toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
              toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
@@ -115,7 +115,7 @@ M0""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchange
 T{tool}
 M5
 M6
-(MSG, Change to Tool Dia = {toolC}, Total drills for tool T{tool} = {t_drills})
+;MSG, Change to Tool Dia = {toolC}, Total drills for tool T{tool} = {t_drills}
 M0""".format(toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
              tool=int(p.tool),
              t_drills=no_drills,
@@ -132,7 +132,7 @@ G0 X{toolchangex} Y{toolchangey}
 T{tool}
 M5
 M6    
-(MSG, Change to Tool Dia = {toolC})
+;MSG, Change to Tool Dia = {toolC}
 M0""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
              toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
              toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
@@ -143,7 +143,7 @@ M0""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchange
 T{tool}
 M5
 M6    
-(MSG, Change to Tool Dia = {toolC})
+;MSG, Change to Tool Dia = {toolC}
 M0""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
              tool=int(p.tool),
              toolC=toolC_formatted)