CAM Wizard N/C Programming Software


POST Processor - Mill


POST is the post processor program that creates the N/C code for machining the part on a milling machine. The two data files necessary for the POST to do this are the geometry file ( GEO.CAM) and the source file ( SOURCE.CAM). The geometry file holds all of the geometry defined in CAM including points, lines, circles, rectangles, slots, and shapes. This data should represent all necessary part geometry needed to machine the part. Once the programmer has defined the geometry, he/she must run SOURCE by typing "SOURCE". The editor then allows the user to enter the instructions which will be interpreted by POST in order to create the N/C code.


There is a machine definition file for each machine supported by this system. The post processor is executed automatically by the source editor (SOURCE) when the RUN-POST function is executed. At that point, the editor reads a file named MACH.CAM to determine what post program to run (MILL, LATHE, PUNCH, EDM), and which machine definition file to use. To run POST, the name of that machine must be included in the first line of source code. This line should also have a brief description of the part such as part number and operation number. This first line must be a comment which is designated by the " (" character at the beginning of the line.


After reading the SOURCE, Geometry, and machine definition files, the POST will display the SOURCE instructions, and one by one, generate N/C code from those instructions by applying a series of.subroutines for each function. Those subroutines must be defined in the machine definition file as shown in the appendix. One by one, each of these subroutines creates the N/C code defined in that file, until the last line of instructions (or "End" has been encountered. The TAPE editor is then loaded in order to edit the N/C code, or check the TAPE with the CHECK program.


As with the geometry program, numeric expressions can be imbedded in the source code and will be evaluated at run time (when POST is called). The post processor is a source code compiler and is not designed to be interactive. However, there are a number of simple one keystroke commands that can be given during the execution of POST.


The display created by the post processor is a two window listing of the code conversion. The source code is listed on the left, and the resulting tape is displayed in the right hand window. Each line in the source is highlighted as it is executed, showing the code it creates in the right hand window. This format allows the programmer to easily determine what code is being generated by each instruction, as well as which lines in the SOURCE are executed and in what order. In general, more code will be created by the system than was written by the programmer.



Ctrl-C is a one keystroke command that will return program execution back to the SOURCE editor. This allows the programmer to return to the editor to make changes to the source code if he/she notices a mistake in the source code without having to wait for POST to interpret all of the instructions in the source code.


Ctrl-S will suspend program execution so that the programmer can analyze what is happening at any instant.


Ctrl-Q will cause the POST to continue after a Ctrl-S was pressed.


Ctrl-P will exit to the TAPE editor without canceling the tape file already written.


A status line at the bottom of the screen displays the values of user variables. This makes debugging easier since those values can be watched while the program is running, and especially since one of the standard user variables is "tr" (the tool raius).



Modal Commands

There are many different operating modes for the post processor. The modal commands are used to turn on and off these modes. Some of the modes are not fully supported by some machines and settings of these modes will have no effect on the code generated for these machines. The modal commands are:


"TRIM ON" and "TRIM OFF" - used to turn on and off the automatic trim function that eliminates code redundancy.


"COMP ON" and "COMP OFF" - used to turn on and off the automatic generation of cutter comp moves in machining instructions.


"COOL ON" and "COOL OFF" - used to turn on and off the automatic generation of machine codes associated with coolant (M8/M9)


"STAY LEFT" and "STAY RIGHT" - used to tell the post processor whether to create the tool offset staying to the left or right of the geometry to be machined.


Different values used by the post processor can be changed using modal commands. These commands consist of the naming of those values followed by a colon ":" and a numeric expression evaluating to the desired value:


OFFSET: nn - tells POST what amount to use for the tool radius in its calculation of the tool offset. The default value = tool radius


CLEARANCE:nn - tells POST what clearance distance to use for entering and exiting a cut. default value = .1


ROUGH:nn - tells POST what amount to be left on roughing cuts. default value=.03


PASS_WIDTH:nn - tells POST what distance to use when making a multiple pass cut. default value=cutter diameter times .7


ZFEED:nn - tells the POST what percentage of the traverse feed rate to use for z feed rates. The default value = 1/4



Comments can be imbedded in the source code for the programmers and/or machine operators convenience. These comment lines must begin with " (" or "{" characters. Comments beginning with "(" will be included just as they appear, in the N/C code generated by this system. Comments beginning with "{" will not be included in the N/C code.




Speeds and Feeds

The cutting spindle speeds and feed rates will automatically be calculated by the program using information stated in a file called "MATL.CAM". This file contains a list of material descriptions and the associated cutting speeds and feed rates to be used for that material along with other information about how to set parameters for cutting that material. The data in this file can be altered by running the MATERIAL program. This program will ask the user for the required information and store that information in the "MATL.CAM" file. This information can be viewed by using the standard MS-DOS "TYPE" command, or listed on the printer using the MS-DOS "PRINT" command.


Both the values used from this file and the values calculated for spindle speeds and feed rates can be changed using simple commands. The speeds and feeds can directly be overridden by using the manual codes Snn and Fnn in the source code. The commands for changing the material cutting parameters are:


            SFM:nn           - designates the surface feet per minute.
            FTOOTH:nn   - designates feed per tooth for 1 inch end mill.
            TEETH:n         - designates number of teeth on cutter.



READ and RESTORE


Geometry files can be read and re-read using the "READ" and "RESTORE" commands. These commands read in geometry data files created by CAM to be used by the POST for creating the N/C code. The "READ" command is used to read a geometry file. Unlike the same command in CAM, the "READ" command in POST will simply read the file and not append it to the geometry that has already been read in. The restore command is used to read the last file read in. This has the effect of restoring any geometry that has been modified by POST. The reasons for these commands will become apparent to the user who programs POST using the structured programming elements discussed later.




MOVE, INV, ROT

The MOVE, INV, and ROT commands used in CAM can also be used inside of POST. These commands make it possible to machine extremely complex parts with similar elements as well as three dimensional parts. The only restriction to these commands in POST as opposed to CAM is that the "'N" parameter cannot be used. This is because the programmability of POST allows extremely complex parts to be programmed without the need for extensive geometry data. When used inside of a LOOP with variables, these commands can be very powerful.




The Tool List

A tool list can appear at the beginning of the program. This tool list must be included in comments (either "(" or "{"). The tool list consists of a listing of tool numbers and their descriptions. The tool list for one tool has the following syntax:


( TOOLn = nn MILL )

( TOOLn = nn DRILL )

( TOOLn = #nn DRILL )

( TOOLn = nn BORING BAR )

( TOOLn = nn REAMER )

( TOOLn = nn-nn TAP )

( TOOLn = #nn-nn TAP )



The value after the "=" character is taken as being the tool diameter. This value is used in the calculation of the spindle speed, and the spindle speed for an unusual tool can be controlled by this number. If the number is preceded by the " #" character, then the tool diameter is approximated and that value is used for the tool diameter. If more accuracy is needed in this type of tool, the #nn should be replaced with the actual diameter used.


In the case of a tap, the number after the " -" character is taken as the number of threads per inch. This value is used in calculating feed rates for tapping.


The tool description string will be used to determine the type of tool ( "MILL", "DRILL", " TAP", " REAMER", "BORING BAR" ) used and will effect the spindle speed and feed rate generated at the tool change. The word " CARBIDE" can also be used in the tool description to denote that the cutting tip of the tool is carbide and not high speed steel. This will cause the cutting speed to increase by some amount depending on the N/C machine being programmed. Other descriptive terms can be used in the tool description to make tool identification easier.




The TOOL Command

The tool change command is the most complex command in POST. This command causes any code for the tool change sequence to be generated. This can include height offsets, recalculation of speeds and feeds based on the new tool geometry, code for handling coolant, and cancelation of any machine modes in effect that would prevent the tool change sequence from taking place.


The "TOOL" command has the following syntax:


TOOLn {Pn/Cn/SHAPEn} Rn Zn Fn Sn {'S} {CCW/CW}


At the tool change, POST will recalculate the default spindle speed, feed rate, and tool radius offset. These values will depend on the last values for SFM, FTOOTH, TEETH, and the tool description for that tool that was read from the tool list at the beginning of the program source. The values for spindle speed and feed rate can be overridden in the " TOOL" command using the " S" and "F" parameters. Tool offsets can only be overridden in a line after the tool change is commanded.


Automatic tool positioning occurs at the tool change. The location the tool is positioned at depends on the first parameter after " TOOLn". The tool will be positioned at a point or for cutting a circle, rectangle, slot, or shape if they are specified, otherwise the present position will be used.


The "R" and "Z" parameters are used to tell the POST where to position the tool in the Z axis after changing tools. A default value will be used depending on the particular N/C machine being programmed. If only an "R" is used, the tool will rapid to that Z dimension pulling in any height offsets necessary. If both an "R" and a "Z" are used, the tool will move in rapid traverse to the " R" dimension and then feed to the " Z" dimension.


"'S" can also be commanded in the tool change command. If " 'S" is used, POST will insert a program stop at the tool change. This allows the programmer to have the machine operator move clamps, take measurements, or do any other setup operations without the need to insert manual codes if the program stop is to take place at the tool change.


Finally, the tool direction can be commanded as " CW" or " CCW". A default value is taken if neither of these are specified. That value depends on the particular N/C machine being programmed.




The DRILL Command

The "DRILL" command is used to drill holes at points, X and Y locations, and starter holes for milling. The "DRILL" command has the following syntax:


            DRILL Xnn Ynn Pn Cn SHAPEn {Pn Cn SHAPEn} Rnn Znn {THRU-nn}

            DRILL nnHOLES Rnn Znn{THRU-nn}

            DRILL LAYERn Rnn Znn{THRU-nn}



In drilling, POST determines what locations to drill and positions over those locations issuing the proper commands and/or canned cycles depending on the N/C machine being programmed. If no positioning information is given, POST will drill a hole at the present location. Any elements shown or series of elements can be drilled from the first specified to the last specified. Holes can be drilled according to size using the "HOLE" parameter which drills all holes of the specified size. If no size is given, the diameter is assumed to be that of the tool. Starter holes will be drilled depending on the value of the tool radius. If the diameter of the drill is the same as the diameter of the tool that will be used to machine that contour ( SHAPE), then the offset need not be changed between the tool change and the "DRILL" command. If the cutter diameters differ, then the tool offset used can be altered using the "OFFSET:nn" command. All geometry in a given layer can also be drilled using that layers name or number.


The rapid levels and Z dimensions of drilling can be changed using the "R" and "Z" parameters respectively. If the "Z" parameter is left out, then the last commanded " Z" is used. If the "R" parameter is left out then a default value is used depending on the machine being programmed. The "THRU nn" parameter, when used, causes the drill to go through that dimension by the radius of the cutter. Any subsequent command of "THRU" with no dimension will use the last commanded " THRU" dimension. This allows the programmer to, in effect, specify the material thickness and then simply specify all through holes as being "THRU". Any valid numeric expression can be used for any of these parameters, allowing the programmer to chamfer the hole with a 90 degree cutter to a diameter of nn by simply commanding "Z-nn/2".




The REAM Command

The "REAM" command is used to ream holes at points and X and Y locations. The " REAM" command has the following syntax:


       REAM Xnn Ynn Pn {Pn } RnnZnn THRUnn

       REAM nnHOLES Rnn Znn {THRU-nn}

       REAM LAYERn Rnn Znn {THRU-nn}



In reaming, POST determines what locations to ream and positions over those locations, issuing the proper commands and/or canned cycles depending on the N/C machine being programmed. If no positioning information is given, POST will ream a hole at the present location. Any elements shown or series of elements can be reamed from the first specified to the last specified.


The rapid levels and Z dimension of reaming can be changed using the "R" and " Z" parameters respectively. If the "Z" parameter is left out, then the last commanded "Z" is used. If the "R" parameter if left out then a default value is used depending on the machine being programmed. The "THRUnn" parameter, when used, causes the ream to go through that dimension by the clearance value (see "CLEARANCE:" command). Any subsequent command of "THRU" with no dimension will use the last commanded " THRU" dimension. This allows the programmer to, in effect, specify the material thickness and then simply specify all through holes as being "THRU". Any valid numeric expression can be used for any of these parameters.




The BORE Command

The "BORE" command is used to bore holes at points and X and Y locations. The " BORE" command has the following syntax:


       BORE Xnn Ynn Pn{Pn } Rnn Znn THRUnn

       BORE nnHOLES Rnn Znn{THRU-nn}

       BORE LAYERn Rnn Znn {THRU-nn}



In boring, POST determines what locations to bore and positions over those locations, issuing the proper commands and/or canned cycles depending on the N/C machine being programmed. If no positioning information is given, the POST will bore a hole at the present location. Any elements shown or series of elements can be bored from the first specified to the last specified.


The rapid levels and Z dimension of boring can be changed using the "R" and " Z" parameters respectively. If the "Z" parameter is left out, then the last commanded "Z" is used. If the "R" parameter is left out, then a default value is used depending on the machine being programmed. The "THRUnn" parameter, when used, causes the boring bar to go through that dimension by the clearance value (see "CLEARANCE:" command). Any subsequent command of "THRU" with no dimension will use the last commanded " THRU" dimension. This allows the programmer to, in effect, specify the material thickness and then simply specify all through holes as being "THRU". Any valid numeric expression can be used for any of these parameters.




The MILL Command

Milling commands can be used for milling point to point, milling circles, or shapes.


       MILL_Pn {Pn} XnnYnn Rnn Znn Fnn ZFnn{STEPnn}

       MILL_Cn {Cn} Xnn YnnRnn Znn Fnn ZFnn {PASSn} {STEPnn}

       MILL_SHAPEn {SHAPEn} Xnn Ynn Rnn Znn Fnn ZFnn {PASSn}{STEPnn}

       MILL_LAYERn Xnn YnnRnn Znn Fnn ZFnn {PASSn} {STEPnn}



In creating the code for milling, POST calculates the cutter offset and number of passes. If the number of passes is left out of the command, this number defaults to one. The word " ROUGH" can also be included in these commands to cause the tool path calculated by the POST to leave the "rough" clearance around the path. (This function effectively adds the rough clearance to the tool radius.) This clearance can be set using the "ROUGH:nn" command. The word " POCKET" can also be included in any mill command except for point to point milling. The "POCKET" parameter will cause POST to automatically calculate the number of passes and width of pass to take in order to start out with the maximum offset and work its way out to the edge of the shape. In point to point milling, POST creates a tool path with the center of the tool going from one point to the next. If more than one point is specified, and a step is given, POST will mill the specified points using a Z step similar to the other milling commands. If only one point is specified in the "MILL_P" command, then the tool is left down until the next mill, drill, tool change,... etc. command is given. This makes it possible for the programmer to describe a tool path in pseudo-manual codes with POST taking care of Z moves and rapid moves.


In all cases except for point to point milling, the POST can automatically generate cutter comp moves for each milling cycle. This mode can be turned on/off using the "COMP ON" and "COMP OFF" commands depending on the machine being programmed. If "STEPnn" is used, it is taken as the Z step, and the path is milled starting at that depth and going down each time by the step value until the finish Z depth is reached. The default value for the number of steps is one. The Z depth defaults to the last Z depth specified, so that it is not necessary for the programmer to specify the depth of cut more than once if the depth is always going to be the same. The default "R" level is the clearance distance above Z0 and can be altered using the "CLEARANCE: nn" command.




Programming Structures

The CAM-Wizard POST processor is a fully programmable language. It includes looping, conditional branching, and user defined variables. These features along with the "MOVE", "ROT", and " INV" functions and " READ", " RESTORE", "OFFSET", "CL:", and " PASSWIDTH:" commands, make it possible to program three dimensional parts and parts that can only be described in mathematical formulas. The programming structures available in POST are "IF", " ELSE", " END IF", "LOOP", "END LOOP", and " VAR:". The syntax of the program control statements is as follows:


LOOPn

   commands...

END_LOOP


IF expression

   commands...

ELSE

   commands...

END_IF


VAR:varname


varname=nn




Loops

Looping in POST is accomplished by setting a series of command lines in the source code between the two commands " LOOP" and " END LOOP". The statements between these two lines will be executed in succession the number of times specified in the "LOOP" statement. If no loop number is given, then the loop will be continuously. The " EXIT" statement causes looping to stop.




Conditional Execution

Conditional program execution is performed by setting commands between the statements "IF", "ELSE", and " END IF". The expression after the word "IF" is evaluated every time the " IF" statement is encountered. If the expression evaluates to a non-zero value then the statements immediately following the " IF" statement are executed until an "ELSE" or " END IF" statement is encountered. If the expression evaluates to zero, then commands after the " ELSE" are executed, unless there is no "ELSE" statement, in which case the commands after the "END IF" are executed.



User Variables

User variables in CAM-Wizard are some of the most powerful features of the system. When used properly, they can replace many calculations and control the execution flow of the program. User variables are defined using the "VAR:" command above. The programmer can make up his/her own variable names and insert them where the varname appears in the syntax definition above. User variables can have any name, which means that they can have names like zdepth or radius1. It is strongly recommended that these variable names be lower case since it is the users responsibility to determine how these variables will be interpreted by the system.


Variables are assigned values with the "=" statement User variables can have any numeric value, which means that they can have values like .218 or 100. These values are inserted in place of the variable before command interpretation; therefore the variables could be given the value of a valid command, and CAM-Wizard would act like the command had been typed in the source code editor. Also, the value "?" can be assigned to a variable, which will cause that line of the source to be displayed on the screen and the variable's value to be input by the user at run time. This feature could be used to program a family of parts in which certain parameters, such as the number of holes and their point to point distance, change with each part. There are some predefined variables. They are " tr", which is set equal to the tool radius at each tool change, and "cl", which is set equal to the clearance distance.




Rotary Axis

Your post processor has been equipped with the software enabling it to program a fourth, rotary axis using virtually the same commands as are normally used. All standard programming commands can be used with this rotary axis including pocket milling, drilling, and chain milling.


The POST enters the rotary axis using the "ROTARY" command.


SYNTAX: ROTARY_ON


This command automatically sends the correct codes to the control to engage the fourth axis. At this point, any X or Y moves, whether circular or linear are emulated by the system. The only information needed to program the fourth axis is the part diameter.


The part diameter is given with the command "DIA:".The syntax for this command is as follows:


DIA:nn DIA:CHECK


If the second form of this command is given, then the system will determine the rotary moves so that the check program will plot the tool path (as it would go around the surface of the part) on the flat surface of the screen. If the first form of this command is given, then the system will generate the correct code for the actual part. This "check" feature allows the program to be dynamically debugged at the computer and not at the machine.


The rotary function uses linear programming to approximate circular moves when they are needed. To allow the programmer the most flexible control of the system, the "CIRC TOL" command was added. The syntax of this command is:


CIRC TOL:nn


The numeric argument of this command represents the tolerance that POST must hold on the radius in order to create the shortest possible code. Increasing this tolerance will make the tape shorter, but the part integrity suffers. The default Circular tolerance is set at .0005.


The rotary function is exited by the "ROTARY OFF" command. This command returns the system back to the normal mode of operation. The syntax of this command is:


ROTARY_OFF



[ Home ] [ Geometry ] [ Programming ] [ Mill ] [ Lathe ] [ Punch ] [ Tape Editor ] [ Check (Mill) ] [ Check (Lathe) ] [ Check (Punch) ] [ Setup ] [ Download CAM Wizard Demo ]

Send mail to webmaster@swe-eng.com with questions or comments about this web site.
Please read our Usage Rules before using any information from this site.
Copyright © 2000 SWE Engineering
Last modified: June 10, 2002