CNC G Code Wrapper Program Download


I have only recently started using a CNC machine and want to use it for making pens. In order to be able to engrave the surface of a pen, you either have to create engraving programs using the X & A axes by hand (because almost no programs exist that allow this sort of idea) or you create the toolpath as a flat shape, then wrap it around the surface. CAMBam can create a toolpath for a 2D toolpath type arrangement, and 'CNCWrapper' does the wrapping. Now, I am constitutionally unhappy about paying for software if I don't need to, and I am even less happy to pay for stuff I'll only rarely use. There are a lot of functions in CNCWrapper I do not understand or don't need that I feel I'd be required to pay for. So, I decided to write my own wrapper program.

The program wraps an XY plane toolpath around the A Axis. Either the X or Y axes can be wrapped and three settings can be tweaked to change the radius & machining plane. It is a very simple to use program. To give an example using a toolpath that engraves 'Hello' (red dotted line = rapid feed, blue line = machine feed & magenta arc = arc - notice how the wrapped versions of the letter 'O' are no longer arcs):

When the X Axis was wrapped onto the A Axis, with a 75mm work diameter, the Mach 3 toolpath is as below:

When the Y axis was wrapped onto the A Axis, with a 15mm work diameter, the Mach 3 toolpath is as below:

OK, now for a real job. The engraving on the cap ring of my prototype CNC machined pen.. Here's the engraving wrapped from the 2D drawing, path created in CAMBam and then wrapped onto the ring. There is even room in the shape to make a feature of the hallmarks too. Letter height is 1.5mm, depth of engraving 0.15mm.

The program works by reading and understanding the toolpath. All straight lines with a component in the wrapped axis are converted into rotations and a movement in a the machine's X axis only. All arcs are converted within the program to straight line segments before being treated in the same way as normal straight lines. The user has control over the straight line segment size. For large arcs it is specified by segment length, and for tiny arcs it's possible to specify the maximum angle the segment subtends around the centre of the arc. It is highly unlikely that sizes of less than 0.1mm/1 degree would ever be noticeable on the work and such precision wouldn't add greatly to the machining time.

The program can be downloaded below. The program, pdf help file, a readme file and source code are included in the zip file.

Download the G Code Wrapper Program. (491 kb)

The program is a Windows program, and is known to run on Windows XP, Windows 7 (32 & 64 bit versions) and Windows 10. It should work in any 32 bit windows operating system. It does seem to run under WINE on Linux too. The program is a single file .exe file and writes a windows .ini file in the directory you put the programs into. The Borland C++ Builder 4 source code is included so that you can check for yourself that the program does nothing unpleasant to your computer.


15 May 2022: A user came across a problem with this program disallowing the perfectly acceptable continuation of a G Code (eg G00 or G01) from one line to the next. As some users have systems that require the G Code to be repeated on each line, I have made it so that this program repeats the previous G Code on each line that needs it.

25 Nov 2013: CamBam sometimes adds a "G68" code to the toolpath. This is OK for a flat toolpath, but seems to give Mach3 hysterics when an A axis is used. The G68 code is now swallowed by the "GCode Wrapper" program and does not get through to the output.

Chestnut Pens Miscellaneous Pages Home
Chestnut Pens Home