--Go to the closing } of the SigLib table in the screen load script and --delete it. Then paste all of this code in its place. --The new closing } for the SigLib table is on line 35 of this script. ----------------------------------------------------------- -- MPG 3 Axis & 3 Multiplier Select -- ----------------------------------------------------------- -- These simply run the MPG function if their state changes. -- Change the below Input numbers to suit your Mach4 set-up. [mc.ISIG_INPUT1] = function (state) MPG() end, [mc.ISIG_INPUT2] = function (state) MPG() end, [mc.ISIG_INPUT3] = function (state) MPG() end, [mc.ISIG_INPUT4] = function (state) MPG() end, [mc.ISIG_INPUT5] = function (state) MPG() end, [mc.ISIG_INPUT6] = function (state) MPG() end } ------------------------------------------------------------------------------------------------ -- MPG function. ( Remember to change the below input numbers to match the inputs above) -- ------------------------------------------------------------------------------------------------ -- For refernece, enter your Ports and Pins below function MPG() local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT1) -- Is mapped to Port _ Pin - *X Selection local XSelection, rc = mc.mcSignalGetState(hSig) local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT2) -- Is mapped to Port - Pin - *Y Selection local YSelection, rc = mc.mcSignalGetState(hSig) local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT3) -- Is mapped to Port - Pin - *Z Selection local ZSelection, rc = mc.mcSignalGetState(hSig) local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT4) -- Is mapped to Port - Pin - *.100 Selection local Step100, rc = mc.mcSignalGetState(hSig) local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT5) -- Is mapped to Port - Pin - *.010 Selection local Step010, rc = mc.mcSignalGetState(hSig) local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT6) -- Is mapped to Port - Pin - *.001 Selection local Step001, rc = mc.mcSignalGetState(hSig) if XSelection == 1 then mc.mcMpgSetAxis(inst, 0, 0) --X Axis mc.mcCntlSetLastError(inst, "X Selected") elseif YSelection == 1 then mc.mcMpgSetAxis(inst, 0, 1) --Y Axis mc.mcCntlSetLastError(inst, "Y Selected") elseif ZSelection == 1 then mc.mcMpgSetAxis(inst, 0, 2) --Z Axis mc.mcCntlSetLastError(inst, "Z Selected") else mc.mcMpgSetAxis(inst, 0, -1) --No Axis mc.mcCntlSetLastError(inst, "No Axis Selected") end if Step100 == 1 then mc.mcMpgSetInc(inst, 0, .100) elseif Step010 == 1 then mc.mcMpgSetInc(inst, 0, .010) elseif Step001 == 1 then mc.mcMpgSetInc(inst, 0, .001) end end