This is a example of how to read parameters in a Mcode for Mach4. You can use any of the parameters in this list.
-----------------------------------------------------------------------------
-- Machine Type: Standard Mill Control
-- Author: MachMotion Development Team
-- Created: 09/24/2013
-- Modified by: MachMotion Development Team
-- Modified on: 01/10/2014
-- Description: Example: Reading Variables into MCodes
-- Copyright: © 2013-2014 Edge Solutions LLC All Rights Reserved
-----------------------------------------------------------------------------
function m700(hVars)
local macroname = "m700"
local a,b,c,rc
local inst = mc.mcGetInstance() -- Get the current instance
local nilPoundVar = mc.mcCntlGetPoundVar(inst,0)
local message = ""
if hVars ~= nil then
local ParameterLetterArray = {"A", "B", "C", "D", "E", "F", "H", "I", "J", "K", "L", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
local ParameterNumberArray = {mc.VAR_A, mc.VAR_B, mc.VAR_C, mc.VAR_D, mc.VAR_E, mc.VAR_F, mc.VAR_H, mc.VAR_I, mc.VAR_J, mc.VAR_K, mc.VAR_L, mc.VAR_P, mc.VAR_Q, mc.VAR_R, mc.VAR_S, mc.VAR_T, mc.VAR_U, mc.VAR_V, mc.VAR_W, mc.VAR_X, mc.VAR_Y, mc.VAR_Z}
for i = mc.VAR_A, #ParameterNumberArray do
rc = mc.mcCntlGetLocalVar(inst, hVars, ParameterNumberArray)
message = message .. "#" .. ParameterLetterArray .. ":" .. tostring(rc) .. ", "
end
wx.wxMessageBox(message)
end
return nil, true, macroname .. " Ran Successfully"
end
if (mc.mcInEditor() == 1) then
m700()
end