Hello Guest it is March 29, 2024, 05:25:58 AM

Author Topic: Parametrized M codes (e.g. M162 A12.0 P8.0)  (Read 3029 times)

0 Members and 1 Guest are viewing this topic.

Parametrized M codes (e.g. M162 A12.0 P8.0)
« on: October 09, 2015, 07:29:16 AM »
Hello!

I've been looking for this feature for some time now, seems it had been impl'd in one of the more recent versions (test with v2716):

You can provide parameters to custom M code Lua scripts. Please refer to example LuaExamples/UseVarsFromMcodeLine/M162.mcs.

Code: [Select]
local pFlag = mc.mcCntlGetLocalVarFlag(inst, hParam, mc.SV_P)
... checks if parameter P is available ...
Code: [Select]
local pVal = mc.mcCntlGetLocalVar(inst, hParam, mc.SV_P)
... while this line retrieves the value as double

mc.SV_P may be replaced by any character between SV_A and SV_Z.

Small example M162 script attached, which writes values of all present parameters to log.