From b2634c619cb97c1e530ad44bcf8e5399fa66b428 Mon Sep 17 00:00:00 2001 From: Vector Hasting Date: Sun, 22 Oct 2023 00:17:10 -0700 Subject: [PATCH] Extend M6 remap to allow return to orig. position MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Made a switch in the Versa_toolsetter section that give the option to direct the return point to either: Option 1 (Default if no option specified): Gmoccapy default already released with QtDragon: Only returns to the Change_Position z height, as programmed at: configs > sim > gmoccapy > macros > change.ngc Option 2: AxisDefault Return to the XYZ tool change position, as programmed at: configs > sim > axis > remap > manual-toolchanges-with-tool-length- switch > nc_subroutines > Manual_change.ngc Option 3: New QtDragon option: Return the tip of the current changed tool to the XYZ position of the tip of the old tool, moving to Tool Change Z first, then Original XY, then down to new offset Z. Also moved some error checking earlier. Changes made to documentation: All changes are limited to the “Auto Tool Measurement” section. (Currently, #14) except for 1. fixing one typo, 2 adding a [[sub:touch-plate]] tag to the Touch plate section so that the Auto Tool section can redirect readers there. 3. Increase the Table of Contents Levels depth to 4 (default is 2) In the “Auto Tool Measurement” Section 14, I made the following changes: Created a section at the beginning called “Overview” (new 14.1) In this section I explain that this procedure intends to use two probes. be done with one or two sensors. The one sensor only method requires the Tool Switch and is described as One Sensor Workflow. The two sensor method makes use of an additional spindle probe, also called a Renishaw probe. It directs people with repeatable tool holders to the Touch Plate section. It directs those with automatic tool changers to axamine the axis remap code rack-toolchange. It then splits the documentation into “Work Flow Overview” which includes most of the documentation above the QtDragon_HD screen intact. This becomes section 14.2 In this section, I moved pre-requisites earlier (ie, instead of warning near the end to have Use Tool sensor selected, include this along with other pre-requisites under the Important heading near the top. In the “sequence of events” section I added the extra possibilities of this ngc code modification: The INI setting [RETURN_OPTION] can elicit additional behavior after the return to the [TOOL_CHANGE] Z position: • If INI’s [RETURN_OPTION] = 1: (or if it is undefined), no further action. This is the default behavior of the GMOCCAPY M6 remap procedure • If INI’s [RETURN_OPTION] = 2: Continue with a Rapid Move to the X and Y position defined in INI’s [TOOL_CHANGE] X and Y settings. This is the default behavior of the AXIS gui’s M6 remap procedure. • If INI’s [RETURN_OPTION] = 3: Rapid Move to the original X and Y position at the moment the tool-change started, then Rapid Move down to the now offset Z position at the moment the tool-change started. This effectively moves the tool head back to the position just prior to the tool change. This is new behavior exclusive to QtDragon as of 4th quarter 2023. Added another section following that one called “Workflow Example” (new section 14.2) Renamed the next section to be clear it only applies to the QtDragon_hd interface (was 14.1, now 14.4) All the following sections automatically increased in numbering. Added the RETURN_OPTION explanations to what is now section 14.6.3 “The Tool Sensor Section” Corrected “TOOLCHANGE” in section 14.6.3 to be “CHANGE_POSITION” --- docs/src/gui/qtdragon.adoc | 153 ++++++++--- .../remap-subroutines/qt_auto_probe_tool.ngc | 242 +++++++++++++++--- 2 files changed, 318 insertions(+), 77 deletions(-) diff --git a/docs/src/gui/qtdragon.adoc b/docs/src/gui/qtdragon.adoc index 29f46fe1170..b71e5eafdb7 100644 --- a/docs/src/gui/qtdragon.adoc +++ b/docs/src/gui/qtdragon.adoc @@ -1,5 +1,6 @@ :lang: en :toc: +:toclevels: 3 [[cha:qtdragon-gui]] = QtDragon GUI(((QtDragon))) @@ -830,10 +831,11 @@ Sequence after pressing the probe button: + . probe wall twice (rough and fine), . move diagonally to the other wall as set by EDGE WIDTH and XY CLEARANCE, . probe wall twice, -. raise probe up by Z CLEARANCE + EXTRA DEPTH 9returns to starting height), +. raise probe up by Z CLEARANCE + EXTRA DEPTH (returns to starting height), . rapid back to starting corner (now calculated using the probed walls), . if auto zero button is enabled, set X and Y of the current user system to zero. +[[sub:touch-plate]] == Touch plate .QtDragon - Touch Plate @@ -857,23 +859,41 @@ The machine will probe down twice and the current user offset (G5X) will be zero == Auto Tool Measurement +=== Overview + QtDragon can be setup to do integrated auto tool measurement using the Versa Probe widget and remap code. -To use this feature, you will need to do some additional settings and you may want to use the offered HAL pin to get values in your own ngc remap procedure. -[IMPORTANT] -Before starting the first test, do not forget to enter the probe height and probe velocities on the versa probe settings page. +This feature assumes the use of two probes in concert: -Tool Measurement in QtDragon is done with the following steps: + . A tool switch sensor, fixed somewhere on the machine (sometimes called a tool-setter), and + . A spindle probe that is installed temporarily at the beginning of the job (sometimes called an xyz probe or a Renishaw probe). -* Touch off your workpiece in X and Y. -* Measure the height of your block from the base, where your tool switch is located, to the upper face of the block (including chuck etc.). -* In the Versa probe tab, enter the measured value for block height. -* Make sure the use tool measurement button in the Vesa probe tab is enabled. -* Go to auto mode and start your program. +These techniques are useful for machines that do not have repeatable tool holders and do not have automatic tool changing devices. (For machines with repeatable tool holders, see the section on <>. For machines with automatic tool changing devices, consult work done under the linuxcnc repository at configs/sim/axis/remap/rack-toolchange) -[NOTE] -When fist setting up auto tool measurement, please use caution until you confirm tool change and probe locations - it is easy to break a tool/probe. -Abort will be honoured while the probe is in motion. +To use this feature, you will need to do some additional settings and you may want to use the offered HAL pins to get values in your own ngc remap procedure. Those settings are covered later in the section. + +How to use these technique are covered first, then how to set them up are covered. + +=== Workflow Overview + +A detailed workflow walkthrough follows this overview. + +[IMPORTANT] +Setup steps include: + + + +Entering the probe velocities on the versa probe settings page. + +Enabling "Use Tool Measurement" on the Versa Probe tab. + +Enabling "Use Tool Sensor" under Settings. + + + +When fist setting up auto tool measurement, please use caution until you confirm tool change and probe locations - it is easy to break a tool/probe. Abort will be honoured while the probe is in motion. + +Tool Measurement in QtDragon is organized into the following steps which will be explained in more detail in the following section: + +. Zero the probe tool by measuring the tool setter with the spindle probe installed +. Touch off your workpiece in X and Y. +. Measure the height of your block from the base, where your tool switch is located, to the upper face of the block (including chuck etc.). +. In the Versa probe tab, enter the measured value for block height. +. Go to auto mode and start your program. .Auto tool measurement image::images/sketch_auto_tool_measurement.png[align="left"] @@ -881,29 +901,67 @@ image::images/sketch_auto_tool_measurement.png[align="left"] With the first given tool change the tool will be measured and the offset will be set automatically to fit the block height. The advantage of this way is, that you do not need a reference tool. +[NOTE] +Your program must contain a tool change at the beginning. The tool will be measured, even it has been used before, so there is no danger if the block height has changed. There are several videos on you tube that demonstrate the technique using GMOCCAPY. The GMOCCAPY screen pioneered the technique. + +The sequence of events (using the default files in the default setting): + +. Rapid move in Z to position defined in the INI's [TOOL_CHANGE] Z +. Rapid move in X and Y to number defined in INI's [TOOL_CHANGE] X and Y +. Perform normal M6 tool change: ie, stop spindle, send message to user to change the tool +. Rapid move in X and Y to position defined in the INI's [VERSA_TOOLSETTER] X and Y +. Rapid move down in Z to position defined in the INI's [VERSA_TOOLSETTER] Z +. Probe down in Z to maximum defined in the INI's [VERSA_TOOLSETTER] MAXPROBE +. Changes the offset of the current work coordinate system to match the difference between the previous tool and the currently measured tool +. Return Z to position defined in the INI's [TOOL_CHANGE] Z + +The INI setting [RETURN_OPTION] can elicit additional behavior after the return to the [TOOL_CHANGE] Z position: + +* If INI's [RETURN_OPTION] = 1: (or if it is undefined), no further action. This is the default behavior of the GMOCCAPY M6 remap procedure +* If INI's [RETURN_OPTION] = 2: Continue with a Rapid Move to the X and Y position defined in INI's [TOOL_CHANGE] X and Y settings. This is the default behavior of the AXIS gui's M6 remap procedure. +* If INI's [RETURN_OPTION] = 3: Rapid Move to the original X and Y position at the moment the tool-change started, then Rapid Move down to the now offset Z position at the moment the tool-change started. This effectively moves the tool head back to the position just prior to the tool change. This is new behavior exclusive to QtDragon as of 4th quarter 2023. + +[NOTE] +The [TOOL_CHANGE] Z position should be high enough so the tool will not hit the tool probe when moving to the [VERSA_TOOLSETTER] X and Y position. + +MAXPROBE distance needs to be high enough for the tool to touch the probe. + +The RETURN_OPTION = 3 behavior returns to the Work Coordinate system's coordinates, so if using this option, it is vital to have set a work coordinate system before beginning. + +=== Detailed Workflow Example + +==== One Time Setup + +The following setups need only be done once as long as they remain in effect: + +. Under Probe Tool Screens: Insure reasonable values for "Rapid" and "Search," these are the speeds at which the probing will be performed and are in machine units per minute. + +. Under Probe Tool Screens: insure that "Tool Measure" is enabled (this is a button that must be highlighted) +. Under Settings: insure that "Use Tool Sensor" is enabled (this is a tick-box that must be checked) +. In the Tool Table: setup a tool for the spindle probe and insure that its Z offset is set to zero. [NOTE] -Your program must contain a tool change at the beginning. -The tool will be measured, even it has been used before, so there is no danger if the block height has changed. -There are several videos on you tube that demonstrate the technique using GMOCCAPY. -The GMOCCAPY screen pioneered the technique. +It is possible to use a non-zer tool length for the tool probe, but this requires extra steps and is easy to make mistakes. The following procedure assumes a zero tool probe length. + +==== Procedure before starting a program + +The following setup is done before beginning a program that has M6 tool change commands inside it. -The sequence of events (using the default files): +. Physically load the spindle probe into the spindle. +. Logically load the spindle probe into the spindle with the M61 Qx command where x is the number in the tool table for the spindle probe (there is a button inside the tool table tab that can also be used) +. Position to the Toolsetter: Use the button under the Probe Screens for "Go To Toolsetter" to position the spindle above the Toolsetter. +. Toolsetter Measure: Use the button under the Probe Screens for "Probe Tool Setter Z Height." Note that this will set and display on the Probe Settings screen the "Probe HT" value in ABS coordinates +. Jog to your workpiece. +. Workpiece Measure: Use the button under the Probe Screens for "Probe Z Height of Material:" this will set and display on the Probe Settings screen the "Block Ht" value in ABS coordinates. (Typically, this will now also be the zero Z for your Work Coordinate System) +. Set Work Coordinate System (ie, G54, or other): Use the Probe Tool and whatever probe screen or other method is appropriate to set the X, Y, and Z coordinate system needed for your job. +. If your program begins with a TnM6 command before spinning the spindle, you may leave the spindle probe installed. You may also issue a TnM6 command to change out the spindle probe, and if the program issues the same one, it will skip the tool change. -* Rapid move in Z to position defined in the INI's [TOOL_CHANGE] Z -* Rapid move in X and Y to number defined in INI's [TOOL_CHANGE] X and Y -* Request tool change -* Rapid move in X and Y to position defined in the INI's [VERSA_TOOLSETTER] X and Y -* Rapid move down in Z to position defined in the INI's [VERSA_TOOLSETTER] Z -* Probe down in Z to maximum defined in the INI's [VERSA_TOOLSETTER] MAXPROBE -* Return Z to position defined in the INI's [TOOL_CHANGE] Z +[CAUTION] +Take care not to leave the spindle probe in the spindle if a program may start the spindle. + +Once those steps are complete, a program with multiple TnM6 toolchanges can be started and will operate with automatic pauses for manual tool change followed by automated tool measurement. [NOTE] -The [TOOL_CHANGE] Z position should be high enough so the tool will not hit the tool probe -when moving to the [VERSA_TOOLSETTER] X and Y position. -MAXPROBE distance needs to be high enough for the tool to touch the probe. - -=== Work Piece Height Probing +RETURN_OPTION 3 uses whatever Work Coordinate system was effect when tool change was called to return the tool-tip to the same Work Coordinate where it was before. Because remapping has adjusted the Work Coordinate system by the offset between the previous and the current tool, the tool tip will end up at the same point in space as the tip of the previous tool was when the tool change was called. + +=== Work Piece Height Probing in QtDragon_hd .QtDragon_hd - Work piece Height probing image::images/qtdragon_hd_workpiece_probe.png["QtDragon_hd height probing"] @@ -1013,24 +1071,34 @@ The position of the tool sensor and the start position of the probing movement. All values are absolute (G53) coordinates, except MAXPROBE, which is expressed in relative movement. + All values are in machine native units. + X,Y,Z set the tool setter probe location. + -auto probe action sequence (this could be changed with a modified ngc remap file): + -* go to TOOLCHANGE Z position -* go to TOOLCHANGE XY position. -* wait for manual tool change acknowledgement -* go to VERSA_TOOLSETTER XY position -* go to VERSA_TOOLSETTER Z position -* fast probe -* slow probe -* go to TOOLCHANGE Z position +Auto probe action sequence (this could be changed with a modified ngc remap file): + + +. rapid move to CHANGE_POSITION Z position +. rapid move to CHANGE_POSITION XY position. +. wait for manual tool change acknowledgement +. rapid move to VERSA_TOOLSETTER XY position +. rapid move to VERSA_TOOLSETTER Z position +. fast probe +. slow probe +. rapid move to TOOLCHANGE Z position + +Additionally, if [RETURN_OPTION] is set, there may be additional moves. + +[RETURN_OPTION] = 1: (or if it is undefined), no further action. (This is the GMOCCAPY gui M6 default remap code method) + +[RETURN_OPTION] = 2: Continue with a Rapid Move to TOOL_CHANGE X and Y (This is the AXIS gui M6 default remap code) + +[RETURN_OPTION] = 3: Rapid Move to the original X and Y position at the moment the tool-change started, then Rapid Move down to the newly offset Z position. (This effectively moves the tool head back to the position just prior to the tool change, and is a feature of the QtDragon gui M6 default remap code) Z_MAX_CLEAR is the Z position to go to before moving to the tool setter when using the 'Travel to Toolsetter button'. + 'Travel to Toolsetter' Action sequence: + -* go to VERSA_TOOLSETTER Z_MAX_CLEAR Z position -* go to VERSA_TOOLSETTER XY position -* go to VERSA_TOOLSETTER Z position. +. rapid move to VERSA_TOOLSETTER Z_MAX_CLEAR Z position +. rapid move to VERSA_TOOLSETTER XY position +. rapid move to VERSA_TOOLSETTER Z position. +Example settings: [source,{ini}] ---- [VERSA_TOOLSETTER] @@ -1039,6 +1107,7 @@ Y = 10 Z = -20 Z_MAX_CLEAR = -2 MAXPROBE = -20 +RETURN_OPTION = 3 ---- ==== The Change Position Section diff --git a/nc_files/remap-subroutines/qt_auto_probe_tool.ngc b/nc_files/remap-subroutines/qt_auto_probe_tool.ngc index 9399f4aab8f..2ab973c55bb 100644 --- a/nc_files/remap-subroutines/qt_auto_probe_tool.ngc +++ b/nc_files/remap-subroutines/qt_auto_probe_tool.ngc @@ -1,89 +1,261 @@ o sub + +; IMPORTANT: this remap enables using a gcode/ngc program on machines without +; automatic tool changers, and without repeatable tool holders, but which +; do have a tool setter (and ideally, an xyz probe). +; With this remap, a program or user can issue TxM6 commands at any +; point and the machine automatically do the following: +; 1. Move to a tool change position defined in .ini parameters, Z first, then XY +; 2. Perform the normal M6 tool change (IE stop spindle, prompt for tool) +; 3. Move to the location of the toolsetter, Z first, then XY, probe the new tool's offset +; 4. Change the offset of the current coordinate system to match the new tool +; 5. Choose from one of three return options: +; Option 1: Return to the ABS Tool Change Z-height - this is the Default +; return behavior if no option is configured in .ini +; (this is also the default return behavior of the +; default/example Gmoccapy GUI M6 remap code) +; Option 2: Return to the ABS Tool Change XYZ: Z first, then XY +; this is also the default return behavior of the +; default/example Axis GUI M6 remap code) +; Option 3: Return the tip of the new tool to the same spot as +; the tip of the old tool based on newly measured z-offset +; (this is a return behavior specific to QtDragon, new in 2023) +; 6. Return control back to whatever state it was in prior, continuing the program +; if one had been running. +; The following settings should be enabled in the QtDragon interface: +; A - Under Probe Tool screens: insure that "Tool Measure" is enabled +; B - Under Settings: insure that "Use Tool Sensor" is enabled +; The following workflow assumes using both a XYZ probe and a Z Toolsetter: +; 1 - Initial Setup: Before beginning the program, setup the Probe Tool as +; having a zero z-offset in the tool table (non-zero tool lengths +; for the probe tool can be made to work, but have multiple extra +; steps required, and it is easy to have the tool offset interfere with +; the remap coding and cause incorrect adjustments to your offsets. +; this procedure assumes a zero length) +; 2 - Initial Tool: Load the probe tool with M61 Qx, where x is the Probe tool's number +; in the tool table. (Do not use TxM6) +; 3 - Toolsetter measure: Use button under the Probe Screens for "Probe Tool Setter +; Z Height:" this will set and display on the Probe Settings screen the +; "Probe HT" = #<_hal[qtversaprobe.probeheight> value in ABS coordinates. +; 4 - Workpiece Measure: Use the button under the Probe Screens for "Probe Z height +; of material:" this will set and display on the Probe Settings screen the +; "Block Ht" = #<_hal[qtversaprobe.blockheight]> value in ABS coordinates. +; 5 - Set Coord System (G54): Use the Probe Tool and whichever probe screen is +; appropriate to set the coordiate system XYZ offsets needed for your job. +; NOTE: Return_Option 3 uses the current local coordinate system, not just ABS coord. +; 6 - Prepare to Run: You may then issue a manual TnM6 command to change the tool +; before starting the job, or if the job begins with a TnM6 command before +; spinning the spindle, you may leave the Probe Tool installed. +; !! Take care not to leave the XYZ tool probe in the spindle when a program may start +; the spindle. !! ;(debug, in change tool_in_spindle=# current_pocket=#) ;(debug, selected_tool=# selected_pocket=#) +; ------------------------------------- +; --- Begin Initial data gathering ---- +; ------------------------------------- + # = # # = # +# = #<_x> +# = #<_y> +# = #<_z> + +; ------------------------------------- +; --- End Initial Data Gathering ---- +; ------------------------------------- + +; ------------------------------------- +; --- Begin Initial Safety Checks ---- +; ------------------------------------- + ; we must execute this only in the milltask interpreter ; or preview will break, so test for '#<_task>' which is 1 for ; the milltask interpreter and 0 in the UI's -O100 if [#<_task> EQ 0] +o100 if [#<_task> EQ 0] (debug, Task is Null) -O100 return [999] -O100 endif +o100 return [999] +o100 endif ; check we are in right mode -O110 if [#<_metric_machine>] - O115 if [#<_imperial>] +o110 if [#<_metric_machine>] + o115 if [#<_imperial>] (MSG, Auto Tool probe error: not in G21 mode ) - O115 return [-3] ; indicate probe contact failure to epilog - O115 endif -O110 else - O115 if [#<_imperial> EQ 0] + o115 return [-3] ; indicate probe contact failure to epilog + o115 endif +o110 else + o115 if [#<_imperial> EQ 0] (MSG, Auto Tool probe error: not in G20 mode ) - O115 return [-3] ; indicate probe contact failure to epilog - O115 endif -O110 endif + o115 return [-3] ; indicate probe contact failure to epilog + o115 endif +o110 endif + +;check we have a usable search velocity configured, otherwise error +o150 if [#<_hal[qtversaprobe.searchvel]> LE 0] + (MSG, No usable search velocity in hal.qtversaprobe.searchvel) + o150 return [-1] ; indicate searchvel <= 0 +o150 endif + +;check we do not have an invalid Return Option +o175 if [EXISTS[#<_ini[VERSA_TOOLSETTER]RETURN_OPTION>]] + # = #<_ini[VERSA_TOOLSETTER]RETURN_OPTION> + o176 if [[# EQ 1] OR [# EQ 2] OR [# EQ 3]] + ;Continue: Return_Option is both defined and valid + o176 else + (MSG, Invalid RETURN_OPTION in .ini file under VERSA_TOOLSETTER) + o176 return [-1] ; signal error to post processing + o176 endif +o175 else + ;Continue: it is valid to not define Return_Option, defaults to 1 +o175 endif + +; ------------------------------------- +; --- End Initial Safety Checks ---- +; ------------------------------------- + +; ------------------------------------- +; --- Begin Physical Tool Change ---- +; ------------------------------------- ;first go up F #<_hal[qtversaprobe.searchvel]> G53 G0 Z[#<_ini[CHANGE_POSITION]Z>] -O125 if [#<_current_tool> NE #] +o200 if [#<_current_tool> NE #] ; then move to change position G53 G0 X[#<_ini[CHANGE_POSITION]X>] Y[#<_ini[CHANGE_POSITION]Y>] -O125 endif +o200 endif -; cancel tool offset +;cancel tool offset mode G49 ; using the code being remapped here means 'use builtin behaviour' +; ie, this is not a recursive call to this program, but calls the +; un-remapped M6 processing +; That processing includes actually sending the window to the user +; to press OK when they have completed the tool change. M6 -O200 if [#<_hal[qtversaprobe.enable]> EQ 0] +; ------------------------------------- +; ------ End Physical Tool Change ---- +; ------------------------------------- + +; ------------------------------------- +; ------ Begin Safety Checks for Tool Offset Measurement ---- +; ------------------------------------- + +o300 if [#<_hal[qtversaprobe.enable]> EQ 0] (MSG, Auto Tool probe disabled ) - G43 -O200 return [3] ; indicate no tool measurement -O200 endif + G43 ;turn back on tool offset mode before returning +o300 return [3] ; indicate no tool measurement +o300 endif + +;check we have a usable probe velocity configured, otherwise error +o400 if [#<_hal[qtversaprobe.probevel]> LE 0] +o400 return [-2] ; indicate probevel <= 0 +o400 endif +; ------------------------------------- +; ------ End Safety Checks for Tool Offset Measurement ---- +; ------------------------------------- + +; ------------------------------------- +; ------ Begin Tool Offset Measurement ---- +; ------------------------------------- + +;rapid-move to safe height +G53 G0 Z[#<_ini[VERSA_TOOLSETTER]Z_MAX_CLEAR>] +;Then rapid-move to probe XY location G53 G0 X[#<_ini[VERSA_TOOLSETTER]X>] Y[#<_ini[VERSA_TOOLSETTER]Y>] +;then feed down to the probe start location F #<_hal[qtversaprobe.searchvel]> G53 G1 Z[#<_ini[VERSA_TOOLSETTER]Z>] +;switch to relative distance mode for probe moves +G91 -O300 if [#<_hal[qtversaprobe.searchvel]> LE 0] -O300 return [-1] ; indicate searchvel <= 0 -O300 endif - -O400 if [#<_hal[qtversaprobe.probevel]> LE 0] -O400 return [-2] ; indicate probevel <= 0 -O400 endif - +;begin initial probe move F #<_hal[qtversaprobe.searchvel]> -G91 G38.2 Z- #<_ini[VERSA_TOOLSETTER]MAXPROBE> G0 Z #<_hal[qtversaprobe.backoffdist]> -;reprobe at probe speed +;reprobe at probe speed: G38.2 means probe toward workpiece, stop on contact +; when G38.n axis completes, it puts the Z value detected (in the coordinates system +; in which this program started) into parameter #5063 (because we're probing Z) +; F #<_hal[qtversaprobe.probevel]> G38.2 Z- [#<_hal[qtversaprobe.backoffdist]> *1.2] -O500 if [#5070 EQ 0] +o500 if [#5070 EQ 0] G90 -O500 return [-3] ; indicate probe contact failure to epilog -O500 endif +o500 return [-3] ; indicate probe contact failure to epilog +o500 endif +;switch back to absolute distance mode once probing is done G90 -G53 G0 Z[#<_ini[CHANGE_POSITION]Z>] +;set the current offset # = #5063 +; +; G10 L1 is the Set Tool Table Offset: it changes the tool table offset, +; it DOES NOT change the offsets in the current coordinate system. (that would be G10 L2) + +G10 L1 P# Z[# - #<_hal[qtversaprobe.probeheight]> + #<_hal[qtversaprobe.blockheight]>] + +;G43 enables tool length offset: this affects all subsequent moves by applying +; the offset just calculated to the coordinate system currently in +; effect. ie. it has subtracted Calculated Offset from the Z offset + +G43 + +# = [# - #<_hal[qtversaprobe.probeheight]> + #<_hal[qtversaprobe.blockheight]>] (DEBUG, %fProbe Height: #<_hal[qtversaprobe.probeheight]>) (DEBUG, %fBlock Height: #<_hal[qtversaprobe.blockheight]>) (DEBUG, %fProbe Result: #) +(DEBUG, %fCalculated Offset: #) -G10 L1 P# Z[# - #<_hal[qtversaprobe.probeheight]> + #<_hal[qtversaprobe.blockheight]>] -G43 +; ------------------------------------- +; ------ End Tool Offset Measurement ---- +; ------------------------------------- + +; ------------------------------------- +; ------ Begin Return Movement ---- +; ------------------------------------- + +o600 if [EXISTS[#<_ini[VERSA_TOOLSETTER]RETURN_OPTION>]] + ;(DEBUG, Return_Option is: #<_ini[VERSA_TOOLSETTER]RETURN_OPTION>) + o610 if [#<_ini[VERSA_TOOLSETTER]RETURN_OPTION> EQ 1] + ;(DEBUG, Return_Option 1 = Lift to Change Position Z = #<_ini[CHANGE_POSITION]Z>) + G53 G0 Z[#<_ini[CHANGE_POSITION]Z>] + o610 else + o620 if [#<_ini[VERSA_TOOLSETTER]RETURN_OPTION> EQ 2] + ; (DEBUG, Return_Option 2 = Go Up then Over to Change Position: #<_ini[CHANGE_POSITION]X> , #<_ini[CHANGE_POSITION]Y> , #<_ini[CHANGE_POSITION]Z>) + G53 G0 Z[#<_ini[VERSA_TOOLSETTER]Z_MAX_CLEAR>] + G53 G0 X[#<_ini[CHANGE_POSITION]X>] Y[#<_ini[CHANGE_POSITION]Y>] + G53 G0 Z[#<_ini[CHANGE_POSITION]Z>] + o620 else + o630 if [#<_ini[VERSA_TOOLSETTER]RETURN_OPTION> EQ 3] + ; return to original tool-tip position, but using new z-offset + ;(DEBUG, Return_Option 3 = Go Up then Over then Down to Original Position: # , # , #) + G53 G0 Z[#<_ini[VERSA_TOOLSETTER]Z_MAX_CLEAR>] + ; now use original (modal)coord system to go over to xy + G0 X[#] Y[#] + ; and finally down to the (already offset) z coord + G0 Z[#] + o630 else + ;this never executes: previously captured error if Return_Option invalid + o630 endif + o620 endif + o610 endif +o600 else + ; treat no option selected like option 1: only return to Tool Change Z coord + G53 G0 Z[#<_ini[CHANGE_POSITION]Z>] +o600 endif + +; ------------------------------------- +; ------ End Return Movement ---- +; ------------------------------------- ; signal success be returning a value > 0: o endsub [1]