Hello Guest it is April 20, 2024, 05:29:31 AM

Author Topic: mc code to read and wirte to chance motor steps.  (Read 1636 times)

0 Members and 1 Guest are viewing this topic.

Offline gorf23

*
  •  189 189
    • View Profile
mc code to read and wirte to chance motor steps.
« 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

Offline gorf23

*
  •  189 189
    • View Profile
Re: mc code to read and wirte to chance motor steps.
« Reply #1 on: August 18, 2017, 11:08:31 AM »
in mach4 its called counts per unit looking for a way to read and write to make changes to the counts per unit

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: mc code to read and wirte to chance motor steps.
« Reply #2 on: August 18, 2017, 12:20:53 PM »
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
New For 2022 - Instagram: dazthegas

Offline gorf23

*
  •  189 189
    • View Profile
Re: mc code to read and wirte to chance motor steps.
« Reply #3 on: August 18, 2017, 08:44:19 PM »
Thanks DAZ

I figured it out

would be nice if they made the mcMotorSetInfoStruct call available in scripts...

gary
Re: mc code to read and wirte to chance motor steps.
« Reply #4 on: August 19, 2017, 02:45:09 AM »
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
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: mc code to read and wirte to chance motor steps.
« Reply #5 on: August 19, 2017, 09:46:42 AM »
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?

Steve Stallings
www.PMDX.com