June 30, 2026

SmartCAM Code Generator

SmartCAM Code Generator: Part 1

Overview

We know that control is important to you! We are excited to offer you a brief introduction to the SmartCAM Code Generator for use with SmartCAM. 
In this series, we'll be covering topics on the Code Generator. In this post, we'll cover:
  • Basics
  • CGT
  • SMF
  • Code File
  • Try it!
 

Basics

The Code Generator is the system that takes what you have done in SmartCAM in the user interface and translates that into machine code. In this post, we’ll cover information about the files used and some brief information about how they interact: The machine (via the .smf), the step data from the Job Operations (via the .jof), and the geometric data (via the .pm5) to compile the data into code that your controller can read.

In our next post, we’ll dive into editing the files including formatting, variables and more!

Let’s dive in… 
 

CGT (Code Generator Template)

The primary function of the CGT file is to format data into the language that is understood by the controller. Often logic and/or math is required so the .cgt can include those as well. It also automatically performs some functions that are specific to CNC control language. 

Notes:

  • In order to be able to view and edit a .cgt file, you may want to set the Windows File Association to open .cgt files in your favorite text editor. We suggest using a text editor that includes line numbering for easy debugging.
  • When editing the .cgt file, there is no need to open and close the file regularly. We suggest leaving it open and simply saving the file with each edit while you test.
     

SMF (SmartCAM Machine File)

The .smf contains information specific to your machine and its controller. It determines items such as machine limits, rotary-axis information and more. Some of this data affects how your model reacts during Verification in SmartCAM. The SMF can be changed at any time. This means that a single model can be used for multiple machines, only needing modification to the differences in the model.
 

Code File

This is the file that is created by SmartCAM using the available data and templates. Once created, it can be sent to the controller. Some controllers want .cod, others .txt and some want no file extension at all. Check your machine’s documentation to ensure you are using the right Code File type. 
 

Try it!

This exercise is based on an inch model in a milling application but can easily be adapted for metric and any of the products.

1.   Start your SmartCAM application and open one of the sample files for SmartCAM. Sample files can be found in C:\ProgramData\SmartCAM\SmartCAM<version>\<Product>\<X>DATA. For this example, we are using tombstone2.pm5 in the MDATA folder for MILL (Milling).

2.   Click on the Operations Planner.

3.   Select a Step.

4.   Click the Edit button.

5.   Check out all the settings here.

6.   Click Cancel then Close.

7.   Click Job Info  and select the Machine tab.

8.   Click on the Choose button and select one of the Examples or any of the machines you have configured.

Note that it automatically fills in the SMF and CGT files for that machine.

There are some example machines installed with SmartCAM. To configure your own, check out this video

9.   Click Accept.

10.   Use Verification  to view the tool path, then close the Verification window.

11.   Right click anywhere on the toolpath and select Element Data to see how SmartCAM stores the information about the element. Close this window when ready.

12.   Let’s create some code! Click Create NC Code . The Machine data should already display your machine file.

13.   Click on the File Select button to enter a Code File name and location.

13.   Check the “Open Code File” box so SmartCAM opens the file for you automatically. (Windows will need to have the correct file association for the file type you selected for this file in order to open the Code File automatically)

14.  Click the Create Code button.

The Code File should open automatically. Here is an example:

There is a lot that goes into creating a Code File but once you understand the parts and how they interact, you can use SmartCAM to ensure complete control of your work. 

Stay tuned for future posts on the Code Generator. We’ll cover:

  • Editing the machine file/Machine Define
  • Numeric formats
  • Variables, Commands and Functions
  • Debugging

Please let us know if you have any questions or comments here or by emailing us at CustomerServices@SmartCAMcnc.com.

No comments:

Post a Comment