Machsupport Forum
MachPro => MachPro General Discussion => Topic started by: tbadger on March 15, 2026, 02:58:28 PM
-
I've got a RapidChange Solo ATC setup on my CNC. To probe for Z zero, I now use M132. I'd like to create a button on one of the dashboards to call this M code. But in reviewing all options (that I can find), there is no clear way to do this, except to create a user script.
The documentation here, https://support.machmotion.com/books/shared-content-public-f71/page/machpro-widgets-dashboard-commands-and-function-buttons#bkmrk-user-commands is somewhat vague IHMO on what can be done. It states the following:
One option for user commands are User Scripts. These are lua functions that will be executed as the command, to get the feedback state, or to forward to the target. This is a way to create completely custom functionality. They should always be done in the UserGUIModule.UserStartUpScript function. The following is an example of how to create these lua function in the UserGUIModule.
Within the Profile > Router > Macros > Scripts folder, there are several files that might be the right candidate, but which one is unclear. In none of those files is the section (or function) labeled UserGUIModule.UserStartUpScript.
Is this still a work in progress, or is there something that I may have missed, or is there a better way to have a button call and execute M132?
My preference is that on pressing the button, it will call M132 and CycleStart if that is necessary. My only option right now is to use MDI and CycleStart, which is really inconvenient.
-
Go to Mach\Profile\{Profile name}\ Macros\Scripts
Here you will make a copy of UserMCodeModuleDefault.mcs and rename the copy to UserMCodeModule.mcs
From here, you can start editing the file.
Add your function in like below
function UserMCodeModule.m132()
--insert user data here..
end
This will add your macro to your MCodes.
On the side note, we are in the process of adding the RapidChange ATC to our list of Tool Changers in the core of mach. I expect 1-2 weeks for this.