Creating Your Own Coordinate Manipulation Features
As you know, computer numerical controls have a series of coordinate manipulation features such as mirror image, coordinate rotation, scaling and axis inversion. But with some control manufacturers, these features are options that you must pay extra to get.
As you know, computer numerical controls have a series of coordinate manipulation features such as mirror image, coordinate rotation, scaling and axis inversion. But with some control manufacturers, these features are options that you must pay extra to get.
There may also be times when you want to do something with coordinate manipulation that is not possible with those features available from the control manufacturer. For example, some Fanuc controls do not allow you to specify the center of manipulation for mirror image.
If you have custom macro B, you can emulate those coordinate manipulation features that are available from control manufacturers (without buying the related options) or create a new form of coordinate manipulation that is specific to your needs.
This can get pretty complicated, so we’re going to keep the example simple. We’ll create a feature that emulates axis inversion (any time the control sees an X word, it will be used as a Y word, and vise versa).
You must understand two important features of custom macro B in order to create coordinate manipulation features. First, you can modify the way G codes behave. In our case, any time the control reads a G01, we’re going to have it execute a special custom macro program that inverts the motion in each axis. Second (though it’s not specifically related to custom macro B), you can modify certain values in parameters with G10 commands. Note that parameter numbers vary from one control model to the next, so you must reference your own control manufacturer’s programming manual to find the related parameters for your control.
Let’s first create the G codes to invoke and cancel axis inversion. We’ll choose G100 to invoke axis inversion and G101 to cancel it. (You can choose any G-code numbers that are not being used for some other purpose.) With one Fanuc control, parameter number 7050 specifies the G-code number that executes program O9010 and parameter 7051 specifies the G-code number that executes program O9011. We’ll set parameter 7050 to a value of 100 and parameter 7051 to a value of 101. From this point, whenever the control reads a G100, it will execute program O9010. When it reads a G101, it will execute program O9011.
Here are these two programs.
O9010 (Invoke XY inversion [modify function of G01])
G10 L50 (Enter parameter setting mode)
N7052 R1 (Set parameter number 7052 to a value of 1)
G11 (Cancel parameter setting mode)
M99 (End of custom macro)
O9011 (Cancel XY inversion [reset function of G01])
G10 L50 (Enter parameter setting mode)
N7052 R0 (Set parameter 7052 to a value of 0)
G11 (Cancel parameter setting mode)
M99 (End of custom macro)
Again, whenever the control reads a G100, program O9010 will be executed. O9010 will set parameter 7052 to a value of 1. From this point, whenever the control reads a G01, it will execute program O9012.
By the way, any axis specifications in the G01 command (X or Y) will be passed as local variables to program O9012 (as #24 and #25). Program O9011 simply resets parameter 7052 to a 0, so the control will go back to using G01 in the normal manner.
Now, here’s program O9012:
O9012 (Axis inversion macro)
G01 X#25 Y #24 F#9 (Make normal G01 motion, but invert axes)
M99 (End of custom macro)
Here is an example program that uses our new axis inversion feature:
O0001 (Main program)
N050 G100 (Instate axis inversion)
N055 G01 X3.0 Y2.0 F3.0
N060 G01 X4.0 Y2.5
N065 G01 X2.5 Y 5.0
N070 G101 (Cancel axis inversion)
Admittedly, this is a little complicated. There are some limitations that you may have already spotted. First, each command in the program that uses our axis inversion feature must include a G01. Second, this only works with G01. Note that with further effort, each of these problems can be overcome. Any time you have an application that requires coordinate manipulation, you should be able to handle it with these techniques. Be sure to stick with it until you get your new feature working to your liking.
Read Next
SpindleSHOT Offers Improved Chip Control and Less Maintenance
High-pressure coolant system is customizable to meet customer needs.
Read More3 Mistakes That Cause CNC Programs to Fail
Despite enhancements to manufacturing technology, there are still issues today that can cause programs to fail. These failures can cause lost time, scrapped parts, damaged machines and even injured operators.
Read MoreIncreasing Productivity with Digitalization and AI
Job shops are implementing automation and digitalization into workflows to eliminate set up time and increase repeatability in production.
Read More