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 .
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.
We are going to put our new workpiece 30 millimeter 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, please note that you can click in 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 in the upper (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 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 the diameter 10 mm holes.
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 a 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 X in the upper right corner of the Tool Browser to close it.
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.
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 see that the positioning works.
We now enter the G-code G01 for feed movement down to working 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).
From now on, feel free to click the play button at any time to check the simulation.
Now, 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.
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.
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 drill 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.
Now we need to end the drilling cycle using the G80 code.
Finally we go up in Z and the write M30 to end the program.
Congratulations! You have done your first CNC program in the famous CNCSimulator!