Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

CNC Simulator Profesional

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 86

CNC SIMULATOR PROFESIONAL

1. How to control the 3D view

Roll the mouse wheel to zoom in and out.


Right-click the 3D screen and drag to pan picture.
Left-click and drag to rotate the view.
 

You can also pan and zoom using the keyboard. Page Up and Page Down keys let you
zoom in and out, and the arrow keys let you pan the 3D view.
 

 
Controlling the simulation
Use the Simulation control buttons to control your simulation.
 

 
From the left:
 
Play – Used to start the simulation. It is also used to resume the simulation after a
pause.
Pause – Used to pause the simulation.
Stop – Used to stop the simulation.
Fast forward – Used to simulate at high speed (limited only by your computer
hardware).
Step – Used to advance through the CNC program step by step.
These functions can also be reached from the Simulate menu. There you will also find
additional functions:
 Simulate from cursor - Used to start the simulation from anywhere in the CNC
program.
 Quick simulate - Used to simulate at maximum possible speed. The CNC code in the
editor will be hidden.
Quick Simulate to next tool - Executes a quick simulation to the next tool change.
Fast Backplotting - Only creates tool paths. Usefull when working with very large CNC
programs.
 
Ignore Axis Limit Check - Special function that makes the simulator ignore axis limits.
 

 
Please note the keyboard shortcut keys (F5, F6, etc.) can be used instead of clicking on
the buttons or in the menu.
 
On the virtual CNC controller, there are also buttons that can be used to control the
simulation.
 
 
2. Pause simulation
 
There are several ways you can pause the simulation.
 
The first and most obvious way is to click on the pause button during the simulation.
 
There is also something called Pause Points. They are small green dots, in the left
margin of the CNC editor, used to make the simulator pause. You create (or delete)
them by clicking on the margin in front of the line you want to pause at.
 

 
The simulation will pause at each green dot and you can continue by clicking Play, Step
or Fast Forward.
 
Another way, maybe less obvious, is to use M01 (Optional stop). It will only pause the
simulation if the “Op. Stop” switch is activated on the virtual CNC controller.
 
 
3. Controlling the Speed of the simulation
 
You can simulate in various speeds. The maximum simulation speed is decided by your
hardware. A modern dedicated graphics card will speed up your simulation a lot.
 
Please note that simulation speed has nothing to do with real machine time. A part that
may take an hour to make in the real machine can take 10 seconds in the simulator
depending on your speed setting and your hardware. So, what affects the simulation
speed?
First of all, you have simulation speed controllers in the view panel and in the virtual
CNC controller.
 

 
They are connected so if you change one, the other will follow. As you can see, we call
the round knob in the virtual CNC controller “Feed override %” but it is actually a
simulation speed controller. For fastest simulation speed, drag the slider to the top or
turn the knob to 100%.
 
 
Another thing that affects the simulation speed is the quality setting. If you suffer from
slow simulations, try to adjust the "Solid buffer resolution" setting in the program
settings.
 

 
A lower quality setting will give you faster simulations.
 
To simulate at maximum speed , use the Fast Forward button in combination with a low
quality setting. For maximum quality simulation at more realistic speed, use a higher
quality setting and adjust the simulation speed slider to your liking. We highly
recommend getting a good graphics card for best simulation performance. Even an
older and cheaper card will make a huge difference if your computer has slow built-in
graphics capabilities.
 
4. Virtual Machines

A virtual machine file has the extension .cmachine and contains all the graphics and
logic for the machine. There are several virtual machines to choose from in the different
machine folders. You open a new machine by selecting Load Machine from the File
menu or by clicking the open machine button .
 

   
 

   
   
Each machine has its own settings and limits. Some of them you can change under the
Machine tab in Settings. If the limits of the machines do not fit your needs, you can
always use the special none graphic machines called UnlimitedMill, UnlimitedLathe,
HeidenUnlimited, and UnlimitedCutter. They are not actually unlimited but each axis
goes from -50,000 to 50,000 (inches or millimeters).
 
5.  File Browsers

When opening CNC files, machines, and SimCam files, a special kind of file browser will
be shown. The browser has file preview capabilities. For example, when you want to
open a CNC file, you can click on it to see a simplified preview of the tool paths.
 

 
The file browser has some buttons that can be helpful when dealing with files and
folders.
 
The star button in the top right corner lets you save the current folder as a favorite. This
makes it quick and easy to return to a folder you use often.
 
 
The button to the left of the favorites button lets you select the way files and folders are
presented in the dialog.
 

 
Under the preview panel, there is an information panel. When, for example, you are
browsing for machines and you are selecting one, you will see information before you
opening it.
 

 
We recommend that you spend a moment to familiarize yourself with the file browser as
it can be very helpful when you are looking for files in your storage.
 
 
6. View buttons

Using the view buttons below the 3D simulation screen, you can select what parts you
want to see as well as cut into workpieces. Note that you can turn on and off parts as
well as zoom, pan, rotate, and cut during the simulation.
 

 
To open the view panel, click on the button with the glasses.
 

 
On the left side of the panel, you can select what parts you want to see during and after
simulation. On the right side, you can select the workpiece style. The styles get their
look from the materials you have defined in the Inventory Browser. You will also find the
simulation speed controller on the right side of the panel. Use it to control the speed of
the simulation.
 
Note about machine limits: You can select to show the machine limits. They are
defined in each machine file. If your CNC program tries to go outside these limits the
simulator will alarm.
 
Using the button with the knife icon, you can open the workpiece cutting panel. Use the
sliders to cut the part from any side to see its interior.
 
 

Sample2 using a solid metal style.


 

Same part cut in half from the front


 
Some important notes about solid part simulation and speed:
 
The solid part simulation uses a lot of memory and computer power. The performance
will depend on your hardware. If the simulation moves too slow, use the fast forward
button to speed it up. For fastest simulation, check the Disable solid option in the view
panel.
 
Your computer and/or graphics card may just not be powerful enough for solid
simulations. In that case, you might have to turn solid simulation off altogether by
checking the Disable solid checkbox in the view panel. You will still be able to simulate
tool paths and machine movements.
 
There is also a Solid buffer resolution setting under the Program tab in the Settings
Editor. It can be set to low, medium, high or other. If the simulation runs slowly, set the
resolution to low. Vice versa, if you have a powerful computer (and/or graphics card)
that has no problems simulating complex solid parts, set the resolution to medium or
high. If you select the last option in the list, "Other", you can enter your own value for
the buffer resolution.
 

 
Solid simulation has some limitations: First note that using non flat milling tools will
create a much more complex surface, hence using up more computing power. For
faster solid simulations, use flat tip tools. Also, note that cutting can only be done from
the tip of the tool all the way up in Z. That limitation will be obvious if you try to cut a slot
in the side of a workpiece with a disk mill. The disk will act as if it was a flat end mill with
the diameter of the disk. This is true as long as you have the 2.5 solid buffer selected in
settings. If you are using the more advanced (and hence slower) full 3D buffer, side cuts
will be correctly shown. For more information see: Settings
 
The buffer containing the solid part has a limited resolution. If you zoom in too much the
workpiece will look rough. This is a compromise we did to not slow down the simulation
too much.
 
Also, note that if you set up more than one workpiece on the table, only the first one can
be viewed as solid. Another compromise to not overload the computer.
 
 

7. Code coloring

The CNC Editor will automatically color things that it recognizes. For example, all
recognized G-codes will be colored blue and all M-codes will be colored dark red, etc.
 

Special CNCSimulator Pro $-commands are colored gray, comments are cyan and
strings show up as lime-green.
 

 
Please note that very large programs, such as those used for 3D Printing, will not be
colored as it would slow down the editor.
 

 
8.  Programming help pop-ups
 
As the user writes CNC codes in the editor, pop-ups will be shown to assist coding. For
example, typing a G will show a list of available G-codes.
 

 
If you know what to write, you can just ignore the pop-up list and continue typing.
 
When you type a G-code that is on the list (recognized by the CNCSimulator Pro
interpreter), it will show a help tooltip window explaining the code.
 
 
You can also navigate up and down the list pressing the arrow keys on the keyboard.
 
Another way of selecting a code in the list is by clicking on it with the mouse to preview
its tooltip.
 

 
If you press Enter or Tab on the keyboard when a code is selected, it will be inserted in
the editor at the cursor location.
 
Besides G-codes, you can do the same with M-codes, $-codes and tools.
 
 
A list will also pop-up when you type the special CNCSimulator Pro-commands
$AddRegPart and $AddEmbeddedRegPart letting you select from a list of available
workpieces.
 

 
When you want to use a workpiece offset (G54-G59) the editor will help you by showing
the workpieces offset values after the code.
 

 
The whole idea behind the intelligent editor is to help the user be able to quickly find the
codes he/she wants to use.
 
Another way of assisting the programmer is by showing the tooltips while the mouse
hovers over a recognized code. Below, we have parked the mouse pointer over the M98
code.
 

 
For beginners, we strongly suggest opening our demonstration samples and then using
this function to figure out what codes are used and their function.
 
9.  Code regions

The special editor codes #region and #endregion are used to create collapsible regions
in the text. For example, SimCam will always output these commands for the initial
simulator special commands so that they could be easily hidden during a simulation.
 

If you click the little minus (-) sign in front of the #region command, the region will
collapse and be hidden.
 
 
Clicking the plus (+) sign in front of the three dots will expand the region.
Also, you can hover the mouse cursor over the three dots to see a preview of the region
without expanding it.
 

 
10.  Pause points

Pause points are small green dots in the editor margin that are used to make a pause
during the simulation. You add (or delete) a pause point by clicking on the margin in
front of the block where you want a pause.
 
 
To resume the simulation after it has reached a pause point, click on the play button,
the fast forward button, or the single-step button.

11. Tutorial 1 Milling


The purpose of this tutorial is to teach the basic concepts of how to use CNCSimulator Pro. We
are going to make a very simple part, milling a slot and drilling four holes on a 100 x 100 x 20
millimeter workpiece. For simplicity, we are going to ignore radius compensation and we work
only in absolute coordinates.
 
This is the part we are going to make:
 

 
First of all, we need to set millimeters as units and load an appropriate machine for our project.
 
From the main menu, select Settings and click on Settings.
 
Ensure that you have millimeters selected as this tutorial is made in millimeters.
 

 
Click OK to close the settings dialog.
 
Click File – Load Machine from the main menu or click the open machine button .
 
Double-click on the Milling folder.
 
In the dialog that shows, please deselect Open demo. Then click on the Milling Center
machine. Click the Open button.
 

 
Fine, now let's get started by defining our workpiece. Press F2 on the keyboard to open the
Inventory Browser.
 
Click on the Mill Workpieces tab at the top of the dialog.
 
Click on the green plus button to add a new workpiece.
 

 
In the Workpiece Name field, enter a name for your new workpiece. Let's call it “Tutorial1”.
Enter X, Y and Z size as: 100, 100 and 20.
Take a mental note of the workpiece index number. Here we did not have any workpieces before
in the registry, hence the index number became 1. In your case, the number could be different.
See the red arrow.
 
 
Ignore the rest of the settings and click OK to close the Inventory Browser.
 
Now we need to call up our new workpiece from the program. We do that by using the command
$AddRegPart, followed by the workpiece index number (we use 1)  and the table displacement
values.
 
You can also click the button to automatically insert the command at the
cursor in the editor.
 
We are going to put our new workpiece 30 millimeters from the machine zero in both X and Y.
The machine zero is placed near the lower left corner of the machine table and it is marked by a
cross symbol.
 

 
To call up our workpiece number one (or your index number if different) on X30 Y30 from the
machine zero, we write ($AddRegPart 1, 30, 30)
 
Now you can go ahead and click on the play button (simulation start) to see that your
workpiece shows up on the table.
In the lower toolbar, click this button to zoom in on the machine table.
 

 
At this moment, note that you can click on the simulation window with the left mouse button and
drag the mouse around to rotate the view. If you click with the right mouse button and drag, you
will pan the view. Also, please note that you can roll the mouse wheel to zoom in and out.
 
OK, let's get started with the actual CNC program!
 
As we moved the workpiece in on the machine table and away from the machine zero, our lower
left corner on the workpiece now is at X30 Y30. That is not very practical, so let's move the
programming zero point to X30 Y30 Z20. This will result in a zero point at the top of the (Z)
lower left corner (XY) of the workpiece.
 
We move the programming zero point by using the G-code G92. (This can also be done from a
zero point registry using G54 to G59, but that is out of the scope of this tutorial.)
 
Type G92 X30 Y30 Z20 in the editor.
 
Click on the play button again and note how the zero point moves to the corner of your
workpiece.
 
 
Now we need tools to mill the 10 mm wide slot and drill holes with the diameter of 10 mm.
 
Again, press F2 on the keyboard, to open the Inventory Browser (or select Settings – Inventory
Browser from the main menu).
 
In this tutorial we assume you have no previous custom made tools, if you do, please add these
two new tools at the end of your list and use the tool index you get.
 
Select My milling tools and click on the button with the green plus icon, the Add button.
 
First, we will add the tool to mill the slot. Select a flat tool tip, enter 10 as diameter and 50 as
length. Enter the name of the tool “Tutorial1 flat mill”. Ignore all other settings and click OK.
 

 
In our case, this new tool will get tool index number 1 (take note of yours).
 
Now we repeat the procedure adding the drilling tool. Click the Add button again.
 
This time, select a pointed tool tip and enter diameter 10, length 50 and tip angle 80 degrees.
Name it “Tutorial1 drill”. Click OK.
 

 
Click on the OK button to close the Tool Browser.
 
Congratulations! Now we have a workpiece and tools and can start programming the rest of our
part.
 
To call up our new milling tool, we use T1 (or your tool index number) followed by M06 to tell
the virtual machine to go to its tool change position and execute the tool change.
T1 M06
 

 
Next, let us move the tool to the start position. We have decided to use the lower left corner of
the slot as the start where we will drill down into the material.
 
We use G-code G00 to move with rapid speed to the position stopping 2 mm over the workpiece.
G00 X15 Y15 Z2
 
Now, press play to verify that the positioning works.
 

 
We now enter the G-code G01 for feed movement down to the cutting depth. We also need to
start the spindle (M03) and set the Feed rate (F) and spindle RPM (S).
G01 Z-5 F250 S2000 M03
 

 
Now we will move the mill to the start-point of the arc. There is no need to type G01 in this
block as the code is modal, meaning it will remember the G01 code from the previous block
(“block” = line).
Y70
 
From now on, feel free to click the play button at any time to check the simulation.
 
Next, let's program the clockwise arc movement. To do so, we use the G02 code, followed by the
X/Y coordinates of the endpoint and the I/J coordinates of the relative center point (I stands for
incremental distance from starting point to center in X, and J is the same in Y).
G02 X30 Y85 I15 J0
 
 
Great! Let's enter the rest of the blocks to finish the slot.
G01 X85
Y15
X15
 
How about that? We are back to where we started. Let's go up in Z to a safe position and then
change tool for the drilling operation.
G00 Z2
T2 M06
 

 
Make sure you use your tool index after T for the drilling tool we created.
 
Now we can come back from the tool change position and put the drill over the first hole.
G00 X30 Y30 Z2
 
Next, we will start a drill cycle. We only need to start it and then it will drill on each position we
program until we tell it to stop. For this, we use a common drilling canned cycle G-code called
G81. We tell the cycle to drill to a total depth of 15 mm and a start depth of 1 mm above the
workpiece. As we have changed tool, we need to start the spindle again (M03). This time, let us
also use coolant water (M08) to not overheat the tool.
G81 Z-15 R1 M03 M08
 
Now we can just position over each hole center and the drilling will start automatically.
Y70
X70
Y30
 
Next we need to end the drilling cycle using the G80 code.
G80
 
Finally, we go up in Z and write M30 to end the program.
Z50
M30
 

 
Congratulations! You have created your first CNC program in the famous CNCSimulator Pro
software!
 
The complete program:
 
$AddRegPart 1, 30, 30
 
G92 X30 Y30 Z20
T1 M06
G00 X15 Y15 Z2
G01 Z-5 F250 S2000 M03
Y70
G02 X30 Y85 I15 J0
G01 X85
Y15
X15
G00 Z2
T2 M06
G00 X30 Y30 Z2
G81 Z-15 R1 M03 M08
Y70
X70
Y30
G80
Z50
M30
 
 
12. Tutorial 2 Turning
 
The purpose of this tutorial is to teach the basic concepts of how to use CNCSimulator Pro
turning. We are going to make a very simple part, taking a few rough cuts, fine cuts, and drill a
hole.
 
This is the part we are going to make:
 

 
This tutorial is made in millimeters so the first thing we have to do is to ensure we have
millimeters set as units in the program settings. Click Settings – Settings from the main menu.
 

 
While we are at it, set all other settings like in the picture above. Click OK.
 
Now what we have to do is to load a machine for the project. Click on the Open Machine button
to show the Select Machine dialog. You can also click File – Load Machine from the main
menu.
 

 
Double-click the Turning folder.
 

 
Uncheck the Open demo checkbox and click on the Turning Center machine, then click the
Open button.
 
This is how your CNCSimulator Pro window should look like now.
 

 
OK, now we need to create a workpiece for your project. Press F2 to open the Inventory Browser
where we keep all our tools, workpieces, materials, and offsets.
 
Click the Lathe Workpieces tab.
 

 
If you have not previously created any workpieces, this is what you will see.
 

 
Click on the Add button to add a new workpiece.
 
Enter 50 for diameter, 100 for length, the name for the workpiece, and ignore all other settings.
 
 
As you can see on the blue bar below the workpiece picture, our index for this workpiece is one.
Yours might be another index if you already had workpieces stored.
 
OK, great! Now, let's start writing the CNC program!
 
We start with a special CNCSimulator Pro command to put the workpiece we just created in the
chuck. It is called $AddRegPart. You can either type in the command by hand, followed by the
index number for the workpiece, or take a shortcut by clicking the Insert at cursor button. This
button will automatically put the command in the editor.
 

 
Put the cursor at the end of the first line and press enter. This is to ensure that the next command
we insert will end up on a new line.
Type in $AddRegPart 1 or click "Insert at cursor".
 
The next step is to select a tool to use for our rough cuts.
 
Press F2 again to open the Inventory Browser. This time we are going to stay on the first page
(Tools). Click on the Embedded lathe tools option.
 
 
We are going to use one of the fixed embedded tools that come with the CNCSimulator Pro.
Actually, we are going to use the first one, so you could just go ahead and click the Insert at
cursor button again.
 

 
This is what you should have in the editor at the moment:
 

 
Normally, to select a tool, you use only the code letter T but as this is an embedded tool, we use
ET as in “Embedded Tool”. If you create your own tools later, you will use only T for tool
selections.
Note that ET is a simulator specific code and it is not used in real machines.
 
Besides selecting the tool, we need to execute the actual tool change by putting the code M06
after the tool selection. Note, when you press M (or G or any other recognized code), a list of
available codes will pop-up.
 
 
Either, type 6 or select M06 from the list by using the mouse or the arrow keys on the keyboard.
 
OK, by now we are all set to start cutting the workpiece.
 
Click the Reset View button to zoom in on the workpiece.
 

 
Zoom in a bit further by clicking on the 3D view and roll the mouse wheel away from you.
 
Click the Start Simulation button to execute the commands we have entered so far.
 

 
Now, this is what the 3D view should look like:
 

 
As you can see, the workpiece that we made and the tool we selected, are in place.
 
Let's move the tool in position for the first rough cut by using the G00 code.
 
Important! CNCSimulator Pro does automatically put the zero point at the right plane of the
jaws. The distance from the plane to the spindle is 23 millimeters. That means that the right end
of our 100 mm long workpiece is at (100-23) 77, in the Z-axis. This rule goes for all lathes in
CNCSimulator Pro. Always take the 23 millimeters into account!
 

 
We want to take away 10 millimeters from the diameter per cut (5 mm material), so we should
put the tool on X40 as our initial diameter is 50. Let us also put the tool on Z 80, so we have
some space (3 mm) between the tool and the workpiece end plane.
 
Type G00 X40 Z80 and press Enter.
 
Fine, now let's take the first actual cut.
 
Type G01 Z50 F250 S1000 M04 M08 and press Enter.
 
If you move the mouse over the codes in the block above, you will see tooltip windows
explaining what they do.
 
 
OK, now we back out the tool a bit before going with fast traverse back to Z80.
 
Type X44 Z52 and press Enter.
 
Note that we did not have to write G01 again as it is already activated. The code is modal.
 
To help us see clearly how the tool moves, we can turn on the toolpath display. Click on the
glasses button and check the Feeds and Fast Traverses checkboxes.
 

 
Now if you simulate, you will see feed movements (G01-G03) in green and fast traverses (G00)
in red.
 
We continue by going back to 80 in the Z-axis with fast traverse.
 
Type G00 Z80 and press Enter.
 
We then go down to diameter 30.
 
Type X30 and press Enter.
 
Type G01 Z60 and press Enter.
 
Again, we back off a little.
 
Type X34 Z62 and press Enter.
 
Now, we need another tool for the fine cut. Press F2 to open the inventory browser again, then
select Embedded lathe tools and click the blue right arrow to go to the second tool.
 
Click the Insert at cursor button.
 

 
Without pressing Enter, write M06 to execute the tool change, then press Enter.
 
After a tool change, the tool is at the tool change position of the machine and we need to go back
to the workpiece.
 
Type G00 X28 Z80 and press Enter.
 
Enter the following blocks to finish the fine cut:
 
G01 Z59
X38
Z49
X45
X50 Z45
 
This is how your program should look by now:
 
 

 
Back off again as we did earlier.
 
Type X54 Z47 and press Enter.
 
Time to select a drilling tool to drill  the hole.
 
Press F2 on the keyboard, click Embedded lathe tools and browse to tool number 17 (drill
diameter 10 mm).
 
Click the Insert at cursor button.
 
Enter M06 and press Enter.
 
We will now take the tool back from the tool change position and place it in the center of the
workpiece.
 
Type G00 X0 Z80 and press Enter.
 
We are going to use a canned drilling cycle to make the hole.
 
Type G81 Z60 R78 and press Enter.
 
Type G00 X100 Z200 and press Enter.
 
Type M30 to end the program and press Enter.
 
Excellent! We are done. Simulate the program and then click the cutting (knife) button.
 

 
Check the Show inside checkbox.
 
 
The final program:
 

 
13. Find and Replace

To open the Find and Replace dialog, press CTRL – F on the keyboard or select Edit –
Find and Replace from the main menu.
 
 
To simply search and locate a text, type it in the "Find what" textbox and click the Find
Next button.
 
There are three Find options that you can select as well.
 
Mach case – if this option is checked, the search function will only find the text with the
exact same case. For example, if you write “G90” in the box, the text “g90” will not be
found.
 
Match whole word – if this option is checked, the search function will only find whole
words that match your search string. For example, if you enter “G9”, the code “G90” will
not be found.
 
Search hidden text – if this option is checked, the search will include collapsed
regions.
 
In addition to finding text in the CNC program, you can replace it too. Click on the
Replace tab at the top of the dialog to show the replace page.
 
 
Enter the text you want to search for and the replace text. To replace single instances of
the text, click on the Find Next button followed by the Replace button.
 
To replace all instances of the search word, click on the Replace All button.

 
14. Automatic block numbering

To open the block numbering dialog, press CTRL – B on the keyboard or select Edit –
Block Numbers from the main menu.
 
 
To add (or renumber) block numbers to your program, check the Block Numbers
option.
 
Enter Start Number, Increment and click OK.
 

 
If you delete or add blocks to your program, you may want to recreate the block
numbering. Just repeat the steps above to do so.
 
You can just as easily take away the block numbers by opening the Block Numbers
dialog and deselect the Block Numbers option and click OK.
 

 
Normally, there is no need to change the format option but if you want them in another
format than the default format, it could be done by entering formatting codes (See String
Formatting Codes).
 

 
15. Comments in code
There are two ways to make comments in the CNC programs. The most common one is
to put the comments inside parentheses.
 

 
CNC codes inside the parentheses will be ignored by the CNCSimulator Pro interpreter
but it is important to note that CNCSimulator Pro specific $-commands will not be
ignored.
 

 
Another type of comment is the semicolon comment. It is commonly used to comment
out whole sections of blocks.
 

 
To comment out several blocks, select them in the editor (on the keyboard, hold down
shift and press the up and down arrows to select or drag the mouse holding down the
left mouse button).
 

Selected blocks will be shown in gray.


 
Then from the Edit menu, select Comment out selection.
 

 
To uncomment blocks, select them as above and click Uncomment selection from the
Edit menu.
 
16.  Create CNC Headers

You can insert a header in your CNC program by using the "Create CNC Header"
function. To open the Create CNC Header dialog, click Tools – Create CNC Header
from the main menu.
 
 
Fill out the fields with the information you want in the header and click OK.
 
The header will be automatically created for you.
 

 
 
17. G-codes

These are the default standard codes used by default by our virtual machines. Please
note that customized machines may have other codes and formats. The following tables
will give a brief overview of the various G, M, and other codes recognized by the
CNCSimulator Pro interpreter. In the Format column, you will see the format expected
by the program. If a code is written within brackets like this [X#], it means that the code
is optional and can be omitted if not needed. The # sign means that CNCSimulator Pro
expects a number and the $ sign means that it is expecting a text string within quotation
marks.
 
Let's show an example:
G12[X#][Y#]Z# R# Q# S# SA# AS# RA# H#
 
This means that the code G12 accepts X and Y coordinates but they are not obligatory
and can be omitted. On the other hand, you must specify the Z,R,Q,S,SA,AS,RA, and H
codes to avoid an alarm at runtime.
 
G-code Explanation Format Example Machine type
     
G00 Go rapidly (with G00 [X#][Y#][Z#] G00 Z100 All machines
maximum traverse rate)      
to the X/Y/Z position.
This code is used for
positioning and not for
actual machining.
 
G01 Travel in a straight line G01 [X#][Y#][Z#] G01 X2.5 All machines
using the programmed [F#] Y4.1 F200  
feed rate (F). This code    
is used for machining.
 
G02 Circular/Helical G02[X#][Y#][Z#] G02 X10 All machines
XY-machines Interpolation clockwise. It [I#][J#][K#][R#][F#] Y10 I10 J0  
causes a clockwise   F200
circular movement at the  
programmed feed rate
(F). The motion can be 2-
dimensional (flat) or 3-
dimensional (helical).
The default plane of the
Lathe circular movement is the
XY-plane (G17) but other
planes can be used as
well (see G17-G19). The
center of the arc or circle
is programmed using the
I, J and K letters (R can
also be used).
 
G03 Exactly like G02 but the G03[X#][Y#][Z#] G03 X10 All machines
XY-machines circular motion is going [I#][J#][K#][R#][F#] Y10 I10 J0  
counterclockwise.   F200
   

Lathe

G04 Dwell in milliseconds. G04 P# G04 P2000 All machines


This will keep the axes   (Two  
unmoving for the period seconds
of time specified by the P delay)
number.  
 
G09 Will force the machine to G09   All machines
  do a full stop before    
continuing with the next
move. This is a non-
modal variant of G61 and
hence does not have to
be canceled.
 
G12 Circular drilling canned G12[X#][Y#]Z# G12 X0 Y0 Milling machines
cycle. Used to drill holes R# Q# S# SA# Z-20 R2 Q5 only
around the contour of a AS# RA# H# SA0 AS36  
circle. R is the starting   RA30 H10
plane and Z is total drill  
depth for each hole. Q is
incremental depth (peck).
SA is circle start angle
(angle of the first hole
too) and AS is the angle
between holes. RA is
circle radius and H
specifies the number of
holes to drill.
 
G15 Cancel polar coordinates G15 G15 Milling machines
mode. See example file only
25.
G16 Activated polar G16 G16 Milling machines
coordinates mode. See only
example file 25.
G17 Selects the XY plane for G17 G17 Milling machines
circular movements (see     only
G02 and G03).  
 

G18 Selects the XZ plane for G18 G18 Milling machines


circular movements (see     only
G02 and G03)  
   
 
 

G19 Selects the YZ plane for G19 G19 Milling machines


circular movements (see     only
G02 and G03).  
 

G20 Enforce the use of inches G20 G20 All machines


  units.      
 
G21 Enforce the use of G21 G21 All machines
  millimeter units.      
   
G28 Return home command. G28[X#][Y#][Z#] G28 Z10 Milling and turning
  This command will first     machines only
go to the programmed  
position X/Y/Z and then
to the Xmin Ymax Zmax
of the machine axes. It
can be a convenient way
to end a program putting
the machine table in a
position to change
workpiece.
 
G40 Cancel cutter G40 G40 All machines
compensation previously More info except the 3D
activated by G41 or G42.   Printer
   

 
G41 Activates left side cutter G41[D#][P#] G41 All machines
compensation (or nose   More info except the 3D
radius compensation in a   Printer
lathe).  
 
G42 Activates right side cutter G42[D#][P#] G42 All machines
compensation (or nose   More info except the 3D
radius compensation in a   Printer
lathe).  
 

G43 Activates tool length G43[H#][P#][Z#] G43 H2 Z2 Milling machines


  compensation. (Optional,   More info only
if not used, automatic    
tool length compensation
will be used).
 

G49 Cancel tool length G49 G49 Milling machines


  compensation (activated     only
by G43).    
 
G52 Local zero shift. This G52 [X#][Y#][Z#] G52 X50 Milling machines
code is used to locally Y50 only
shift the zeropoint from
the main work offset. To
reset the shift, use G52
X0 Y0 Z0.
G53 Move in absolute non- G53 [X#][Y#][Z#] G53 X0 Y0 All machines
  compensated   Z100  
coordinates.  
 

G54-G59 Fixture (work) offsets. A G54 G00 G54 All machines


  typical use of these G- X0 Y0 Z3  
codes is to establish a  
local coordinate system
for each workpiece when
using multiple ones. You
need to setup the offsets
in the Zero Points Data
table in the Inventory
Browser (F2).
G54 corresponds to
offset registry index 0,
G55 to index number 1
etc…
 
G54.1 Fixture (work) offsets. A G54.1 P# (0-99) G54.1 P10 All machines
  typical use of these G-   (Use work  
codes is to establish a offset 10)
local coordinate system  
for each workpiece when
using multiple ones. You
need to setup the offsets
in the Zero Points Data
table in the Inventory
Browser (F2).
G54.1 uses letter P to
specify the offset registry
index.
 
G61 Exact stop mode. G61 G61 All machines
         
 
G64 Normal stop modeG64 G64 All machines
  (cancels G61).      
   
G65 Direct call of a macro. PG65 P# A... B... G65 P1005 All machines
  is the macro number to C... etc. A180  
be called. For more    
information, see Macro
programming.
 
G66 Initiates modal calling of G66 P# A... B... G66 P7000 All machines
  a macro defined by P. C... etc.    
The macro will not be  
called in the G66 block
but rather after each tool
move following the block.
Cancel with G67. For
more information, see
Macro programming.
 
G67 Cancels any modal G67 G67 All machines
  macro call initiated by    
G66. For more
information, see Macro
programming.
 
G68 Activates rotation of the G68 X(center in X) G68 X50 Milling machines
  coordinate system. Y(center in Y) Y50 R45  
  R(angle)
Two syntaxes are  
allowed. or
   
Use G69 to cancel the G68 A(center in X)
rotation. B(center in Y)
  R(angle)
 

G69 Cancel the rotation of the G69 G69 Milling machines


  coordinate system.    
 
G70 Finishing Cycle. G70 P# Q# G70  P100 Turning machines
      Q250 only
After roughing, finishing    
can be performed with
this cycle. P is the first
block of finishing contour
and Q is the last block.
 
For more information
see: G71 Rough Turning
Cycle and G70 Finishing
Cycle.
 
G71 Rough Turning Cycle G71 ... N10 G71 Turning  machines
      U2 R1 only
Two block format N20 G71  
Roughing cycle. P8 Q9 U0.4
  W0
For more information  
see: G71 Rough Turning  
Cycle and G70 Finishing
Cycle.
 
G73 Peck drilling canned G73 [X#][Y#][Z#] G73 Z-20 Milling  machines
cycle. The cycle is [R#][Q#][P#] R1 Q1 only
intended for deep drilling   P100  
or chip breaking milling  
operations. The cycle
retracts the tool to break
chips. Code letter Q is
used for peck size. R is
the starting plane and Z
is total depth. Parameter
P is used for dwell at
each peck. Please note
that at the end of the
cycle, the return position
in Z is controlled by G98
and G99.
 
G74-G75 Generic G74 [X#][Y#][Z#] G74 Z-20 Milling and turning
  drilling/boring/tapping [R#] R1 machines only
canned cycle. These are      
used in a generic way to
create compatibility with
many common CNC
controllers on the market.
They will bring the tool to
the programmed Z depth.
If R is programmed it will
be used as the start
plane, if not, the current
Z position will be used as
the start plane. All other
parameters will be
ignored.
 
G76 Generic G76 [X#][Y#][Z#] G76 Z-20 Milling machines
  drilling/boring/tapping [R#] R1 only
canned cycle. See G74-    
G75 above.
 
G76 Threading Cycle G76 G76 Turning machines
        only
For more information    
see: G76 Lathe
Threading Cycle
 
G80 Cancels any canned G80 G80 Milling and turning
  cycle. Please note that     machines only
G00 – G03 also cancels    
canned cycles.
 
G81 Basic drilling canned G81 [X#][Y#][Z#] G81 Z-6 R2 Milling and turning
cycle. R is the starting [R#]   machines only
plane and Z is total    
depth. Please note that
at the end of the cycle,
the return position in Z is
controlled by G98 and
G99.
 

G82-G89 Generic G82 [X#][Y#][Z#] G82 Z-20 Milling and turning


  drilling/boring/tapping [R#] R1 machines only
canned cycle. Same as      
G74-G76 above.
 
G90 Absolute programming G90 G90 G00 All machines
  mode. Distances given   X10 Y10  
will move the tool relative  
to an absolute zero.
 

G91 Incremental G91 G91 G00 All machines


  programming mode.   Z5  
Distances given will  
move the tool relative to
the current position of the
tool.
 
G92 Use to reposition the G92[X#][Y#][Z#] G92 X20 All machines
  origin point (zero point).   Y20 Z10  
   
G94 Set feed in millimeter or G94 G94 Milling and turning
  inch per minute.     machines only
       
G95 Set feed per revolution G95 G95 Milling and turning
  mode.     machines only
     
G96 Constant surface speed G96[S#] G96 S300 Turning machines
  control.      
 
G97 Cancel constant surface G97 G97 Turning machines
  speed control.      
   
G98 Initial level returns at the G98 G81 G98  Milling and turning
end of a canned cycle.   Z-7 R2 machines only
   
G99 R level return at the end G99 G81 G99  Milling and turning
of a canned cycle.   Z-7 R2 machines only
     

18. M-codes

These are the default standard codes used by default by our virtual machines. Please
note that customized machines may have other codes and formats.
 
M-code Explanation Format Example Machine type

M00 Unconditional stop M00 M00 All machines


(pause). The
execution of the CNC
program will pause.
Click start or play to
continue.

M01 Optional stop (pause). M01 M01 All machines


Will pause the
execution of the CNC
program if the
“Op.Stop” switch on
 
the virtual CNC
Controller is activated.
Click start or play to
continue.

M02 Program end. The M02 M02 All machines


simulation will stop.

M03 Start of spindle M03 M03 S2500 Milling and


clockwise. The turning
rotation speed is machines only
controlled by the S
code letter.
M04 Start of spindle M04 M04 S2500 Milling and
counterclockwise. The turning
rotation speed is machines only
controlled by the S
code letter.
M05 Spindle stop. M05 M05 Milling and
turning
machines only

M06 Execute a tool M06 T17 M06 Milling and


change. The number turning
of the tool has to be machines only
preselected with the T
code letter.
M08 Turn on coolant. M08 M08 Milling and
turning
machines only

M09 Turn off coolant. M09 M09 Milling and


turning
machines only

M17 Return from M17 M17 All machines


subroutine or More info
subprogram.

M20 Open machine doors. M20 M20 All machines


with doors

M21 Close machine doors. M21 M21 All machines


with doors

M30 Program end. The M30 M30 All machines


simulation will stop.

M97 and M98 Call subprogram. Use M98 P# L# M98 P1000 All machines
P for subprogram L1
number and L for the More info
number of repetitions.
M99 Return from a macro, M99 M99 All machines
subroutine or More info
subprogram.

 
19.   G71 Rough Turning Cycle and G70 Finishing Cycle

Let's start with G71. This cycle is programmed using two blocks.
Example:
N10 G71 U2 R1
N20 G71 P8 Q9 U0.4 W0
The parameters of the first block are:
U: The depth of cut during the cycle.
R: The retraction height for each completed cut.
The parameters of the second block are:
P: Start block number for the contour.
Q: End block number for the contour.
U: Finishing allowance in the X-axis.
W: Finishing allowance in the Z-axis.
If you load the turning center machine and then open the demo files, there is an
example called: Sample3_G70_G71_units.CNC that you can try to see the cycle in
action.
 
The G70 block at the end of the example is the Finishing Cycle. It simply repeats the
blocks used in the G71 cycle but instead of doing rough cuts it does a contour cut
removing the material left from the finishing allowances. Only horizontal cutting
operations (internal and external) are supported.

G71 U1.0 R1.0;


G71 P100 Q200 U0.2 W.05 F0.2;
N100 G00 X19.0;
G01 G42 Z0.0 F0.2;
X20.0 Z-0.5;
Z-20.0;
X40.0 Z-30.0;
Z-65.0 ,R5.0;
X60.0;
N200 G40 X70.0 Z5.0 F200;

Simulator CNC
$AddRegPart 1
ET1 M06
G00 X60. Z90.
G01 Z78. M03 M08 S1000 F200
G71 U1.0 R.10
G71 P100 Q200 U0.1 W0.02 F.2
N100 G00 X20.
G01 G42 X18. Z77. F0.2
X20. Z75.
Z57.
X40. Z47.
Z25.
G02 X50. Z20. R5.
G01 X60. Z10.
N200 G40 X70. Z90.
G70 P100 Q200
M05
M30

$AddRegPart 1
T1 M06
G00 X60. Z 90.
G01 X60. Z78. M03 S1000 F200
G71 U1.0 R1.0
G71 P100 Q200 U 0.1 W0.1 F200
N100 G00 X20.
G01 G42 X18. Z77. F200
X20.Z75.
X20.Z57.
X40. Z.47.
Z25.
G02 X50. Z20. R5.
G01 X60. Z10.
N200 G40 X70. Z90.
G70 P100 Q200
T15 M06
G01 X0. Z80. F200
G81 X0. Z40. F50
G01 X0. Z90. F200
M05
M30
20. G75 Grooving cycle

This cycle cuts internal or external grooves. The cycle is programmed using a two block
format.
 

 
The parameter for the first block is:
 
R: Retract amount. The distance to retract for each peck.
 
The parameters for the second block are:
 
X: End position for the groove in the X-axis.
 
Z: End position in the Z-axis.
 
P: Peck depth for each cut in the X-axis (thousands).
 
Q: Stepping in the Z-axis (thousands).
 

$AddRegPart 2
ET1 M06
G00X90. Z165.
G01 X80. Z163. M03 M08 S1000 F200
G71 U1.0 R.20
G71 P100 Q200 U0.1 W0.02 F.2
N100 G00 X80. Z163.
G01 x40. Z163.
G01 X44. Z161.
G01 X44. Z133.
G01 X38. Z130.
G01 X38. Z123.
G02 X44. Z120. R3.
G01 X70. Z93.
G01 X70. Z63.
G01 X80.Z33.
N200 G40 G00 X81.Z164.
G70 P100 Q200
G00 X81. Z166.
M05
M30

21. G76 Threading Cycle

Threads can be done externally or internally with this two block threading canned cycle.
Here is a brief explanation of the cycle and its parameters.
 

The parameters of the first block are:


 
P: This parameter is composed of three values that control the thread behavior.
 
In the example above we have P010060. Let's take the numbers apart.
 
01: Number of spring cuts. This means when done with the thread cuts, the machine
can be programmed to take a number of extra cuts at the same depth to smooth the
final thread.
 
00: Run out angle. The angle used to leave the thread.
 
60: Infeed angle. The angle used when entering the thread.
 
Q: Depth of each normal cut. This value is given in hundreds so the Q500 above means
0.5.
 
R: Depth of last or finish cut.
 
The parameters of the second block are:
 
X: End value in the X-axis.
 
Z: End value in the Z-axis.
 
P: Thread depth (radial value).
 
Q: Depth of first cut.
 
F: Thread pitch.
 
Note! CNCSimulator Pro simplifies the threading process by ignoring some of the
parameters, as for the simulation, it is not important to take every parameter literary.
The important parameters for the simulator are the following:
 
The Q parameter in the first block tells the simulator how much to take for each cut.
 
The X and Z values of the second block tell the simulator were to end the thread.
 
The F parameter of the second block tells the simulator the pitch of the thread.

$AddRegPart 2
ET1 M06
G00X90. Z165.
G01 X80. Z163. M03 M08 S1000 F200
G71 U1.0 R.20
G71 P100 Q200 U0.1 W0.02 F.2
N100 G00 X80. Z163.
G01 x40. Z163.
G01 X44. Z161.
G01 X44. Z133.
G01 X38. Z130.
G01 X38. Z123.
G02 X44. Z120. R3.
G01 X70. Z93.
G01 X70. Z63.
G01 X80.Z33.
N200 G40 G00 X81.Z164.
G70 P100 Q200
G00 X81. Z166.
M05
ET25 M06
G97 S600 M03
G00 X44. Z163.
N40 G76 P010060 Q100 R100
N50 G76 X41. Z131. P100 Q200 F1.5
G00 X81. Z165.
M30

22. Fanuc G75 Grooving Cycle CNC Program Example

I have posted about Fanuc G75 Grooving Cycle. The Fanuc G75 grooving cycle has
multiple parameters, which can be set according to your needs. In this post here is a
cnc program example for the G75 Fanuc grooving cycle. Although it is a simple cnc
program example for grooving, but this cnc program can be easily altered to your
needs.
The fanuc G75 grooving cycle is briefly described in this article Fanuc G75 Grooving
Cycle, so here is the cnc program example and some explanation of the cnc program.
CNC Programming Example of Fanuc G75 Grooving Cycle

Fanuc G75 Grooving Cycle CNC Program Example


N10 T0202
N20 G92 S500 M42
N30 G97 S400 M03
N40 G00 X110 Z0 M08
N50 G01 Z-22 F0.5
N60 G75 R1
N70 G75 X90 Z-60 P2000 Q3000 R0 F0.1
N80 G00 X120 Z100
N90 M30
$AddRegPart 1
T1 M06
G00 X60. Z 90.
G01 X60. Z78. M03 S1000 F200
G71 U1.0 R1.0
G71 P100 Q200 U 0.1 W0.1 F200
N100 G00 X20.
G01 G42 X18. Z77. F200
X20.Z75.
X20.Z57.
X40. Z.47.
Z25.
G02 X50. Z20. R5.
G01 X60. Z10.
N200 G40 X70. Z90.
G70 P100 Q200
T15 M06
G01 X0. Z80. F200
G81 X0. Z40. F50
G01 X0. Z90. F200
T9 M06
G01 X60. Z10.
G75. R1.
G75 X40. Z5. P2000 Q3000 R0 F0.1
M30

Note: The grooving tool is 4mm wide, so I started from z-22.


Every time the grooving tool will take 2mm (P2000) cut in x-axis, and it will retract 1mm
(Pecking, First R1)
After a groove in x-axis is complete it will start the next groove by moving the grooving
tool by 3mm (Q3000) in z-axis, and it will repeat it.

Contents
 Explanation of Parameters of Fanuc G75 Grooving Cycle
 G75 Canned Cycle Grooving CNC Programming Example
Explanation of Parameters of Fanuc G75 Grooving Cycle
N10 G75 R
N20 G75 X Z P Q R
G75 First CNC Programming Block
R = Return amount
G75 Second CNC Programming Block
X = Groove Depth.
Z = Last groove position in z-axis.
P = Peck increment in x-axis
Q = Stepping in z-axis.
R = Relief amount at end of the cut.
G75 Blok Pemrograman CNC Pertama
R = Jumlah pengembalian
G75 Blok Pemrograman CNC Kedua
X = Kedalaman Alur.
Z = Posisi alur terakhir pada sumbu z.
P = Peck increment dalam sumbu x
Q = Menginjak sumbu z.
R = Jumlah bantuan di akhir pemotongan.

G75 Canned Cycle Grooving CNC Programming Example

G75 Canned Cycle Grooving CNC Programming Example


N10 G50 S500 T0100
N20 G97 S400 M03
N30 G00 X90.0 Z1.0 T0101
N40 X82.0 Z-60.0
N50 G75 R1.0
N60 G75 X60.0 Z-20.0 P3000 Q20000 F0.1
N70 G00 X90.0
N80 X200.0 Z200.0 T0100
N90 M30
$AddRegPart 2
ET1 M06
G00X90. Z165.
G01 X80. Z163. M03 M08 S1000 F200
G71 U1.0 R.20
G71 P100 Q200 U0.1 W0.02 F.2
N100 G00 X80. Z163.
G01 x40. Z163.
G01 X44. Z161.
G01 X44. Z133.
G01 X38. Z130.
G01 X38. Z123.
G02 X44. Z120. R3.
G01 X70. Z93.
G01 X70. Z63.
G01 X80.Z33.
N200 G40 G00 X81.Z164.
G70 P100 Q200
G00 X81. Z166.
M05
ET25 M06
G97 S600 M03
G00 X44. Z163.
N40 G76 P010060 Q100 R100
N50 G76 X41. Z131. P0.75 Q200 F1.5
G00 X81. Z165.
M05
ET8 M06
G00 X71. Z80.
G97 S400 M03
G75 R2
G75 X60. Z60.P1000 Q1500 R0 F0.1
G00 X85. Z170.
ET15 M06
G97 S1500 M03
G00 X0.0 Z167
G81 X0.0 Z140.F100 R300
G01 X0.0 Z170. F200
M30

23. Threading Cycle Example

Example of the G76 G code G76 Thread Cycle a CNC Programming Example.


Fanuc G76 Threading Cycle Explanation
N5 G76 P010060 Q100 R0.05
N6 G76 X30 Z-20 P1024 Q200 F2
First block of the G76 Threading cycle
G76 : G code for threading cycle.
P : P actually consists of multiple values which control the thread behavior,
o 01 : Number of spring passes or spring cuts.
o 00 : Thread run out at 45 degree
o 60 : Flank angle or Infeed angle

Q : Depth of normal cut ( these values are given in hundreds, so the depth of cut will be
0.1 ).
R : Depth of Last or Finish cut
Second block of the G76 Threading cycle
G76 : G code of the threading cycle.
X : The end value in x-axis.
Z : The end value in z-axis.
P : Thread depth ( as radius value ).
Q : Depth of first cut.
F : Thread Pitch
R : Thread Taper

$AddRegPart 2
ET1 M06
G00X90. Z165.
G01 X80. Z163. M03 M08 S1000 F200
G71 U1.0 R.20
G71 P100 Q200 U0.1 W0.05 F.5
N100 G41 G00 X80. Z163.
G01 x40. Z163.
G01 X42. Z162.
G01 X42. Z133.
G01 X39.5 Z130.
G01 X39.5 Z123.
G02 X45.5 Z120. R3.
G01 X70. Z93.
G01 X70. Z63.
G01 X80. Z33.
N200 G40 G00 X81. Z164.
G70 P100 Q200
G00 X81. Z166.
M05
T25 M06
G97 S1000 M03
G00 X42. Z164.
N40 G76 P010060 Q100 R100
N50 G76 X40.161 Z131. P0.75 Q200 F1.5
G00 X81. Z165.
M05
ET8 M06
G00 X71. Z80.
G97 S400 M03
G75 R2
G75 X60. Z60. P1000 Q1500 R0 F0.1
G00 X85. Z170.
ET15 M06
G97 S1500 M03
G00 X0.0 Z167
G81 X0.0 Z125. F100 R300
G01 X0.0 Z170. F200
T16 M06
G97 S1500 M03
G00 X0.0 Z167
N40 G74 R1
N50 G74 Z124. Q300 F0.1
G01 X0.0 Z170. F200
T19 M06
G97 S1500 M03
G00 X0.0 Z167
N40 G74 R1
N50 G74 Z120. Q300 F0.1
G01 X0.0 Z170. F200
T11 M06
G00 X18. Z165. S2000 M03
G01 X18. Z163. F100
G01 X18. Z163. F200
G01 X20. Z163. F200
G01 X19. Z160. F200
G01 X19. Z133. F100
G01 X20. Z130. F100
G01 X18. Z 132. F200
G00 X18. Z167.
T13 M06
G00 X18. Z168.
G01 X18. Z130.
G01 X22. Z130. S700 F50
G01 X18. Z130. S1000 F100
G01 X18. Z128.
G01 X22. Z128. S700 F50
G01 X18. Z128. F200
G01 X18. Z170. S100 F300
T26 M06
G97 S1000 M03
G00 X19. Z165.
N40 G76 P010060 Q100 R100
N50 G76 X20.839 Z130. P0.75 Q200 F1.5
G00 X81. Z165.
T9 M06
G00 X81. Z24.
G97 S400 M03
G75 R2
G75 X40. Z20.P1000 Q1500 R0 F0.1
G00 X85. Z170.
M30

24. $-commands and regions

These are the default standard codes used by default by our virtual machines. Please
note that customized machines may have other codes and formats.
 
The $-commands are special simulation commands for controlling the various aspects
of the simulation. They have nothing to do with CNC codes and should not be
transferred to a real CNC controller. $-commands can be put within parenthesis and
will still be read by the simulator. Blocks of $-commands can be hidden from the CNC
code by encapsulating them in a region making the block collapsible.
 

 
Do you notice the little - (minus) sign before the region command at the first line? If
you click it, the region will be collapsed hiding the block of $-commands.
 
A collapsed region will show three dots and a + (plus) sign. If you click the plus sign,
the region will expand.
 

You can see what a collapsed region hides without expanding it by hovering the
mouse pointer over it.
 
 
When you open a CNC program from the disk, it always loads with its regions
collapsed.
 
In the following table, we list and give a brief explanation of all built-in $-commands.
Please note that many of them are not for common use but rather made for special
use in examples or when creating portable programs. We have colored the
commands you will likely use in red. If you are not an advanced user that wants to
learn all aspects of CNCSimulator Pro, you can skip over the commands colored in
black. Not even all red commands are a must to know. As a minimum, you have to
know the $AddRegPart command as you will need it to place workpieces on the table
(or in the chuck). If you are a 3D Printer only user, you can ignore the $-commands.
 
$-command Explanation Format Example Machi
  ne
type
$AddRegPart Puts a workpiece $AddRegPart # [#] $AddRegPart 1 30 All
from the user- [#][#] 30 machi
defined nes
workpiece except
registry in the the 3D
Inventory Printer
Browser (F2) on
the machine
table (or in the
chuck). The first
number is the
registry index for
the workpiece
you want to
place. The three
following
numbers are the
X, Y and Z
coordinate for
where you want
to place the
workpiece. If
omitted, it will be
placed at the
machine zero.
$AddEmbeddedRe Puts a workpiece $AddEmbeddedRe $AddEmbeddedRe All
gPart from the fixed gPart # [#][#][#] gPart 1 25 10 machi
embedded nes
workpiece except
registry on the the 3D
table. See Printer
$AddRegPart
above for further
explanation.
$AddDefinedPart Put a predefined $AddDefinedPart # $AddDefinedPart 1 Milling
workpiece on the [#][#][#] 10 10 and
table. Use Cuttin
$AddDefinedPart g
to define machi
workpieces in the nes
program.
$BlockSpindleRot Will block on- $BlockSpindleRot $BlockSpindleRot Lathe
screen spindle machi
rotation. This can nes
be useful in the
unlimited lathe if
the visual
rotation of the
workpiece is not
desired.
$Inches Enforce the use $Inches $Inches All
of Inch units. (To machi
set millimeters or nes
inches units,
open the
program settings
dialog).
$Millimeters Enforce the use $Millimeters $Millimeters All
of Millimeter machi
units. (To set nes
millimeters or
inches units,
open the
program settings
dialog).
$MillStock Creates a mill $MillStock # # # # $MillStock 100 100 Milling
  stock material. ## 40 0 0 40 machi
    nes
Length, Width,
Height, Origin X,
Origin Y, Origin Z
$MillTool Creates a milling $MillTool # # # $MillTool 10 0 50 Milling
tool. machi
  nes
Diameter,
Radius, Length
 
If radius =
diameter /2 a ball
mill is created.
Otherwise, it will
be flat.
 
$MillToolDrill Creates a drill $MillToolDrill # # # $MillToolDrill 10 Milling
tool. 60 50 machi
  nes
Diameter, Tip
angle, Length
$SetView $SetView is a $SetView # # # # # $SetView All
special # # # # # # # # # # 0.008132864,- machi
command to set # 0.001045043, nes
the 3D-view 0.002846713,
during the 0,0.002991813,
simulation. It 0.004094983,
should not be -0.007044114,0,
programmed -0.000494922,
manually as it 0.007581451,
contains too 0.00419715,
many 0,-0.1170392,
parameters but -0.01551898,
rather be created 0.1104939,1
using the menu
action Tools –
Misc - Insert
Command -
$SetView.
 

$Message Displays a $Message $ # $Message "Hello All


message on the World!" 5 machi
3D view during nes
the simulation.
First parameter
is a text string of
the message to
display. The next
parameter is the
number of
seconds to show
the message.
$Cutting Set the solid $Cutting # # # # # $Cutting  0 52 34 All
workpiece cutting 100 100 machi
values, at nes
runtime, in except
percent. lathes
Parameters are:
FromLeft,
FromRight,
FromFront,
FromBack, and
FromTop.
$Cutting Set workpiece $Cutting # # # $Cutting 0 100 1 Lathe
cutting. machi
Parameters are: nes
Left, Right,
Open.
To show the
whole part, left
should be 0 and
Right should be
100.
The last
parameter is 0 to
show the
workpiece closed
and 1 to show
the inside.
$Pause Will pause the $Pause # $Pause 4000 All
simulation for a machi
given number of nes
milliseconds.
$StartStopWatch Starts the $StartStopWatch $StartStopWatch All
internal machi
stopwatch to nes
measure the time
for an operation.
Please note that
the time
measured is
simulation time
and not
machining time.
$ShowStopWatch Stops the $ShowStopWatch $ShowStopWatch All
internal machi
stopwatch and nes
shows the time
that has elapsed
since the
$StartStopWatch
command was
executed.
$Lathe Enforces the use $Lathe $Lathe (Alarm if Lathe
of a lathe not lathe machine) machi
machine. You nes
will see an alarm
if you run a
program with this
command on a
machine that is
not a lathe.
$Mill Enforces the use $Mill $Mill (Alarm if not Milling
of a milling a milling machine) machi
machine. You nes
will see an alarm
if you run a
program with this
command on a
machine that is
not a milling
machine.
$SetupTool This command is $SetupTool # # # # $SetupTool 50.00 Milling
used to directly # # 3.00 10.00 1.00 machi
setup and use a 10.00 2 nes
milling tool
without using the
user or
embedded
registries.
Parameters are: 
TipAngle,
ShaftDiameter,
ShaftLength,
ToolDiameter,
ToolLength and
ToolTipType
(0=Flat, 1=Ball,
2=Pointed)
$OverrideBufferQu This special $OverrideBufferQu $OverrideBufferQu All
alitySetting command is alitySetting # alitySetting 10 machi
used to override nes
the resolution
setting for the
solid buffer. The
value given is the
number of 3D
pixels (voxels)
per millimeter. A
value of 1 will
make each 3D
pixel 1 cubic
millimeter big. A
value of 10 will
make each 3D
pixel 0.1 mm3
big. A value of 1
will create ugly
results but will
run fast. On the
other hand, a
value of 10 will
create high
resolution
workpieces but
will run slow. We
do not
recommend
using values
higher than 10 as
you could easily
run out of
memory due to
huge material
buffer allocation.
Important: this
command must
come before the
$AddRegPart
command.
$AddMillPart This command is $AddMillPart # # # $AddMillPart 51.00 Milling
used to directly # # # # # # # # # # 36.00 0.50 15.00 machi
setup and use a 80.00 9.55 128 nes
milling workpiece 128 128 218 165
without using the 32 1
user or
embedded
registries.
Parameters are:
SizeX, SizeY,
SizeZ, Xpos,
Ypos, Zpos,
PartColR,
PartColG,
PartColB,
TopColR,
TopColG,
TopColB,
MaterialStyle
$DefineLatheWork Define a lathe $DefineLatheWork $DefineLatheWork Lathe
piece workpiece that piece $ # # # # piece machi
can be fetched "N:Part:M:Aluminiu nes
by using the m" 0 100.00 70.00
command 0.00
$AddDefinedPart
. Parameters are:
NameAndMateri
al, Index, Length,
Diameter, Inner
diameter.
$DefineMillWorkpi Define a mill $DefineMillWorkpi $DefineMillWorkpi Milling
ece workpiece that ece $ # # # # ece "N:Demo part and
can be fetched 1 cutting
by using the mm:M:Aluminium" machi
command 1 140.00 160.00 nes
$AddDefinedPart 30.00
. Parameters are:
NameAndMateri
al, Index, SizeX,
SizeY, SizeZ
$DefineMaterial Defines a $DefineMaterial $ $DefineMaterial Milling
material to be # # # # # # # # "N:Aluminium" 1 machi
used by defined 160 160 170 0 0 0 nes
workpieces. 1
Parameters are:
MatrlName,
Index, PartColR,
PartColG,
PartColB,
TopColR,
TopColG,
TopColB,
MaterialStype
$From Starts simulation $From # # (lathe)   Lathe
from a given $From # # # and
position. (milling) milling
Parameters are: machi
Xpos, Zpos in nes
lathes and Xpos,
Ypos, Zpos in
milling machines.
$DefineMillTool Defines a milling $DefineMillTool $ $DefineMillTool Milling
tool that can be # # # # # # # "N:Drill mm" 5 machi
fetched by the 120.00 0.00 0.00 nes
DT code letters. 8.00 50.00 2
Parameters are:
ToolName,
Index, TipAngle,
ShaftDiam,
ShaftLength,
ToolDiam,
ToolLength,
ToolTipType
(0=Flat, 1=Ball,
2=Pointed)
$Toolpaths Turn on or off the $Toolpaths # $Toolpaths 1 All
display of the machi
tool paths during nes
the simulation. except
(1=on, 0=off). the 3D
Printer
$SetCuttingWidth Used in cutting $SetCuttingWidth $SetCuttingWidth Cuttin
machines to # 2 g
define the cutting machi
width. nes
$UseMaterial Tells the $UseMaterial $ $UseMaterial All
simulator to "ABS" machi
override the nes
material for the
workpiece and
use the specified
one instead. The
material must
exist in the
materials registry
in the Inventory
Browser (F2) to
avoid an alarm.
$UseEmbeddedMa Tells the $UseEmbeddedM $UseEmbeddedM All
terial simulator to aterial $ aterial "Steel" machi
override the nes
material for the
workpiece and
use the specified
embedded one
instead. The
material must
exist in the
embedded
materials registry
to avoid an
alarm.
$InvertLathePart Flips the lathe $InvertLathePart $InvertLathePart Lathe
workpiece in the machi
chuck so that the nes
machine can
continue
machining the
other side of it.
$LatheStock Creates a lathe $LatheStock # # # $LatheStock 100 Lathe
  stock material. # 40 0 0 machi
    nes
  Length,
Diameter, Inner
diameter, Z
origin
$LatheToolButton Creates a lathe $LatheToolButton $LatheToolButton Lathe
  button tool. # # # # # 10 0 0 0 0 machi
  Parameters are:   nes
Radius, Res,
Res, Res, Res
(Res = not in
use, reserved for
future use.)
Note: Creates
only the cutting
insert, not the
holder.
$LatheToolDrill Creates a lathe $LatheToolDrill # # $LatheToolDrill 10 Lathe
  drill tool. # 60 60 machi
  Parameters are: nes
Diameter, Tip
angle, Length
$LatheToolGroove Creates a lathe $LatheToolGroove $LatheToolGroove Lathe
  groove tool. # # # # # # # # 0 0 10 5 0 0 90 0 machi
  Parameters are: nes
Res, Res,
Length, Width,
Res, Res, OA,
Res
 
(Res = not in
use, reserved for
future use.)
OA = cutter
angle (90
normally)
Note: Creates
only the cutting
insert, not the
holder.
$LatheToolStandar Creates a $LatheToolStanda $LatheToolStanda Lathe
d standard lathe rd # # # # # rd 15 45 0 14 0 machi
  tool. Parameters nes
are: BA, A, Res,
IC, Res
 
(Res = not in
use, reserved for
future use.)
Note: Creates
only the cutting
insert, not the
holder.
$LatheToolThread Creates a lathe $LatheToolThread $LatheToolThread Lathe
  threading tool. # # # # 60 10 10 90 machi
Parameters are: nes
Tip angle,
Length, Width,
OA
 
OA = cutter
angle (90
normally)
Note: Creates
only the cutting
insert, not the
holder.
$AbsoluteCenters Circle and arc $AbsoluteCenters $AbsoluteCenters All
centers are machi
normally entered nes
as incremental
values. This
command tells
the simulator to
expect absolute
circle and arc
center values.
$SetG28pos Set custom $SetG28pos # # # $SetG28pos 100 0 Milling
position for G28. 30 and
Important to use turnin
in the "unlimited" g
machines as machi
they have their nes
default zero
position very far
away.
$SetToolChangePo Set custom tool $SetToolChangeP $SetToolChangeP All
s change position. os # # # os 10 10 100 machi
nes
except
the 3D
printer
$DefineDoffsetDia Define a D offset $DefineDoffsetDia $DefineDoffsetDia Milling
meter in program. meter # # meter 1 10.2 machi
More info nes
 
$ReadTasDefinedT When your $ReadTasDefined $ReadTasDefined Milling
ool program has Tool Tool and
defined tools (for turnin
example in g
programs machi
created by nes
SimCam), you
call these tools
with "DT". Using
this command
you can skip the
D and only use T
followed by the
tool index
number. For
example "T25".
The simulator will
treat all T values
as defined tools.
$RotateWorkpiece This command $RotateWorkpiece $RotateWorkpiece Milling
rotates the machi
workpiece nes
around its Z-axis.
 
$Color This command $Color R G B $Color 200 125 90 Milling
sets the surface machi
color. Any new nes
surface that gets
exposed by a
milling operation
will have this
color. The
command
expects three
parameters:
Amount of Red,
amount of Green
and amount of
Blue. Values are
giving in the
range 0 to 255
where 255 is the
brightest. $Color
0 0 0 will make
the surface black
and $Color 255
255 255 will
make it white.
For mixing of
other colors,
Google "RGB
Color Picker".
$AutoColorMode This command $AutoColorMode # $AutoColorMode 2 Milling
can be used to machi
let the simulator nes
automatically set
surface colors
depending on the
tool index or the
cutting depth.
There are four
modes:
 
0. No automatic
coloring (normal
mode)
1. Color by tool
index
2. Color by
cutting depth
3. Color gradient,
deeper is darker
 
See example 26
for more
information.
$DefineZeropoint It is used to $DefineZeropoint $DefineZeropoint Milling
define temporary $ # # # # "N:Name" 0 100 machi
zero points. 100 20 nes
Example:
$DefineZeropoint
"N:Name" 0 100
100 20
This will define
zero point index
0 to X100 Y100
and Z20. Index 0
= G54, 1 = G55
etc.
Index 0 can also
be called with
G54.1 P0. After
this command
has been used,
all G54-G59 and
G54.1 calls will
refer to the
defined zero
point and not to
the ones in the
zero point
registry.
$TutorialLine A special $TutorialLine $ $TutorialLine "We Milling
command to set end the program and
titles of tutorials. with M30" turnin
You can read g
more about machi
these here nes
Creating
customized
tutorials in
CNCSimulator
Pro.
$Title A special $Title $ $Title Milling
command to set "Demonstration and
titles of tutorials. Tutorial" turnin
You can read g
more about machi
these here nes
Creating
customized
tutorials in
CNCSimulator
Pro.
 
$PreventEraseOnC By default, the $PreventEraseOn $PreventEraseOn Turnin
utOff simulator will CutOff CutOff g
erase everything machi
to the right when nes
the material has
been cut through
to simulate the
part falling down.
This command
prevents that
from happening.
$ReadTasEmbedd When your $ReadTasEmbedd $ReadTasEmbedd Milling
edTool program wants to edTool edTool and
use the simulator turnin
embedded tools, g
you call these machi
tools with "ET". nes
Using this
command you
can skip the E
and only use T
followed by the
tool index
number. For
example "T25".
The simulator will
treat all T values
as embedded
tools.
$UseAltG92metho This activates an $UseAltG92metho $UseAltG92metho All
d alternative G92 d d machi
mode so that it nes
makes the
current tool
position have the
coordinates you
specify.
$DefineLatheTool Used by $DefineLatheTool . $DefineLatheTool Turnin
SimCam and by .. 1 4 20 30 90 20 20 g
"Make program 20 0 8 0 0 255 140 machi
portable" to 0 0.806 0.806 nes
create in- -0.804 0.800 0
program lathe 10.000 -30.000 IP:
tools. It is an 1.372 -0.238 9.819
advanced -8.691 9.819
command that -8.691 9.978
defines both the -8.918 10.050
geometry of the -9.187 10.051
tool holder and -9.802 10.029
the insert. -16.986 10.029
-16.986 9.980
-17.260 9.840
-17.500 9.627
-17.678 9.365
-17.772 9.087
-17.771 8.827
-17.675 0.263
-9.109 0.263
-9.109 0.104
-8.881 0.033
-8.612 0.006
-0.806 0.006
-0.806 0.053
-0.533 0.191
-0.292 0.404
-0.112 0.664
-0.016 0.942
-0.016 1.204
-0.110 HP: 2.276
-4.641 27.028
-27.140 27.028
-112.636 6.779
-112.636 6.779
-27.140 2.276
-22.636 2.276
-4.641
$DefineNonModal This command $DefineNonModal For more Milling
Macro lets the user Macro $ # # information, see ,
create his or her Create your own turnin
own custom G, codes g, and
M, and other cutter
codes. machi
nes
$DefineModalMacr This command $DefineModalMacr For more Milling
o lets the user o $ # # information, see ,
create his or her Create your own turnin
own custom G, codes g, and
M, and other cutter
codes. machi
nes
$CodeHelp This command is $CodeHelp # $ For more Milling
used to create information, see ,
custom code Create your own turnin
help. codes g, and
cutter
machi
nes
$ActivateMacroInte This command is $ActivateMacroInt   Milling
rpreter used to erpreter ,
temporarily turnin
enable the macro g, and
interpreter. cutter
machi
nes
$GotoLabel With this $GotoLabel $ $GotoLabel "end" Milling
command, we ,
can jump in the turnin
CNC program to g, and
a specified label. cutter
machi
nes
$Include This command is $Include $ $Include Milling
used to include "myincludefile.cnc" ,
files that can be For more turnin
run in the information, see g, and
background to Create your own cutter
make custom codes machi
definitions. nes
 
Note that these commands work even when they are inside parentheses. It is
normally good to keep them in parentheses to avoid confusion with other software or
CNC controllers.
 
25. Other codes

Other common codes interpreted by the simulator.


 
Code Explanation Format Example
X Absolute or incremental X-axis value used in X# X2.43
canned cycles and codes like G00-G03.
Y Absolute or incremental Y-axis value used in Y# Y1.16
canned cycles and codes like G00-G03.
Z Absolute or incremental Z-axis value used in Z# Z-3.2
canned cycles and codes like G00-G03.
I Represents the center in X in G02 and G03 circle/ I# G02 X34 Z106.867
arc commands. I4.8 K0
J Represents the center in Y in G02 and G03 circle/ J# G02 Y0 J-20
arc commands.
K Represents the center in Z in G02 and G03 circle/ K# G02 X34 Z106.867
arc commands. I4.8 K0
T Selects a tool from the user-defined tool registry in T# T1 M06
the Inventory Browser (F2). M06 is used to execute
the actual tool change.
ET Selects a tool from the fixed embedded tool ET# ET9 M06
registry. M06 is used to execute the actual tool
change.
DT Selects a predefined milling tool. The tool must first DT# DT3 M06
have been defined using the $DefineMillTool
command. M06 is used to execute the actual tool
change.
S Defines spindle rotation in revolutions per minute S# S2000
(RPM).
F Defines feed rate in millimeter or inches per F# F240
minute.
P Used in M98 to define a subprogram number. Also P# M98 P1001 L1
used as dwell time in canned cycles. G73 Z-20 R2 Q5
P100 F350
L Used in M98 to define the number of repetitions. L# M98 P1001 L1
O Subprogram number. It should be the first line of O# (Drilling subprogram
every subprogram. 1)
O1000
R Reference or starting plane in canned cycles. R is R# G81 Z-20 R2
also used in G02/G03 to give the radius when I/J/K
are not used.
Q Peck size in canned cycles. Q# G73 Z-20 R2 Q5 P0
F350
SA, Start Angle, Angle Step, and Radius used in the SA# AS# G12 X0 Y0 Z-20 R2
AS, RA G12 Circular drilling cycle. RA# Q5 SA0 AS36 RA30
H10
H Used for the number of holes in the G12 Circular   G12 X0 Y0 Z-20 R2
drilling cycle. Q5 SA0 AS36 RA30
H10
( and ) Used for comments. G-codes and M-codes inside (text) (Drilling subprogram
parenthesis will not be executed. $-commands will 1)
be executed even when inside the parenthesis.
/ amd ; Used for comment out one or several lines. G, M   G01 Z-20 F440
and $-commands will not be executed. /G03 I23.2 J0
/G03 X15 I19
G00 Z7
N Block number. N# N500
 
  

You might also like