- 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
This commit is contained in:
Marius Stanciu
2019-02-05 19:40:46 +02:00
committed by Marius S
parent 822800e7f5
commit 3b8b7d470a
10 changed files with 205 additions and 57 deletions

View File

@@ -350,6 +350,7 @@ class App(QtCore.QObject):
"excellon_travelz": self.excellon_defaults_form.excellon_opt_group.travelz_entry, "excellon_travelz": self.excellon_defaults_form.excellon_opt_group.travelz_entry,
"excellon_feedrate": self.excellon_defaults_form.excellon_opt_group.feedrate_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_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_spindlespeed": self.excellon_defaults_form.excellon_opt_group.spindlespeed_entry,
"excellon_dwell": self.excellon_defaults_form.excellon_opt_group.dwell_cb, "excellon_dwell": self.excellon_defaults_form.excellon_opt_group.dwell_cb,
"excellon_dwelltime": self.excellon_defaults_form.excellon_opt_group.dwelltime_entry, "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": self.geometry_defaults_form.geometry_opt_group.cncfeedrate_entry,
"geometry_feedrate_z": self.geometry_defaults_form.geometry_opt_group.cncplunge_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_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_spindlespeed": self.geometry_defaults_form.geometry_opt_group.cncspindlespeed_entry,
"geometry_dwell": self.geometry_defaults_form.geometry_opt_group.dwell_cb, "geometry_dwell": self.geometry_defaults_form.geometry_opt_group.dwell_cb,
"geometry_dwelltime": self.geometry_defaults_form.geometry_opt_group.dwelltime_entry, "geometry_dwelltime": self.geometry_defaults_form.geometry_opt_group.dwelltime_entry,
@@ -535,6 +537,7 @@ class App(QtCore.QObject):
"excellon_travelz": 0.1, "excellon_travelz": 0.1,
"excellon_feedrate": 3.0, "excellon_feedrate": 3.0,
"excellon_feedrate_rapid": 3.0, "excellon_feedrate_rapid": 3.0,
"excellon_feedrate_probe": 3.0,
"excellon_spindlespeed": None, "excellon_spindlespeed": None,
"excellon_dwell": False, "excellon_dwell": False,
"excellon_dwelltime": 1, "excellon_dwelltime": 1,
@@ -563,6 +566,7 @@ class App(QtCore.QObject):
"geometry_feedrate": 3.0, "geometry_feedrate": 3.0,
"geometry_feedrate_z": 3.0, "geometry_feedrate_z": 3.0,
"geometry_feedrate_rapid": 3.0, "geometry_feedrate_rapid": 3.0,
"geometry_feedrate_probe": 3.0,
"geometry_cnctooldia": 0.016, "geometry_cnctooldia": 0.016,
"geometry_spindlespeed": None, "geometry_spindlespeed": None,
"geometry_dwell": False, "geometry_dwell": False,

View File

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

View File

@@ -857,6 +857,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
"dwelltime": 1000, "dwelltime": 1000,
"ppname_e": 'defaults', "ppname_e": 'defaults',
"z_pdepth": -0.02, "z_pdepth": -0.02,
"feedrate_probe": 3.0,
"optimization_type": "R", "optimization_type": "R",
"gcode_type": "drills" "gcode_type": "drills"
}) })
@@ -1240,6 +1241,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
"endz": self.ui.eendz_entry, "endz": self.ui.eendz_entry,
"ppname_e": self.ui.pp_excellon_name_cb, "ppname_e": self.ui.pp_excellon_name_cb,
"z_pdepth": self.ui.pdepth_entry, "z_pdepth": self.ui.pdepth_entry,
"feedrate_probe": self.ui.feedrate_probe_entry,
"gcode_type": self.ui.excellon_gcode_type_radio "gcode_type": self.ui.excellon_gcode_type_radio
}) })
@@ -1637,10 +1639,16 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
if "toolchange_probe" in current_pp.lower(): if "toolchange_probe" in current_pp.lower():
self.ui.pdepth_entry.setVisible(True) self.ui.pdepth_entry.setVisible(True)
self.ui.pdepth_label.show() self.ui.pdepth_label.show()
self.ui.feedrate_probe_entry.setVisible(True)
self.ui.feedrate_probe_label.show()
else: else:
self.ui.pdepth_entry.setVisible(False) self.ui.pdepth_entry.setVisible(False)
self.ui.pdepth_label.hide() 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): def on_create_cncjob_button_click(self, *args):
self.app.report_usage("excellon_on_create_cncjob_button") self.app.report_usage("excellon_on_create_cncjob_button")
self.read_form() self.read_form()
@@ -1674,6 +1682,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
job_obj.options['Tools_in_use'] = tool_table_items job_obj.options['Tools_in_use'] = tool_table_items
job_obj.options['type'] = 'Excellon' job_obj.options['type'] = 'Excellon'
job_obj.options['ppname_e'] = pp_excellon_name
app_obj.progress.emit(20) app_obj.progress.emit(20)
job_obj.z_cut = self.options["drillz"] job_obj.z_cut = self.options["drillz"]
@@ -1704,6 +1713,17 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
self.app.inform.emit( self.app.inform.emit(
'[ERROR_NOTCL]Wrong value format for self.defaults["z_pdepth"] or self.options["z_pdepth"]') '[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... # There could be more than one drill size...
# job_obj.tooldia = # TODO: duplicate variable! # job_obj.tooldia = # TODO: duplicate variable!
# job_obj.options["tooldia"] = # job_obj.options["tooldia"] =
@@ -1973,6 +1993,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
"startz": None, "startz": None,
"ppname_g": 'default', "ppname_g": 'default',
"z_pdepth": -0.02, "z_pdepth": -0.02,
"feedrate_probe": 3.0,
}) })
if "cnctooldia" not in self.options: if "cnctooldia" not in self.options:
@@ -2186,6 +2207,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
"multidepth": self.ui.mpass_cb, "multidepth": self.ui.mpass_cb,
"ppname_g": self.ui.pp_geometry_name_cb, "ppname_g": self.ui.pp_geometry_name_cb,
"z_pdepth": self.ui.pdepth_entry, "z_pdepth": self.ui.pdepth_entry,
"feedrate_probe": self.ui.feedrate_probe_entry,
"depthperpass": self.ui.maxdepth_entry, "depthperpass": self.ui.maxdepth_entry,
"extracut": self.ui.extracut_cb, "extracut": self.ui.extracut_cb,
"toolchange": self.ui.toolchangeg_cb, "toolchange": self.ui.toolchangeg_cb,
@@ -3036,10 +3058,16 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
if "toolchange_probe" in current_pp.lower(): if "toolchange_probe" in current_pp.lower():
self.ui.pdepth_entry.setVisible(True) self.ui.pdepth_entry.setVisible(True)
self.ui.pdepth_label.show() self.ui.pdepth_label.show()
self.ui.feedrate_probe_entry.setVisible(True)
self.ui.feedrate_probe_label.show()
else: else:
self.ui.pdepth_entry.setVisible(False) self.ui.pdepth_entry.setVisible(False)
self.ui.pdepth_label.hide() 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): def on_generatecnc_button_click(self, *args):
self.app.report_usage("geometry_on_generatecnc_button") self.app.report_usage("geometry_on_generatecnc_button")
@@ -3133,6 +3161,17 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
self.app.inform.emit( self.app.inform.emit(
'[ERROR_NOTCL]Wrong value format for self.defaults["z_pdepth"] or self.options["z_pdepth"]') '[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: for tooluid_key in self.sel_tools:
tool_cnt += 1 tool_cnt += 1
app_obj.progress.emit(20) app_obj.progress.emit(20)
@@ -3320,6 +3359,17 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
self.app.inform.emit( self.app.inform.emit(
'[ERROR_NOTCL]Wrong value format for self.defaults["z_pdepth"] or self.options["z_pdepth"]') '[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: for tooluid_key in self.sel_tools:
tool_cnt += 1 tool_cnt += 1
app_obj.progress.emit(20) app_obj.progress.emit(20)
@@ -3604,6 +3654,17 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
self.app.inform.emit( self.app.inform.emit(
'[ERROR_NOTCL]Wrong value format for self.defaults["z_pdepth"] or self.options["z_pdepth"]') '[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. # 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, job_obj.generate_from_geometry_2(self, tooldia=tooldia, offset=offset, tolerance=0.0005,
z_cut=z_cut, z_move=z_move, 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()) time_str = "{:%A, %d %B %Y at %H:%M}".format(datetime.now())
marlin = False marlin = False
hpgl = False hpgl = False
probe_pp = False
try: try:
for key in self.cnc_tools: for key in self.cnc_tools:
@@ -4263,15 +4325,23 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
if self.cnc_tools[key]['data']['ppname_g'] == 'hpgl': if self.cnc_tools[key]['data']['ppname_g'] == 'hpgl':
hpgl = True hpgl = True
break break
if "toolchange_probe" in self.cnc_tools[key]['data']['ppname_g'].lower():
probe_pp = True
break
except Exception as e: except Exception as e:
log.debug("FlatCAMCNCJob.gcode_header() error: --> %s" % str(e)) log.debug("FlatCAMCNCJob.gcode_header() error: --> %s" % str(e))
try:
for key in self.cnc_tools: try:
if self.cnc_tools[key]['data']['ppname_e'] == 'marlin': if self.options['ppname_e'] == 'marlin':
marlin = True marlin = True
break except Exception as e:
except: log.debug("FlatCAMCNCJob.gcode_header(): --> %s" % str(e))
pass
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: if marlin is True:
gcode = ';Marlin G-CODE GENERATED BY FLATCAM v%s - www.flatcam.org - Version Date: %s\n' % \ 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 "Units: ' + self.units.upper() + '";\n'
gcode += 'CO "Created on ' + time_str + '";\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: else:
gcode = '(G-CODE GENERATED BY FLATCAM v%s - www.flatcam.org - Version Date: %s)\n' % \ 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' (str(self.app.version), str(self.app.version_date)) + '\n'

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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