Tool Change Macro

TomS

Active User
H-M Supporter Gold Member
Joined
May 20, 2013
Messages
1,906
I've searched the net looking for info on how to tell my CNC mill to move to a safe tool change position. Going in I thought it would be easy but I found out that most of what I found was either incomplete or I needed a doctorate in computer programming to get what I needed.

I did find the following macro language that the author swears works as intended but no further explanation. It didn't work for me.

Code("G53G0Z3.5")
While IsMoving()
Sleep 100
Wend
Code("G53G0X48Y0")
While IsMoving()
Sleep 100
Wend

I copied this into Mach3/macros/"My Mill Profile"/M6Start.m1s. Should it go in the "End" macro instead? Is there a flaw in the macro itself? Is it me assuming this is M6 macro language? Maybe it's button script?

Thank you in advance and looking forward to your responses.
 
I am in no way an expert in Gcode but I do have some programing background although I have never created a macro for Mach3, never needed to.
Some simple observations
1. This looks like it does two things when called
a) Cancles any work offsets, note that it does not put turn any work offsets back on when finished)
b) Moves to Z 3.5, X48 and Y0

2. I would expect that you would need to put this in some place that it would be called when you need to do a tool change. Putting it at the startup or end of some other process does not make sense to me but I may not understand how macros are called in Mach3
3. In order for any tool change process to move the spindle to a specific place it you MUST HOME the mill each time you use it. This way the G53 makes sure that the moves given are relative to the HOME Position and not the zero of the part you are working on. You must re-enable the Part offset or else the next moves will also be relative to the HOME and not the part with possibly disastrous results.
4. I was able to tell MACH3 to always go to Z5 for tool changes without using a macro. Now of course I don't home my mill and so this is Z6 relative to the Part Zero that I am working on. If I am working on a very tall part it could be too high and trip the Z Limit switch.

Some things to think about.
 
I am in no way an expert in Gcode but I do have some programing background although I have never created a macro for Mach3, never needed to.
Some simple observations
1. This looks like it does two things when called
a) Cancles any work offsets, note that it does not put turn any work offsets back on when finished)
b) Moves to Z 3.5, X48 and Y0

2. I would expect that you would need to put this in some place that it would be called when you need to do a tool change. Putting it at the startup or end of some other process does not make sense to me but I may not understand how macros are called in Mach3
3. In order for any tool change process to move the spindle to a specific place it you MUST HOME the mill each time you use it. This way the G53 makes sure that the moves given are relative to the HOME Position and not the zero of the part you are working on. You must re-enable the Part offset or else the next moves will also be relative to the HOME and not the part with possibly disastrous results.
4. I was able to tell MACH3 to always go to Z5 for tool changes without using a macro. Now of course I don't home my mill and so this is Z6 relative to the Part Zero that I am working on. If I am working on a very tall part it could be too high and trip the Z Limit switch.

Some things to think about.

Thanks for your comments. I am no gcode expert either. I understand the Z, X and Y moves (I changed the numbers to reflect my mill run in inches) in the macro but I don't see or understand where it cancels work offsets. G53 moves the axis relative to machine coordinates, this I understand. I do Home my machine on startup. So how to I re-enable work offsets?

Maybe I'm over-thinking this and there is a more simple way to accomplish the same thing. What did you do to get Mach3 to go to Z5 without a macro?
 
I have to go and look at my mach3 setup later when I can get to it. but it was some sort of setting in mach 3 I thought.
 
Sorry been busy. Your other question about the G53. I this is what I would call a state command. It changes the coordinate system to the machine coordinates by canceling work offsets. Once this state is changed I would expect it to stay changed until explicitly changed to something else. but I may have this wrong. Hopefully someone with more GCode experience can comment
 
I've searched the net looking for info on how to tell my CNC mill to move to a safe tool change position. Going in I thought it would be easy but I found out that most of what I found was either incomplete or I needed a doctorate in computer programming to get what I needed.

I did find the following macro language that the author swears works as intended but no further explanation. It didn't work for me.

Code("G53G0Z3.5")
While IsMoving()
Sleep 100
Wend
Code("G53G0X48Y0")
While IsMoving()
Sleep 100
Wend

I copied this into Mach3/macros/"My Mill Profile"/M6Start.m1s. Should it go in the "End" macro instead? Is there a flaw in the macro itself? Is it me assuming this is M6 macro language? Maybe it's button script?

Thank you in advance and looking forward to your responses.

The Tormach flavor of Mach 3 had a macro, M998 that moved upward to a tool change position. I believe that post #6 in the following is the content of that macro.
https://forums.autodesk.com/t5/hsm-post-processor-forum/m998-tool-change-position-mach3/td-p/6088733
 
The Tormach flavor of Mach 3 had a macro, M998 that moved upward to a tool change position. I believe that post #6 in the following is the content of that macro.
https://forums.autodesk.com/t5/hsm-post-processor-forum/m998-tool-change-position-mach3/td-p/6088733

Thanks for pointing me to the macro. I know virtually nothing about computer language. Where do I put the macro language? In the Mach3 macro folder? In the Mach3 post processor? It frustrates me that Mach3 has a Tool Change Location feature on the Settings page but no language to make that feature operable.
 
It is in the macro folder in a sub folder named PCNC770. I'm not sure wher it would be in the standard Mach 3 version. It should do no harm if it is in the wrong folder. It just won't run.
 
I do Home my machine on startup. So how to I re-enable work offsets?


You revert the the work offset with a G54, with no arguments, after the tool change. I'm surprised that Mach3 doesn't automatically go the G53 location when called without a macro.
 
It is in the macro folder in a sub folder named PCNC770. I'm not sure wher it would be in the standard Mach 3 version. It should do no harm if it is in the wrong folder. It just won't run.

Thanks RJ. I'll try it tomorrow.
 
Back
Top