The purpose of this tutorial is to learn the basic concepts of how to use the CncSimulator Pro from scratch. 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 load an appropriate machine for our project. Click File – Load Machine from the main menu.
In the dialog that shows, please select millimeters and deselect Load Demo. Then click on the “Milling Center” button.
Fine, now let’s get started by defining our workpiece. Click Settings – Workpieces – Mill from the main menu.
Click on the green plus icon in the upper right corner 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 workpiece dialog.
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 (could be somewhat hard to spot).
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. Click on Settings – Machine Tools to open the Tool Browser.
In this tutorial, we assume you have no 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 M6 to tell the virtual machine to go to its tool change position and execute the tool change.T1 M6
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 G0 to move with rapid speed to the position stopping 2 mm over the workpiece.G0 X15 Y15 Z2
Now, press Play to see that the positioning works.
We now enter the G-code G1 for feed movement down to working depth. We also need to start the spindle (M3) and set the Feed rate (F) and spindle RPM (S).G1 Z-5 F250 S2000 M3
Now we will move the mill to the start point of the arc, there is no need to type G1 in this block as the code is modal meaning it will remember the G1 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.
Now, let’s program the clockwise arc movement. To do so, we use the G2 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). G2 X30 Y85 I15 J0
Great! Let’s enter the rest of the blocks to finish the slot.G1 X85Y15X15
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 drillings.G0 Z2T2 M6
Make sure you use your tool index after T for the drilling tool we created.
Now we can come back from tool change position and put the drill over the first hole.G0 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 (M3). This time, let us also use coolant water (M8) to not overheat the tool. G81 Z-15 R1 M3 M8
Now we can just position over each hole center and the drilling will start automatically.Y70X70Y30
Now we need to end the drilling cycle using the G80 code.G80
Finally we go up in Z and the write M30 to end the program.Z50M30
Congratulations! You have done your first CNC program in the famous CncSimulator!
The complete program:
($AddRegPart 1, 30, 30)
G92 X30 Y30 Z20T1 M6G0 X15 Y15 Z2G1 Z-5 F250 S2000 M3Y70G2 X30 Y85 I15 J0G1 X85Y15X15G0 Z2T2 M6G0 X30 Y30 Z2G81 Z-15 R1 M3 M8Y70X70Y30G80Z50M30
kmex