Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: gorf23 on August 17, 2017, 04:23:33 PM
-
anyone know the mc code to read and wirte to chance motor steps with a script.
Thanks
-
in mach4 its called counts per unit looking for a way to read and write to make changes to the counts per unit
-
To set the counts per unit you would need to use mcMotorSetInfoStruct, there is no mcLua bindings for this and can only be used from a plugin. Although I did do this a long while ago and I will see if I can find it, by writting to the profile then reloading the profile.
DazTheGas
-
Thanks DAZ
I figured it out
would be nice if they made the mcMotorSetInfoStruct call available in scripts...
gary
-
Hi Gary,
it might be nice to be able to use the InfoStruct in a script but how realistic is that?
If I understand correctly the only data structure that LUA has is a table. While a table can and is used in some ingenious ways its not
like the MotorInfoStruct with Booleans, integers, longs and doubles all thru it.
There are a few data structures in Mach, AxisInfoStruct for instance. For the same reason you can't access that structure complete with LUA API
but quite a few of the individual variables in the structure can be accessed with the LUA API.
I'm wondering if you might be able to achieve what you want by having two motors assigned to the same axis but only one enabled at a time
each with different 'step per' values?
Craig
-
Curiosity, what are you doing that needs to edit the motor setup from Lua?
Could the same result be achieved using G code scaling by having Lua
execute a G51?