Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: asrin on December 28, 2009, 11:56:34 AM
-
Hi guys,
Is it possible to change the "steps per" ( Motor tuning ) with Visual basic ?
I would be very happy if this is possible.
With kindly regards from the Netherlands.
Riny
-
Hi
As far as I am aware there is no interface to access the actual windows components, menus etc.
2 methods come to mind.
1) Close Mach, then open NameOfYourProfile.xml in the ../Mach root directory.
Search for <StepsX>???</StepsX>, where X is the 0 based number of your stepper drive you wish to access.
Change the figure ??? to the new setting
Relaunch Mach
This could all be done through VB
2) Simulate a physical entry into the Motor Tuning menu, by using SendKeys() to output the simulated keystrokes necessary to reach the appropriate textbox and make an entry.
Since any change to steps/per will usually have necessitated a mechanical change, or more likely a change to the driver dip switch settings, it is unlikely to have been done with Mach running, so method 1 seems the best to me.
Not sure why you would need to do it, would be interesting to hear.
regards
Melee
-
You can use SwapAxis() to switch between two axis with different settings.
-
Hi Melee and Gerry,
Thanks for your replies.
I need this because I want use the 4e axis insteed of the Y axis for milling on a cylinder. Then I can make two buttons on my screen to change the units per rev and with a switch I change the motor in hardware.
So I can see on my screen what the settings are.
I have try-ed CNCwrapper, but these software can't swap circles. Then you have to use software that makes a circle with only little lines, this action is not possible in my software.
-
I would just set up another profile using your current one as a template.
Machine Standard
and
Machine Rotary
Graham
-
Hi
Just come across this post and realised I had seen something recently that might help.
Amongst the list of strings for use in the GetParam() and SetParam() functions in the wiki are
"StepsPerAxisX" = X Steps per unit from the motor tuning page
"StepsPerAxisY" = Y Steps per unit from the motor tuning page
"StepsPerAxisZ" = Z Steps per unit from the motor tuning page etc. etc.
Haven't tried them yet, but it reads as though you should be able to set them on the fly from VBS.
regards
ArcEye
-
Yep,
Just tested it
X = GetParam("StepsPerAxisX")
SetParam("StepsPerAxisX", X * 2)
fetches steps per for X and then doubles it
You can see the X DRO change to compensate and the motor tuning entry is changed.
;D
-
Excellent solution ArcEye. :)
Tweakie.