- in CNCJob UI Autolevelling - GRBL controller - Control: added a Origin button; changed the UI to have rounded rectangles

- in CNCJob UI Autolevelling - GRBL controller - Control: added feedrate and step size controls and added them in Preferences
This commit is contained in:
Marius Stanciu 2020-08-21 18:08:40 +03:00
parent 35cdf4e4cb
commit 1b31abeb62
7 changed files with 303 additions and 129 deletions

View File

@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta
=================================================
21.08.2020
- in CNCJob UI Autolevelling - GRBL controller - Control: added a Origin button; changed the UI to have rounded rectangles
- in CNCJob UI Autolevelling - GRBL controller - Control: added feedrate and step size controls and added them in Preferences
19.08.2020
- in CNCJob UI Autolevelling - sending GCode/GRBL commands is now threaded

View File

@ -3250,6 +3250,150 @@ class FCDock(QtWidgets.QDockWidget):
super().show()
class FCJog(QtWidgets.QFrame):
def __init__(self, title, app, *args, **kwargs):
super(FCJog, self).__init__(*args, **kwargs)
self.app = app
self.setFrameShape(QtWidgets.QFrame.Box)
self.setLineWidth(1)
# JOG axes
grbl_jog_grid = QtWidgets.QGridLayout()
grbl_jog_grid.setAlignment(QtCore.Qt.AlignCenter)
grbl_jog_grid.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize)
self.setLayout(grbl_jog_grid)
jog_title_label = FCLabel(title)
jog_title_label.setStyleSheet("""
FCLabel
{
font-weight: bold;
}
""")
grbl_jog_grid.addWidget(jog_title_label, 0, 0, 1, 4)
# JOG Y Up
self.jog_up_button = QtWidgets.QToolButton()
self.jog_up_button.setIcon(QtGui.QIcon(self.app.resource_location + '/up-arrow32.png'))
self.jog_up_button.setToolTip(
_("Jog the Y axis.")
)
grbl_jog_grid.addWidget(self.jog_up_button, 2, 1)
# Origin
self.jog_origin_button = QtWidgets.QToolButton()
self.jog_origin_button.setIcon(QtGui.QIcon(self.app.resource_location + '/origin2_32.png'))
self.jog_origin_button.setToolTip(
_("Move to Origin.")
)
grbl_jog_grid.addWidget(self.jog_origin_button, 3, 1)
# JOG Y Down
self.jog_down_button = QtWidgets.QToolButton()
self.jog_down_button.setIcon(QtGui.QIcon(self.app.resource_location + '/down-arrow32.png'))
self.jog_down_button.setToolTip(
_("Jog the Y axis.")
)
grbl_jog_grid.addWidget(self.jog_down_button, 4, 1)
# JOG X Left
self.jog_left_button = QtWidgets.QToolButton()
self.jog_left_button.setIcon(QtGui.QIcon(self.app.resource_location + '/left_arrow32.png'))
self.jog_left_button.setToolTip(
_("Jog the X axis.")
)
grbl_jog_grid.addWidget(self.jog_left_button, 3, 0)
# JOG X Right
self.jog_right_button = QtWidgets.QToolButton()
self.jog_right_button.setIcon(QtGui.QIcon(self.app.resource_location + '/right_arrow32.png'))
self.jog_right_button.setToolTip(
_("Jog the X axis.")
)
grbl_jog_grid.addWidget(self.jog_right_button, 3, 2)
# JOG Z Up
self.jog_z_up_button = QtWidgets.QToolButton()
self.jog_z_up_button.setIcon(QtGui.QIcon(self.app.resource_location + '/up-arrow32.png'))
self.jog_z_up_button.setText('Z')
self.jog_z_up_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
self.jog_z_up_button.setToolTip(
_("Jog the Z axis.")
)
grbl_jog_grid.addWidget(self.jog_z_up_button, 2, 3)
# JOG Z Down
self.jog_z_down_button = QtWidgets.QToolButton()
self.jog_z_down_button.setIcon(QtGui.QIcon(self.app.resource_location + '/down-arrow32.png'))
self.jog_z_down_button.setText('Z')
self.jog_z_down_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
self.jog_z_down_button.setToolTip(
_("Jog the Z axis.")
)
grbl_jog_grid.addWidget(self.jog_z_down_button, 4, 3)
class FCZeroAxes(QtWidgets.QFrame):
def __init__(self, title, app, *args, **kwargs):
super(FCZeroAxes, self).__init__(*args, **kwargs)
self.app = app
self.setFrameShape(QtWidgets.QFrame.Box)
self.setLineWidth(1)
# Zero the axes
grbl_zero_grid = QtWidgets.QGridLayout()
grbl_zero_grid.setColumnStretch(0, 0)
grbl_zero_grid.setColumnStretch(1, 0)
grbl_zero_grid.setRowStretch(4, 1)
self.setLayout(grbl_zero_grid)
zero_title_label = FCLabel(title)
zero_title_label.setStyleSheet("""
FCLabel
{
font-weight: bold;
}
""")
grbl_zero_grid.addWidget(zero_title_label, 0, 0, 1, 2)
# Zero X axis
self.grbl_zerox_button = QtWidgets.QToolButton()
self.grbl_zerox_button.setText(_("X"))
self.grbl_zerox_button.setToolTip(
_("Zero the CNC X axes at current position.")
)
grbl_zero_grid.addWidget(self.grbl_zerox_button, 1, 0)
# Zero Y axis
self.grbl_zeroy_button = QtWidgets.QToolButton()
self.grbl_zeroy_button.setText(_("Y"))
self.grbl_zeroy_button.setToolTip(
_("Zero the CNC Y axes at current position.")
)
grbl_zero_grid.addWidget(self.grbl_zeroy_button, 2, 0)
# Zero Z axis
self.grbl_zeroz_button = QtWidgets.QToolButton()
self.grbl_zeroz_button.setText(_("Z"))
self.grbl_zeroz_button.setToolTip(
_("Zero the CNC Z axes at current position.")
)
grbl_zero_grid.addWidget(self.grbl_zeroz_button, 3, 0)
# Zeroo all axes
self.grbl_zero_all_button = QtWidgets.QToolButton()
self.grbl_zero_all_button.setText(_("All"))
self.grbl_zero_all_button.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.grbl_zero_all_button.setToolTip(
_("Zero all CNC axes at current position.")
)
grbl_zero_grid.addWidget(self.grbl_zero_all_button, 1, 1, 3, 1)
class FlatCAMActivityView(QtWidgets.QWidget):
"""
This class create and control the activity icon displayed in the App status bar

View File

@ -2113,7 +2113,9 @@ class CNCObjectUI(ObjectUI):
self.al_toolbar.tabBar.setTabEnabled(idx, False)
# #############################################################################################################
# #############################################################################################################
# GRBL CONNECT
# #############################################################################################################
grbl_conn_grid = QtWidgets.QGridLayout()
grbl_conn_grid.setColumnStretch(0, 0)
grbl_conn_grid.setColumnStretch(1, 1)
@ -2189,125 +2191,77 @@ class CNCObjectUI(ObjectUI):
self.com_connect_button.setStyleSheet("QPushButton {background-color: red;}")
ctrl_hlay.addWidget(self.com_connect_button)
grbl_conn_grid.setRowStretch(9, 1)
grbl_conn_grid.addLayout(ctrl_hlay, 10, 0, 1, 3)
# #############################################################################################################
# GRBL CONTROL
# #############################################################################################################
grbl_ctrl_grid = QtWidgets.QGridLayout()
grbl_ctrl_grid.setColumnStretch(0, 0)
grbl_ctrl_grid.setColumnStretch(1, 1)
grbl_ctrl_grid.setColumnStretch(2, 0)
grbl_ctrl_grid.setColumnStretch(1, 0)
self.gr_ctrl_tab_layout.addLayout(grbl_ctrl_grid)
grbl_ctrl2_grid = QtWidgets.QGridLayout()
grbl_ctrl2_grid.setColumnStretch(0, 0)
grbl_ctrl2_grid.setColumnStretch(1, 1)
self.gr_ctrl_tab_layout.addLayout(grbl_ctrl2_grid)
self.gr_ctrl_tab_layout.addStretch(1)
# JOG axes
grbl_jog_grid = QtWidgets.QGridLayout()
grbl_jog_grid.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize)
grbl_jog_grid.setColumnStretch(0, 0)
grbl_jog_grid.setColumnStretch(1, 0)
grbl_jog_grid.setColumnStretch(2, 0)
grbl_jog_grid.setColumnStretch(3, 0)
grbl_jog_grid.setColumnStretch(4, 1)
grbl_jog_grid.setColumnStretch(5, 0)
self.jog_wdg = FCJog(_("Jog"), self.app)
self.jog_wdg.setContentsMargins(2, 2, 2, 2)
self.jog_wdg.setStyleSheet("""
FCJog
{
border: 1px solid lightgray;
border-radius: 5px
}
""")
grbl_jog_grid.setRowStretch(0, 0)
grbl_jog_grid.setRowStretch(1, 0)
grbl_jog_grid.setRowStretch(2, 0)
grbl_jog_grid.setRowStretch(3, 0)
self.zero_axs_wdg = FCZeroAxes(_("Zero Axes"), self.app)
self.zero_axs_wdg.setContentsMargins(2, 2, 2, 2)
self.zero_axs_wdg.setStyleSheet("""
FCZeroAxes
{
border: 1px solid lightgray;
border-radius: 5px
}
""")
grbl_ctrl_grid.addWidget(self.jog_wdg, 0, 0)
grbl_ctrl_grid.addWidget(self.zero_axs_wdg, 0, 1)
grbl_ctrl_grid.addLayout(grbl_jog_grid, 8, 0, 1, 3)
# JOG Y Up
self.jog_up_button = QtWidgets.QToolButton()
self.jog_up_button.setIcon(QtGui.QIcon(self.app.resource_location + '/up-arrow32.png'))
self.jog_up_button.setToolTip(
_("Jog the Y axis.")
# JOG Step
self.jog_step_label = FCLabel('%s:' % _("Step"))
self.jog_step_label.setToolTip(
_("Each jog action will move the axes with this value.")
)
grbl_jog_grid.addWidget(self.jog_up_button, 0, 1)
# JOG Y Down
self.jog_down_button = QtWidgets.QToolButton()
self.jog_down_button.setIcon(QtGui.QIcon(self.app.resource_location + '/down-arrow32.png'))
self.jog_down_button.setToolTip(
_("Jog the Y axis.")
self.jog_step_entry = FCDoubleSpinner()
self.jog_step_entry.set_precision(self.decimals)
self.jog_step_entry.setSingleStep(0.1)
self.jog_step_entry.set_range(0, 99999.9999)
grbl_ctrl2_grid.addWidget(self.jog_step_label, 0, 0)
grbl_ctrl2_grid.addWidget(self.jog_step_entry, 0, 1)
# JOG Feedrate
self.jog_fr_label = FCLabel('%s:' % _("Feedrate"))
self.jog_fr_label.setToolTip(
_("Feedrate when jogging.")
)
grbl_jog_grid.addWidget(self.jog_down_button, 2, 1)
# JOG X Left
self.jog_left_button = QtWidgets.QToolButton()
self.jog_left_button.setIcon(QtGui.QIcon(self.app.resource_location + '/left_arrow32.png'))
self.jog_left_button.setToolTip(
_("Jog the X axis.")
)
grbl_jog_grid.addWidget(self.jog_left_button, 1, 0)
self.jog_fr_entry = FCDoubleSpinner()
self.jog_fr_entry.set_precision(self.decimals)
self.jog_fr_entry.setSingleStep(10)
self.jog_fr_entry.set_range(0, 99999.9999)
# JOG X Right
self.jog_right_button = QtWidgets.QToolButton()
self.jog_right_button.setIcon(QtGui.QIcon(self.app.resource_location + '/right_arrow32.png'))
self.jog_right_button.setToolTip(
_("Jog the X axis.")
)
grbl_jog_grid.addWidget(self.jog_right_button, 1, 2)
# JOG Z Up
self.jog_z_up_button = QtWidgets.QPushButton()
self.jog_z_up_button.setIcon(QtGui.QIcon(self.app.resource_location + '/up-arrow32.png'))
self.jog_z_up_button.setText('Z+')
self.jog_z_up_button.setToolTip(
_("Jog the Z axis.")
)
grbl_jog_grid.addWidget(self.jog_z_up_button, 0, 3)
# JOG Z Down
self.jog_z_down_button = QtWidgets.QPushButton()
self.jog_z_down_button.setIcon(QtGui.QIcon(self.app.resource_location + '/down-arrow32.png'))
self.jog_z_down_button.setText('Z-')
self.jog_z_down_button.setToolTip(
_("Jog the Z axis.")
)
grbl_jog_grid.addWidget(self.jog_z_down_button, 2, 3)
grbl_ctrl_grid.addWidget(QtWidgets.QLabel(""))
# Zero the axes
grbl_zero_grid = QtWidgets.QGridLayout()
grbl_zero_grid.setColumnStretch(0, 0)
grbl_zero_grid.setColumnStretch(1, 0)
grbl_zero_grid.setColumnStretch(2, 0)
grbl_jog_grid.addLayout(grbl_zero_grid, 0, 5, 3, 1)
# Zero X axis
self.grbl_zerox_button = QtWidgets.QToolButton()
self.grbl_zerox_button.setText(_("X"))
self.grbl_zerox_button.setToolTip(
_("Zero the CNC X axes at current position.")
)
grbl_zero_grid.addWidget(self.grbl_zerox_button, 0, 0)
# Zero Y axis
self.grbl_zeroy_button = QtWidgets.QToolButton()
self.grbl_zeroy_button.setText(_("Y"))
self.grbl_zeroy_button.setToolTip(
_("Zero the CNC Y axes at current position.")
)
grbl_zero_grid.addWidget(self.grbl_zeroy_button, 1, 0)
# Zero Z axis
self.grbl_zeroz_button = QtWidgets.QToolButton()
self.grbl_zeroz_button.setText(_("Z"))
self.grbl_zeroz_button.setToolTip(
_("Zero the CNC Z axes at current position.")
)
grbl_zero_grid.addWidget(self.grbl_zeroz_button, 2, 0)
# Zeroo all axes
self.grbl_zero_all_button = QtWidgets.QToolButton()
self.grbl_zero_all_button.setText(_("All"))
self.grbl_zero_all_button.setToolTip(
_("Zero all CNC axes at current position.")
)
grbl_zero_grid.addWidget(self.grbl_zero_all_button, 0, 1, 3, 1)
grbl_ctrl2_grid.addWidget(self.jog_fr_label, 1, 0)
grbl_ctrl2_grid.addWidget(self.jog_fr_entry, 1, 1)
# #############################################################################################################
# GRBL SENDER
# #############################################################################################################
grbl_send_grid = QtWidgets.QGridLayout()
grbl_send_grid.setColumnStretch(0, 1)
grbl_send_grid.setColumnStretch(1, 0)
@ -2321,6 +2275,7 @@ class CNCObjectUI(ObjectUI):
grbl_send_grid.addWidget(self.grbl_command_label, 2, 0, 1, 2)
self.grbl_command_entry = FCEntry()
self.grbl_command_entry.setPlaceholderText(_("Type GRBL command ..."))
self.grbl_send_button = QtWidgets.QToolButton()
self.grbl_send_button.setText(_("Send"))
@ -2338,6 +2293,7 @@ class CNCObjectUI(ObjectUI):
grbl_send_grid.addWidget(self.grbl_get_param_label, 6, 0, 1, 2)
self.grbl_parameter_entry = FCEntry()
self.grbl_parameter_entry.setPlaceholderText(_("Type GRBL parameter ..."))
self.grbl_get_param_button = QtWidgets.QToolButton()
self.grbl_get_param_button.setText(_("Get"))
@ -2387,10 +2343,10 @@ class CNCObjectUI(ObjectUI):
self.h_gcode_button.hide()
self.import_heights_button.hide()
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid0.addWidget(separator_line, 31, 0, 1, 2)
# separator_line = QtWidgets.QFrame()
# separator_line.setFrameShape(QtWidgets.QFrame.HLine)
# separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
# grid0.addWidget(separator_line, 31, 0, 1, 2)
self.al_button = FCButton(_("Apply Autolevel map"))
grid0.addWidget(self.al_button, 32, 0, 1, 2)
@ -2400,9 +2356,9 @@ class CNCObjectUI(ObjectUI):
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid0.addWidget(separator_line, 34, 0, 1, 2)
# ####################
# #############################################################################################################
# ## Export G-Code ##
# ####################
# #############################################################################################################
self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export CNC Code"))
self.export_gcode_label.setToolTip(
_("Export and save G-Code to\n"

View File

@ -316,6 +316,9 @@ class PreferencesUIManager:
"cncjob_al_probe_depth": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.pdepth_entry,
"cncjob_al_probe_fr": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.feedrate_probe_entry,
"cncjob_al_controller": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.al_controller_combo,
"cncjob_al_grbl_jog_step": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.jog_step_entry,
"cncjob_al_grbl_jog_fr": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.jog_fr_entry,
"cncjob_al_grbl_travelz": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.jog_travelz_entry,
# CNC Job (GCode) Editor
"cncjob_prepend": self.ui.cncjob_defaults_form.cncjob_editor_group.prepend_text,

View File

@ -154,6 +154,45 @@ class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.al_controller_label, 22, 0)
grid0.addWidget(self.al_controller_combo, 22, 1)
# JOG Step
self.jog_step_label = FCLabel('%s:' % _("Step"))
self.jog_step_label.setToolTip(
_("Each jog action will move the axes with this value.")
)
self.jog_step_entry = FCDoubleSpinner()
self.jog_step_entry.set_precision(self.decimals)
self.jog_step_entry.set_range(0, 99999.9999)
grid0.addWidget(self.jog_step_label, 24, 0)
grid0.addWidget(self.jog_step_entry, 24, 1)
# JOG Feedrate
self.jog_fr_label = FCLabel('%s:' % _("Feedrate"))
self.jog_fr_label.setToolTip(
_("Feedrate when jogging.")
)
self.jog_fr_entry = FCDoubleSpinner()
self.jog_fr_entry.set_precision(self.decimals)
self.jog_fr_entry.set_range(0, 99999.9999)
grid0.addWidget(self.jog_fr_label, 26, 0)
grid0.addWidget(self.jog_fr_entry, 26, 1)
# JOG Travel Z
self.jog_travelz_label = FCLabel('%s:' % _("Travel Z"))
self.jog_travelz_label.setToolTip(
_("Safe height (Z) distance when jogging to origin.")
)
self.jog_travelz_entry = FCDoubleSpinner()
self.jog_travelz_entry.set_precision(self.decimals)
self.jog_travelz_entry.set_range(0, 99999.9999)
grid0.addWidget(self.jog_travelz_label, 28, 0)
grid0.addWidget(self.jog_travelz_entry, 28, 1)
self.layout.addStretch()
self.annotation_fontcolor_entry.editingFinished.connect(self.on_annotation_fontcolor_entry)

View File

@ -491,6 +491,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
"al_mode": self.ui.al_mode_radio,
"al_rows": self.ui.al_rows_entry,
"al_columns": self.ui.al_columns_entry,
"al_grbl_jog_step": self.ui.jog_step_entry,
"al_grbl_jog_fr": self.ui.jog_fr_entry,
})
self.append_snippet = self.app.defaults['cncjob_append']
@ -566,12 +568,27 @@ class CNCJobObject(FlatCAMObj, CNCjob):
self.ui.grbl_command_entry.returnPressed.connect(self.on_send_grbl_command)
#Jog
self.ui.jog_up_button.clicked.connect(lambda: self.on_jog(direction='yplus', step=5.0))
self.ui.jog_down_button.clicked.connect(lambda: self.on_jog(direction='yminus', step=5.0))
self.ui.jog_right_button.clicked.connect(lambda: self.on_jog(direction='xplus', step=5.0))
self.ui.jog_left_button.clicked.connect(lambda: self.on_jog(direction='xminus', step=5.0))
self.ui.jog_z_up_button.clicked.connect(lambda: self.on_jog(direction='zplus', step=5.0))
self.ui.jog_z_down_button.clicked.connect(lambda: self.on_jog(direction='zminus', step=5.0))
self.ui.jog_wdg.jog_up_button.clicked.connect(
lambda: self.on_jog(direction='yplus', step=self.ui.jog_step_entry.get_value(),
feedrate=self.ui.jog_fr_entry.get_value()))
self.ui.jog_wdg.jog_down_button.clicked.connect(
lambda: self.on_jog(direction='yminus', step=self.ui.jog_step_entry.get_value(),
feedrate=self.ui.jog_fr_entry.get_value()))
self.ui.jog_wdg.jog_right_button.clicked.connect(
lambda: self.on_jog(direction='xplus', step=self.ui.jog_step_entry.get_value(),
feedrate=self.ui.jog_fr_entry.get_value()))
self.ui.jog_wdg.jog_left_button.clicked.connect(
lambda: self.on_jog(direction='xminus', step=self.ui.jog_step_entry.get_value(),
feedrate=self.ui.jog_fr_entry.get_value()))
self.ui.jog_wdg.jog_z_up_button.clicked.connect(
lambda: self.on_jog(direction='zplus', step=self.ui.jog_step_entry.get_value(),
feedrate=self.ui.jog_fr_entry.get_value()))
self.ui.jog_wdg.jog_z_down_button.clicked.connect(
lambda: self.on_jog(direction='zminus', step=self.ui.jog_step_entry.get_value(),
feedrate=self.ui.jog_fr_entry.get_value()))
self.ui.jog_wdg.jog_origin_button.clicked.connect(
lambda: self.on_jog(direction='origin', travelz=float(self.app.defaults["cncjob_al_grbl_travelz"]),
feedrate=self.ui.jog_fr_entry.get_value()))
# Sender
self.ui.grbl_report_button.clicked.connect(lambda: self.send_grbl_command(command='?'))
@ -1128,24 +1145,31 @@ class CNCJobObject(FlatCAMObj, CNCjob):
self.app.shell_message("GRBL Parameter: %s = %s" % (str(param), str(result)), show=True)
return result
def on_jog(self, direction=None, step=5.0):
def on_jog(self, direction=None, step=5.0, feedrate=1000.0, travelz=15.0):
if direction is None:
return
cmd = ''
if direction == 'xplus':
cmd = "$J=G91 %s X%s F1000" % ({'IN': 'G20', 'MM': 'G21'}[self.units], str(step))
cmd = "$J=G91 %s X%s F%s" % ({'IN': 'G20', 'MM': 'G21'}[self.units], str(step), str(feedrate))
if direction == 'xminus':
cmd = "$J=G91 %s X-%s F1000" % ({'IN': 'G20', 'MM': 'G21'}[self.units], str(step))
cmd = "$J=G91 %s X-%s F%s" % ({'IN': 'G20', 'MM': 'G21'}[self.units], str(step), str(feedrate))
if direction == 'yplus':
cmd = "$J=G91 %s Y%s F1000" % ({'IN': 'G20', 'MM': 'G21'}[self.units], str(step))
cmd = "$J=G91 %s Y%s F%s" % ({'IN': 'G20', 'MM': 'G21'}[self.units], str(step), str(feedrate))
if direction == 'yminus':
cmd = "$J=G91 %s Y-%s F1000" % ({'IN': 'G20', 'MM': 'G21'}[self.units], str(step))
cmd = "$J=G91 %s Y-%s F%s" % ({'IN': 'G20', 'MM': 'G21'}[self.units], str(step), str(feedrate))
if direction == 'zplus':
cmd = "$J=G91 %s Z%s F1000" % ({'IN': 'G20', 'MM': 'G21'}[self.units], str(step))
cmd = "$J=G91 %s Z%s F%s" % ({'IN': 'G20', 'MM': 'G21'}[self.units], str(step), str(feedrate))
if direction == 'zminus':
cmd = "$J=G91 %s Z-%s F1000" % ({'IN': 'G20', 'MM': 'G21'}[self.units], str(step))
cmd = "$J=G91 %s Z-%s F%s" % ({'IN': 'G20', 'MM': 'G21'}[self.units], str(step), str(feedrate))
if direction == 'origin':
cmd = "$J=G90 %s Z%s F%s" % ({'IN': 'G20', 'MM': 'G21'}[self.units], str(travelz), str(feedrate))
self.send_grbl_command(command=cmd, echo=False)
cmd = "$J=G90 %s X0.0 Y0.0 F%s" % ({'IN': 'G20', 'MM': 'G21'}[self.units], str(feedrate))
self.send_grbl_command(command=cmd, echo=False)
return
self.send_grbl_command(command=cmd, echo=False)
@ -1192,17 +1216,17 @@ class CNCJobObject(FlatCAMObj, CNCjob):
# commands
if controller == 'MACH3':
probing_command = 'G31'
probing_var = '#2002'
# probing_var = '#2002'
openfile_command = 'M40'
closefile_command = 'M41'
elif controller == 'MACH4':
probing_command = 'G31'
probing_var = '#5063'
# probing_var = '#5063'
openfile_command = 'M40'
closefile_command = 'M41'
elif controller == 'LinuxCNC':
probing_command = 'G38.2'
probing_var = '#5422'
# probing_var = '#5422'
openfile_command = '(PROBEOPEN a_probing_points_file.txt)'
closefile_command = '(PROBECLOSE)'
else:
@ -1217,9 +1241,9 @@ class CNCJobObject(FlatCAMObj, CNCjob):
p_gcode += header + '\n'
# supplementary message for LinuxCNC
if controller == 'LinuxCNC':
probing_var += "The file with the stored probing points can be found\n" \
"in the configuration folder for LinuxCNC.\n" \
"The name of the file is: a_probing_points_file.txt.\n"
p_gcode += "The file with the stored probing points can be found\n" \
"in the configuration folder for LinuxCNC.\n" \
"The name of the file is: a_probing_points_file.txt.\n"
# units
p_gcode += 'G21\n' if self.units == 'MM' else 'G20\n'
# reference mode = absolute
@ -1246,8 +1270,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
)
# store in a global numeric variable the value of the detected probe Z
# I offset the global numeric variable by 500 so it does not conflict with something else
temp_var = int(idx + 500)
p_gcode += "#%d = %s\n" % (temp_var, probing_var)
# temp_var = int(idx + 500)
# p_gcode += "#%d = %s\n" % (temp_var, probing_var)
# move to safe height (probe travel Z)
p_gcode += 'G0 Z%s\n' % str(self.app.dec_format(pr_travel, self.coords_decimals))

View File

@ -384,6 +384,9 @@ class FlatCAMDefaults:
"cncjob_al_probe_depth": -1.0,
"cncjob_al_probe_fr": 120,
"cncjob_al_controller": 'MACH3',
"cncjob_al_grbl_jog_step": 5,
"cncjob_al_grbl_jog_fr": 1500,
"cncjob_al_grbl_travelz": 15.0,
# CNC Job (GCode) Editor
"cncjob_prepend": "",