pocket(50,50,1) -- our first NCCL command.
post() -- create Gcode..
In this tutorial, we will briefly explore current NCCL capabilities. The goal is to show you how NCCL works.
Let’s start immediately with a simple example. We will create a very simple feature : a rectangular pocket.
Type the following instructions using the text editor of your choice and save them in a file. You can name the file as you like. In this example we will call it mill.cnc. Save it in the same folder where NCCL.EXE resides.
Open a dos command prompt. Go to the installation directory of NCCL and run the program from the dos command prompt with the following syntax :
C:\NCCL>NCCL mill.cnc (Enter)
The following output should be displayed on the screen. You can redirect the put to the file of your choice with the syntax :
C:\NCCL>NCCL mill.cnc > output.res
We will later learn how to "tell" NCCL to directly write the output to a file of our choice
Examine the results. The first instruction is a call to the native NCCL command pocket(). This function creates a rectangular pocket and the three values enclosed by parenthesis are the function parameters. They are respectively the length, width, and depth of the pocket. So, the instruction pocket(50,50,1) will tell NCCL that we want to create a pocket with a width and length of 50 and a depth of 1. After this instruction is processed by NCCL, all the motions relative to this feature are created and kept in an internal data structure.
Next, the command post() instructs NCCL to postprocess all the motions created so far. The term “postprocess” means a translation process from the internal representation of the tool path to a form that can be understood by a CNC machine. The software components that implement such process is called postprocessor. Note that the post() command is not implicit. It needs to be explicitly given. This is because you are not limited to just one command per file. Dozen of functions could be called and each one could create many motions. It’s usually at the end of the file that all the generated motions will be finally postprocessed. Anyway the post() command can be given anywhere in the file. It will simply postprocess all the motions created so far.
Since we only typed one command before post() , only the motions of the pocket will be created. Note that the post() function is called without parameters. In this case, it will default to an internal hard coded postprocessor that will emit code for the APT-CL standard language. The post() function accept one parameter which is a string. This string contains the name of the postprocessor we want to use. So if we want to postprocess for a FANUC CNC controller just call the post() function this way : post(“fanuc.ppf”). That’s all. In this manual we will always use the standard postprocessor.
So far, we have easily obtained some code to machine with just a couple of line of code. Seems interesting, but… wait a moment ! The pocket has been created with the origin in 0,0,0 coordinates. I don’t’ want all my pockets to be machined there ! And what about other obvious features as step over, coolant, tool and everything else ? Do not worry ! All of these feature are available. Before continuing, let’s spent some words about generating Numerical Control code for milling.
Even the simpler technological feature like a pocket can be machined in different ways. Many different tools can be used and many machining parameters can be set in order to achieve the best work.
A software that claims to be useful to machinist must absolutely include the capability to use all that parameters.
This could be done designing each function to accept all the necessary parameters but this leads to a cumbersome application. Recall that we want to keep the syntax as simple as possible. Try to think to a pocket(…) function that, each time you call it, require a dozen of mandatory parameters. It will be a nightmare. NCCL doesn't work this way.
All the parameters can be set trough variables. Variables are placeholders for values. They are easier to remember and can be defined or set by both the user and NCCL itself.
There are many system variable that NCCL will read before starting to generate motions. Variables can accept different values and the user can set them to whatever value he want. Once a variable value has been set, it will retain its value until the program ends or the value is changed. If saved in a file, next time the program will be run that variable will have the same value. If not set, system variables have a default value that you can change. All the system variables that NCCL does recognize are documented in this manual and for detailed explanations you can read the appropriate section of this document. That said, let’s go back to our pocket example. In the previous example, add the following instruction as first line in the program file : ZSTEP = 0.5. The file will become like this:

N20 (***************** NCCL Beta V. 0.0.0. Jun2010 *******************)
N30 (* Copyright (C) 2009 SF info@exgenia.com *)
N40 (* Codice di prova non verificato. *)
N50 (* Puo' provocare danni all'utensile al pezzo o alla macchina *)
N60 (* This NC code has not been tested yet *)
N70 (* If run, can cause damage to tool, workpiece or machine *)
N80 (******************************************************************)
N90 (PROCEDURE_RECTANGULAR_POCKET_1)
N100 T1M6 (Fresa Piana da 10)
N110 S1500
N120 F500M3
N130 G0 X25.000Y25.000Z100.000
N140 Z5.000
N150 G1 Z-1.000
N160 Y20.000
N170 X30.000
N180 Y30.000
N190 X20.000
N200 Y15.000
N210 X35.000
N220 Y35.000
N230 X15.000
N240 Y10.000
N250 X40.000
N260 Y40.000
N270 X10.000
N280 Y5.000
N290 X45.000
N300 Y45.000
N310 X5.000
N320 Y5.000
N330 G0 Z5.000
N340 Z100.000M5
N350 M30
ZSTEP = 0.5 -- Set a Z Axis increment of 0.5
pocket(50,50,1) -- Create a pocket..
post() -- Finally create the motion code
Save the file and run it again. This time NCCL will produce much more output because the ZSTEP variale tell NCCL the step use use in Z axis to reach the required depth.
The I hope you begin to understand how NCCL works. But there is still the problem about how to tell where the pocket should be machined. In other words : how to tell NCCL where workpiece zero is ? You are right. You noticed that the pocket function accept parameters that describe the dimension of the pocket I want to create. All the NCCL functions works this way. To set the starting point of the feature one must use a function called movetool(x,[y,z]). Go back to our file mill.cnc and add this line before the pocket function call :
movetool(50, 35, 25)
Our mill.cnc file will become like this :
movetool(50,35,25) -- set the starting point here
ZSTEP = 0.5 -- Set a Z step of 0.5 units
pocket(50,50,1) -- create the pocket
post() -- generate code.
Once again save an run the program and examine the results. Note that the coordinates in the output file reflect the changes. The pocket lower left corner will be placed in a point with coordinates X = 50 Y = 35 and Z = 25. Starting from that point, a rectangular pocket will be created with the previous set size.
Note that the current tool position will be the same until changed. In other words, every command that create motions will start on the last position set. A good programming practice is documenting what you are doing. In NCC everything after a couple of ‘-‘ characters is considered a comment because LUA (the base language NCCL is based on) use this syntax for comments. It’s highly recommended to use this feature. Commenting code in never a waste of time. Remember that if you will use NCCL creating your own programs and functions, it’s likely you will write a lot of code. What about reading your old programs six months later ?
NCCL Tutorial
TOOL_DIAM = 6 -- Tool has 6 mm of diameter
STEPOVER = TOOL_DIAM * 0.5 -- Yes.. we can use expressions
ZSTEP = 0.5 -- Set a Z step of 0.5 units
movetool(50,35,25) -- set the starting point here
pocket(50,50,1) -- create the pocket
movetool(150, 50, 1) -- move the tool here..
ZSTEP = 1 -- now use a 1 mm Z step
pocket(60,45.50, 2.5) -- create another pocket
post() -- Finally generate code.
Home Page
Copyright © 2010 by Exgenia" E-Mail: info@exgenia.com