Abstract
GCodeMapper is a program which maps a g-code program’s movements from one surface to another.
This program was created, because I have only a three axis CAM software package http://www.cambam.info but a milling machine with an additional rotatory axis – as shown in figure 1. I use the machine controller software LinuxCNC http://www.linuxcnc.org. You can have a look at http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Rot4thaxiskins for further information on how to set up the kinematics for such a kind of machine in LinuxCNC.
For a lot of problems it is sufficient to map the program cutting on the surface of a planar stock – as generated by a three axis CAM software – around a cylindrical stock. This is exactly what this program does – see figure 2.
The mapping relation of coordinates T in the planar program to coordinates
T in the
resulting cylindrical program is
![]() | (1) (2) (3) |
Straight motions (G0 and G1) in the planar program with a constant Z-coordinate are mapped to a helix (G2 or G3) in the cylindrical program. Straight motions in the planar program with a constant Y -coordinate are mapped to a straight motion (G1) in the cylindrical program. Straight motions violating these constraints and arcs (G2 and G3) are approximated by short line segments (G1). Note that a rapid movement (G0) is never mapped to a G0, that’s why you have to pass a feed rate for mapped G0 movements. All other motions are not implemented, so only G0, G1, G2 and G3 movements are supported.
Only a source package is provided at http://www.lederhilger.co.at/GCodeMapper/gcodemapper-1.1.tar.gz. That means you have to compile this C++ program by yourself. This program has the following prerequisites:
To configure the program, create a build directory, change to it, and run
or
and then run
to compile and install the program.
Please note that I have used this program several times on my own machine, but it could still contain some bugs. So please take a look on the transformed program before running it on your machine!
The program has a command line interface. When running
you get a general help, and when running
you get the help for the command line parameters of the CylinderGCodeMapper – no other mapper
type1
is implemented at the moment. Most of the parameters have reasonable
defaults2 ,
only mapper, cylinder-diameter, rapid-feed-rate and input and output files are required. A hypen is
also accepted as the input and output file parameter. This means that the file is read from standard
input or written to standard output. You can also specify parameters which are always the same in
“gcodemapper.conf”. It is searched in the current working directory. In the following listing you can see an example.
This section shows how to apply this program on an example g-code program which was generated by CAMBam. The example is shown in figure 3 and in listing 2.
When the command
is executed, then everything between the begin and end mapping comment is mapped around the cylinder. The mapped output is shown in figure 4 and in listing 3.
You can find the history of the program in table 1.