Multi Axis G-Code generation with CNC-Toolkit

Yes, CNC-tookit is ancient. But since Fusion 360 doesn't do the job...so well...
Here are my notes about how to get cnc-tookit running on a modern Windows 10 and create 4 and 5 axis toolpathes with it.

I may add screenshots to illustrate my notes at a later point.


I'm trying to figure out if and how to generate 4 and 5 axis G-Code in CNC-Toolkit to run on my heavily modified YooCNC 6040 machine.

Getting the software

  1. get GMax
  2. get CNC-Toolkit
  3. The registration website for the (always free) GMax software no longer exists... GMax registration workaround 
  4. I haven't looked at these yet  

Setting up Gmax

Before you start, you should select the system unit of meassurement in Gmax using Customize-Preferences... and then General-System Unit Scale.

Geometric assumptions

Some assumptions I do about the CNC machine:
  • We use a 4 axis machine with the A axis mounted on the bed of a carthesian CNC mill.
  • The A axis is running along the X axis (along Y it would be the B axis after all)
  • The center of rotation is at Y=0 Z=0
  • The stock starts at X=0 and ends at X>0
  • The stock is cylindrical. 
  • positive Z mean "up" from the center of rotation towards the spindle.
Further assumptions:
  • We use a ball nose cutter
  • We are only interested in FINISH-passes. (For roughing 3 axis milling of X+A+Z is enough)
  • STL-file and tool sizes and machine coordinates are in millimeter

From STL to G-Code 

I used this tutorial to make these notes.

  1. Make sure your object is already scaled to the right size.
  2. Orient your object along the Y axis.

Convert STL to 3DS

GMax doesn't seem to understand STL or the unual CAD file formats.
So we need a converter.

3D Exploration 1.5 can be found here : cnczone.com/forums/attachment.php?...
(Yes, you need a user account in the CNCZone forum.)
In Windows 10 you need to install this using compatiility settings.
It is discontinued but you should of cause still register it for 40.77 € +19% sales tax = 48.52 €.

If objects in the original file exceed the 64,000 faces per object limit for .3DS, it splits info face groups that you need to reunite inside Gmax using the Editable Mesh 'Attach' or 'Attach List function.

  1. Open "3D Exploration 1.5".
  2. Select your file on the right side.
  3. Select File-Save As... and the 3ds file format.

combine face groups

On the right side you have  a number of tabs,
  1. In the first tab, you can assign a name to your objects to identify them.
  2. In the "view" tab with the monitor icon, you can hide objects that clutter your view and render them as solid objects.
  3. In the tools tab, you can "attach" and "attach list" multiple face groups into a single mesh.

Load model

  1. File-Import your convertes mesh.
  2. Make sure it's oriented along the X axis due to limitations of cnc-toolkit.
  3. Note down the size of your stock.
  4. Select your object and in the top right panel, give it a name.

Run cnc-toolkit

  1. Run the "CNC-Toolkit-4.34b.ms" MaxScript file using the menu.

Next select your machine type.
  • XYZ is a 3 axis mill
  • XYZA has 
    • a 4th axis mounted on the work-surface that rotates around X
  • XYZAB has 
    • a 4th axis mounted on the work-surface that rotates around X and
    • an additional 5th axis "B" mounted on the Y gantry, rotating the spindle around Y
  • XYZABC has a trunnion arm mounted on the Y gantry
    • C mounted on the trunnion rotating around the vertical axis
    • B mounted on the C axis to rotate perpendular to to C
  • XYZAC has a 4th and 5th axis combination mounted on the work surface. 
    • A rotating the table and 
    • B rotating the part on the table surface
The offsets are the distance from center of rotation to the tip of the tool.
For an axis mounted to the work table,  as with XYZA and XYZAC I assume it's the distance from center of rotation to the origin point.

Create a cylinder of splines

  1. In the "parallel splines" section choose "helical" or "cylindrical"
  2. Enter apropriate X, Y and Radio -dimensions for your stock.
  3. Click "Make parallel splines" and wait a second for them to apear.
  • "Stepover Distance" controls the distance of parallel toolpathes at the outher diameter.(Oviously the closer they are to the center, the closer they get. Keep that in mind for stock that can melt or catch fire.)
  • Despite the name "Stepover" is an absolute distance between tool passes and ignoring the tool diameter.
  • "Stepover" also ignores any changes in radius during the later projection. As the spline gets near the center of rotation during projection, the resulting toolpathes are much closer then the initial "Stepover" distance.

Project splines onto surface

  1. In the "project spline" section, click "object" and select your object.
  2. Select the spline.
  3. Click "project around X axis"
  4. Delete the unprojected spline using edit-delete (it's no longer needed and can be re-created with just 1 button)
It should now wrap the surface of your object.
  • Height offset is otherwise known as a skin depth and allows for roughing passes

Create tool vectors along projected spline

  1. Up in the "angle control" section, choose "Use Reference Surface".
  2. Then "Pick Reference Surface".
  3. Select your object and the button should not read "Ref Mesh = ". 
  4. Select the projected spline. (Not the original spline. You can delete that one.)
  5. In the "toolpath generator" section, choose "Toolpath from Shape".
You may have to wait for a few seconds.

Generate g-code and show animation

Now you can use the "Tool Control" and "Postprocessor Options" sections to export your g-code to the "Script listener window" to copy and paste it.
(The other options here work in 3D Studio MAX but not in GMAX)

You can find that windows with F11 or in "MaxScript"- "MAXScript Listener..." .

After postprocessing, you can use "/" or the play-button in the lower right to see an animation of the milling process.


I have not yet fully understood how to compensate for the tool shape.
The tangent mode seems to use the entered tool diameter and offset it along the surface normal.
This simple method would of cause be problematic in pockets narrower then  1.0x the tool diameter that can not be milled with a tool of this size. However an infinitely small tool will try and the applied offset will cut widen the pocket beyond the intended geometry.

As an alternative I should test importing an existing 3 axis toolpath and having cnc-toolkit perform the too-orientation only. Aparently toolpathes from CamBam (trial versions) can be exported as DXF and imported into GMAX. I don't think that works for gcode -toolpathes of my favorite 3 axis CAM software.

I have also not understood yet how to use your own geometry to represent your machine for better visualision and for collision detection. Aparently you can "link" your own geometry to follow the path of the generated stand-ins and then hide the stand-ins.

Keine Kommentare: