Page 1 of 1

MPG Macro to set axis = 1/2 current position

Posted: Thu Jul 31, 2025 10:01 am
by 713cnc
Hello,
I am trying to set the axis to half the current position from the WMPG6 to find center with an (non-connected) indicator: jog to the left of the part, press "=0" on the mpg, then probe to the right and press "Macro1".
The "set axis=0" button on the default skin and associated macro ("C:\cncm\system\set_part_axis_zero.cnc") has a pop up window prompting the user to select an axis. Since I am jogging with the WMPG with a selected axis it would be great to skip this window.


The question: Where is the macro that is run when I press "=0" on the MPG? I think it is a canned aux key function #5. (p407 of CNC12 op manual)


Parallel question: What parameter is modified when I change the axis selector knob on the WMPG? This is the code I have so far, but #441 is undefined.

Hardcoding #110=1 and #110=2 correctly halves x and y respectively. So for now I will use two macro buttons, 1 for x and 1 for y.

Code: Select all

; ; Macro to set the currently WMPG-selected axis zero to half its position

#110 = #441   ; WMPG-selected axis (1=X,2=Y,3=Z,...)

IF [#110 EQ 1] THEN #130 = #5041 ; X
IF [#110 EQ 2] THEN #130 = #5042 ; Y
IF [#110 EQ 3] THEN #130 = #5043 ; Z
IF [#110 EQ 4] THEN #130 = #5044 ; A
IF [#110 EQ 5] THEN #130 = #5045 ; B
IF [#110 EQ 6] THEN #130 = #5046 ; C

#131 = #130 / 2

IF [#110 EQ 1] THEN G92 X#131
IF [#110 EQ 2] THEN G92 Y#131
IF [#110 EQ 3] THEN G92 Z#131
IF [#110 EQ 4] THEN G92 A#131
IF [#110 EQ 5] THEN G92 B#131
IF [#110 EQ 6] THEN G92 C#131

M225 [100] "WMPG axis set to half"
M99