diff --git a/docs/src/gui/axis.adoc b/docs/src/gui/axis.adoc index f462711f4fa..907602fd875 100644 --- a/docs/src/gui/axis.adoc +++ b/docs/src/gui/axis.adoc @@ -512,17 +512,24 @@ image::images/touchoff.png["Touch Off Window",align="center"] See also the Machine menu options: 'Touch part' and 'Touch part holder'. +.Actual Position Touch Off +An axis may be configured in the .INI file to incorporate the actual position value for an axis into the touch off calculation, either adding or subtracting this value. This is primarily useful for machines which have a non-motorized axis such as a quill with an encoder. When this feature is enabled for an axis, the title bar of the touch off window will indicate *(system ACTUAL)*. + +See <> for more information. + .Tool Touch Off By pressing the 'Tool Touch Off' button the tool length and offsets of the currently loaded tool will be changed so that the current tool tip position matches the entered coordinate. + .Tool Touch Off Window image::images/tooltouchoff.png["Tool Touch Off Window",align="center"] See also the 'Tool touch off to workpiece' and 'Tool touch off to fixture' options in the Machine menu. + .Override Limits By pressing Override Limits, the machine will temporarily be allowed to jog off of a physical limit switch. This check box is only available @@ -984,6 +991,24 @@ preview on certain parts that are already working OK). This display can be useful in the AXIS preview when (debug,message) comments are not displayed. +[[axis:touchoff-actual]] +=== Touch Off using Actual Position +The Touch Off feature can optionally incorporate the actual axis position value into the calculation for the offset. This is primarily used in cases where a non-motorized axis such as the quill in a milling machine provides feedback to LinuxCNC via an encoder, but there is no motor to control movement. This allows AXIS to provide a DRO display for such an axis with working touch off capability. + +This feature is enabled on an axis by altering the appropriate '[AXIS_x]' section of the .INI file. Add an option named 'TOUCHOFF_ACTUAL' and set the value to 'PLUS' or 'MINUS' depending on how you want to apply the actual position to the offset. + +Example: + +[source,{ini}] +---- +[AXIS_Z] +TOUCHOFF_ACTUAL = MINUS +---- + +Ordinarily, only the commanded position of an axis is used to set this offset, meaning it does not work properly because non-motorized axes are never commanded to move and thus their commanded position is always 0. + +Touch off sends a 'G10 L20' command to the MDI to set the new offset value. The value applied is normally just the value entered into the dialog box. When this feature is enabled, it will either add or subtract the current position value from the value entered in the dialog, depending on how it is configured. + [[sec:axis-axisui-pins]] == Axisui(((AXIS: axisui pins))) diff --git a/src/emc/usr_intf/axis/scripts/axis.py b/src/emc/usr_intf/axis/scripts/axis.py index 56632e1d15a..80143f007ee 100755 --- a/src/emc/usr_intf/axis/scripts/axis.py +++ b/src/emc/usr_intf/axis/scripts/axis.py @@ -2766,10 +2766,12 @@ def clear_offset(num): def touch_off_system(event=None, new_axis_value = None): global system if not manual_ok(): return + + touchoff_actual_position = inifile.find(f"AXIS_{vars.ja_rbutton.get().upper()}", "TOUCHOFF_ACTUAL") offset_axis = trajcoordinates.index(vars.ja_rbutton.get()) if new_axis_value is None: new_axis_value, system = prompt_touchoff( - title=_("Touch Off (system)"), + title=_(f"Touch Off ({'system' if touchoff_actual_position is None else 'system ACTUAL'})"), text=_("Enter %s coordinate relative to %%s:") % vars.ja_rbutton.get().upper(), default=0.0, tool_only=False, @@ -2791,6 +2793,9 @@ def touch_off_system(event=None, new_axis_value = None): if linear_axis and 210 in s.gcodes: scale *= 25.4 + if touchoff_actual_position is not None: + new_axis_value = str(float(new_axis_value) + (-1.0 if touchoff_actual_position.upper() == "MINUS" else 1.0) * s.actual_position[offset_axis]) + offset_command = "G10 L20 %s %c[[%s]*%.12f]" % (system.split()[0], vars.ja_rbutton.get(), new_axis_value, scale) c.mdi(offset_command) c.wait_complete()