CAM Wizard N/C Programming Software


POST Processor - Punch


POST is the post processor program that creates the N/C code for machining the part on a punch 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.


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 will be 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 and CTRL-Q are two keystrokes that will suspend program execution for the code being generated by the system to be examined by the programmer in relation to the instructions given.



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.


"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. default value=tool radius


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


ADD nn - tells the POST how much material is to be allowed for in the G92 block.


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.



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.


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 takes the following syntax:


( TOOLn = nn ROUND )

( TOOLn = #nn ROUND )

( TOOLn = nnXnn OBROUND )

( TOOLn = nnXnn RECT )




The value after the "=" character is taken as being the tool diameter. This value is used in the calculation of the tool offset 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.


The tool description string will be used to determine the type of tool ( "ROUND", "OBROUND", " RECT" ) used and will effect the tool path generated for that tool 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.


The "TOOL" command has the following syntax:


TOOLn {Pn Cn SHAPEn} Rn Zn FnSn {'S}


At the tool change, the POST will recalculate the default tool radius offset. 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 punching a circle, rectangle, slot, or shape if they are specified, otherwise the present position will be used.


"'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.




The PUNCH Command

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


PUNCH Xnn Ynn Pn {Pn} PUNCH nnHOLES PUNCH LAYERn


In punching, POST determines what locations to punch 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 punch a hole at the present location. Any elements shown or series of elements can be punched from the first specified to the last specified. Holes can be punched using the " HOLES" parameter. If the hole size is not specified on the command line, the hole size will be assumed to be that of the punch. Entire layers can be punched by specifying that layer by number or name.


Punching commands can also be used for punching rectangles, slots, circles, or shapes.


PUNCH_Cn {Cn} Xnn Ynn {PASSn}

PUNCH_SLOTn {SLOTn} Xnn Ynn {PASSn} {'R}

PUNCH_RCTn {RCTn} Xnn Ynn {PASSn} {'R}

PUNCH_SHAPEn {SHAPEn} Xnn Ynn {PASSn} {'R}


The words "RCT" and "SLOT" can be used to specify shapes that are rectangles or slots using that shapes number. Shapes are punched by round, obround, rectangular, and square tools in different ways. Round tools will always nibble the shape using canned cycles if appropriate. Any shape that can be milled by the milling POST can be punched by the punch POST using this nibbling technique. Obround punches, as well as round punches, can be used to punch slots. These tools will punch only slots that are the same minor diameter, but will make more than one hit if the length of the slot is not the same as the length of the tool. Rectangular shapes punched using " RCT" will punch out the center of that shape a "Slugless Window" if the tool will fit 1 1/2 times inside that shape in both directions. If the shape has a radius, then the radius will be left and the tool will punch the outside edge of the rectangle up to the radius.


The PUNCH Command

The "'R" option instructs POST to punch only radii and not linear segments of the contour being punched with a round tool. Square and rectangular tools can also be used to punch shapes. When used, these tools will punch as much of the linear edge of the contour as possible. Square and rectangular punches will not nibble around an arc.


The PUNCH Command

In creating the code for punching, the 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 punch command. 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.




GRID/END GRID

The GRID command can be used to define a grid pattern of points, slots, rectangles, or shapes to be punched. This pattern is automatically expanded by the POST, or coded using grid pattern codes, depending on the machine being programmed. The syntax of the GRID command is as follows:


GRID Xn:nn Yn:nn

   commands...

END GRID


The n after X represents the number across in X and the nn after the ":" represents the X distance between patterns. The n after Y represents the number across in Y and the nn after the ":" represents the Y distance between patterns. When GRID is used, every tool change and the associated punch commands for that tool will become a macro which will be called by a grid command as specified by the MACH n.DEF file for that machine.




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



[ 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