Swapping Axes for Right Angle Heads, Horizontal Mills, and Such

Last modified: May 2, 2024

I ran across a request over on CNCZone for the ability to go through a g-code program and swap the axes. Apparently this is useful for writing programs for right angle heads or in some cases for converting a program from a vertical to a horizontal mill. I did a little research and came across two threads over on Practical Machinist that wanted the capability for the same reason. Since it's not hard to do and seemed to be something useful, I put together the capability to do this in G-Wizard G-Code Editor. It looks like this:Gray background with white text box, menu bar, toolbar, and multiple windows open in a computer program interface.

Computer screenshot displaying revision menu with radio buttons and function list

The Swap Axes Revision will swap up to 4 axes and automatically convert the related axes...

With Swap Axes (under the Tools Revisions menu), you can swap up to 4 axes if you need to. Just tell it the "from" letter and the "to" letter. These is also the option to automatically swap any related axes. For example, if you are swapping X to Y, you probably want to swap I to J and U to V (Fanucs lets you use UVW as relative versions of XYZ so you needn't keep switching modes). One click saves you some time. This related axes option is not something I've seen in other editors, but it sure makes sense if you had to do this sort of thing very much. Note that the swap is one way unless you specify both directions. So if you truly want to swap X and Y, you would put X to Y as one line and Y to X as the other.

The related threads I linked to had some good tips on how to go about this type of programming. In particular the first tip also mentions that at least for one machinist, they had to switch G02 for G02. I thought about adding a checkbox to automatically do that as well, but hadn't seen any other examples where it was necessary so left well enough alone. If someone who does a lot of right angle head programming wants to suggest further additions to the function, drop me a note.

This capability is not in the current release of GWE, but will be in the very next one I post. I just need to finish doing WHILE for Fanuc Macro B support plus a little cleanup and testing and I'll be ready to post this release. Give it another week or so, could be end of next week or sometime the following week.

BTW, it does kind of bake your noodle a little bit to think about programming a right angle head, but it isn't so bad if you just think of doing it in the normal XY plane and then use a capability like this swapping to move it to another plane. Read through all the links I gave before you attempt it, there's some good advice in them.

Be the first to know about updates at CNC Cookbook

Join our newsletter to get updates on what's next at CNC Cookbook.