68
Chapter 9. NC Part Programming: Defining Geometry and Machining Plan (Motion) NC Program Storage Media Punched Card Tape (one inch wide) Magnetic Tape Floppy Disk and CD Transfer data through RS-232 interface from controller to computer using such protocols as Kermit and Xmodem. Also, some machines use local area network (LAN) instead of serial communications. Symbolic Codes Binary-Coded Decimal (BCD): eight-track punched tape is one common input media for NC machines American Standard Code for Information Interchange (ASCII): was formulated in 1979 to standardize the punched codes, but this is also used in computers and telecommunications. Many new NC systems accept both BCD and ASCII codes.

Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Embed Size (px)

Citation preview

Page 1: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Chapter 9. NC Part Programming: Defining Geometry and

Machining Plan (Motion)

NC Program Storage Media

Punched Card

Tape (one inch wide)

Magnetic Tape

Floppy Disk and CDTransfer data through RS-232 interface from controller to computer using such

protocols as Kermit and Xmodem. Also, some machines use local area network

(LAN) instead of serial communications.

Symbolic Codes

Binary-Coded Decimal (BCD): eight-track punched tape is one common

input media for NC machines

American Standard Code for Information Interchange (ASCII): was

formulated in 1979 to standardize the punched codes, but this is also used

in computers and telecommunications.

Many new NC systems accept both BCD and ASCII codes.

Page 2: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Tape Input Format (organization of words within blocks)

Page 3: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this
Page 4: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

• Address: An identifying letter inserted in front of each word.• Words: Each item of the program sheet, such as the sequence number, the

preparatory (G) function, and the X position, forms one word on the tape.

• Blocks: A block consists of all the items or words needed to instruct the machine

how to perform in any one position of the work piece. The way in which blocks are

arranged along the length of the tape is known as the block format.

Page 5: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Four tape inputs are used for NC: Fixed sequential format requires each NC block be the same length requiring all

values appear even if they are not required. Block address format eliminate the need for specifying redundant information in

subsequent NC blocks through a change code. All data must contain a predefined number of digits.

Tab sequential format has the words listed in a fixed sequence and separated by the tab key. Each tab will skip the redundant data.

Page 6: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Block Address Format and G-code program

A block of NC part program consists of several words and a program written in this data format is called NC program (or simply g-code). A NC program can contain any of following word addresses (word = address + value).

N,G,X,Y,Z,A,B,C,H,I,J,K,F,S,T,R,M,U,V,W

N-code: The N-word specifies the sequence number to identify the block within the program.

G-code (preparatory code): prepares the MCU for control functions.

Page 7: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

X,Y,Z,A,B,C,U,V,W-codes: provide coordinate position of the tool. X,Y,Z are for translational (Cartesian) axes and A,B,C are for rotational axes about X,Y,Z axes. U,V,W are incremental X,Y,Z.

Ex. Move the cutter to a new position (1.12, 2.275, 1.0)X1.12 Y2.275 Z1.0

Page 8: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

G-code [0-9]

All G codes listed are for RS-274 compatible CNC controls.

Motion Class [G00 – G09]G00: rapid traverse code (PTP)G01: linear interpolationG02: CW circular interpolationG03: CCW circular interpolationG04: dwellG08: accelerationG09: deceleration

Page 9: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Presets and Plane Selection G-Codes [G10 - G19]G17: X-Y planeG18: Z-X planeG19: Y-Z plane

G10-G19

Page 10: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Unit Selection G-Codes and Machine Coordinate Motion [G20 - G29]

G20-29

Page 11: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Feedrate Control and Threading [G30 – G39]

G30-39

Page 12: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Tool Compensation Codes [G40 - G49]G40: cutter compensation – cancelG41: cutter compensation – leftG42: cutter compensation – right

G40-49

Page 13: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Tool Radius Compensation

The tool compensation (sometimes, cutter radius compensation [CRC])

commands will effectively compensate the tool-path along the tool-path

direction (the program knows all tool-paths).

Start and End of Compensation

If G41 or G42 and G01 are in the same block, there will be a gradual

effect of compensation (ramp-up block).

N0020 G01 G41 X0.500 Y2.000

N0030 G01 X2.500 M96

Note that the tool moves along the hypotenuse of a right triangle in the

ramp compensation with right angle at the destination point.

Page 14: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

If G41 or G42 and G01 are in separate blocks from X and Y, the

compensation is effective from the start of the block

N0010 G41

N0020 X0.500 Y2.000

N0030 G01 X2.500

G40 also works same way as G41 and G42 in opposite way.

N0070 G40 X3.000 Y2.000 M02

N0070 X3.000 Y2.000

N0080 G40 M02

Page 15: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Fadal® CNC Controls: Use of M96 and M97

with M96 the controller adds an additional block for circular arc at the

corner, while with M97 the cutter moves to machining point.

If a step to be machined is smaller than the cutter radius, M97 must be used

instead of M96. Note that a fillet is used than sharp corner in design.

For a 3D corner, both M96 and M97 produce different results as below.

Cornering

Page 16: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Fanuc® CNC Controls: Use of G09 or G61 and G64

Non-modal exact stop check command: G09

Modal exact stop check command: G61 and G64 (to cancel)

G01 G09 X40

Note that G09 is effective after the motion to X40. Also, it is non-modal

command and works only for one step while G61 is modal command and

effective until it is cancelled.

Page 17: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Transformation and Coordinate System G-Codes [G50 - G59]

G50,51: scaling and mirroringG52: shift the workpiece zero (i.e., part zero) point of the program

created in the work coordinate system (G54 - G59)

G50-59

Page 18: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

G60-69

Machine Specific G-Codes [G60 - G69]

G65,66,67: macro programsG68,69: CS rotation code

Page 19: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Repetitious Cycle G Codes [G70 - G79]G70: inch formatG71: metric formatG74: full circle programming offG75: full circle programming on

G70-79

Page 20: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

H-code: used for tool length offsetEx. G43 H2

T-code: when automatic tool changer is available, T-code specifies the tool number.Ex. T2 M6

R-code: specifies the clearance height (i.e., R-plane) for cycle parameter such as drilling.

Ex. N0020 G81 X1.0 Y2.0 Z0.0 R1.3N0030 G80

H,T,R-Codes

Page 21: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

M-code: machine-specific (i.e., vendor-specific) and used for miscellaneous words to control miscellaneous functions such as start on/off, spindle on/off, turn on/off the coolant, laser on/off, change the tool, and rewind the program. Some example codes are

M00: program stop M01: Optional stop M02: end of the program M03: spindle CW M04: spindle CCW M06: tool change M07: flood coolant on M08: mist coolant on M09: coolant off M30: end of tape

M-Code

Page 22: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Manual Part Programming (Motion)

In manual programming, the machining instructions are recorded on a

document called a part-program manuscript by the part programmer.

Because a part program records a sequence of tool motions and

operations to produce the final part geometry, one must prepare a

process plan with setups and fixtures before writing the program

where the workpiece location and orientation, features (holes, slots,

pockets) to be machined, tools and cutting parameters used need to

be determined.

Page 23: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Safety Blocks

Safety Blocks at Beginning of the NC Code

One good practice in writing NC part programs is that all NC programs should

start with what are called Safety Blocks of G and M codes at the start of the NC

program. Even though some CNC controls set motion and register defaults

themselves at program start, not all do and keep using whatever parameters

were active last time. One example of the safety block is shown below.

N10 G90 G70 G40 G49 G17 G80 G53 G00

Here, G90 programming in absolute coordinates (incremental coordinates

G91), G70 defines inch unit (G71 for metric unit), G40 cancels any XY cutter

compensation, G49 cancels the tool length compensation [the tool length

command is used mostly for multiple tool NC programs so that each tool will

cut to the correct depth, regardless of how far it extends out of the holder], G17

sets the plane to the XY plane for arc motion, G80 cancels any canned drill

cycles, G53 cancels any work coordinate shift, and add a default motion code

by putting a G00 since the initial move is almost always a rapid position move

from the home location to the program start point.

Page 24: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Program Entry Moves (NIST: National Institute of Standards and Technology)

Two pre-entry moves and one entry move are generally required. Two methods, general method and simple method, are used for entry moves.

N0010 G1 X1 Y5 (to C)

N0020 G1 G41 Y4 (to B)

N0030 G3 X2 Y3 I1 (to A)

… …

Page 25: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Another case where the entry point is given on the concave arc as below can be handled in same way.

Page 26: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this
Page 27: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Ex.1. Part Programming for Laser Cutting

The laser machining on a table is basically two-dimensional machining and can be assumed zero cutting width. The laser beam focal radius can be very small less than 1/1000 inch. The following is two-dimensional CAD drawing of a thin part. Make a part program to

cut out the part by laser. Exclude the letters in the middle.

Page 28: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

The following shows the sequence of cutting when a automatic converter software is used to convert the 2D drawing DXF file to NC file. The sequence depends on the order of the way the drawing was created. This is neither efficient nor correct. Keeping in mind that the outline must be machined last, make a program for continuous cutting

when possible.

Page 29: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Geometries for Program

Page 30: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

F100

L1

G92X0Y0

M88

G0 X0.5417 Y0.0017

M90

G2 X0.5417 Y0.9983

I-0.0417 J0.4983

M91

G0 X0.3000 Y0.3000

M90

G1 X0.7000 Y0.3000

G1 X0.7000 Y0.7000

G1 X0.3000 Y0.7000

G1 X0.3000 Y0.3000

M91

G0 X1.7333 Y0.1014

… … …

… … …

M90

G1 X1.3529 Y0.4897

G1 X1.3359 Y0.4897

M91

G0 X1.3359 Y0.5077

M90

G1 X1.3529 Y0.5077

M91

M89

M30

F100: defines the feed rate 100 in/min

G92: set a point as the new origin of

coordinates that is referenced by

subsequent absolute positioning

L1: material selection defined previously

M88: shutter open for smoke removal

M89: shutter close

M90: laser on for cutting

M91: laser off

Programming Tip

1. Cut the outline last

2. Make continuous cutting if possible

Page 31: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Ex.2 Fadal CNC ControlsExample [NC Program with Fadal® CNC Controls] Make a NC program for the

following part with tool compensation. The tool diameter of #1 is 0.5 inch. The spindle speed is 5000 rpm and the federate is 25 ipm for plunging and 50 ipm for interpolation. Starting point is SP. The machining must start from A and then move counterclockwise. At the end of cutting move the tool to the starting point with gradual cancellation of the tool compensation. The retract plane is z=0.5 and the feed plane is z=0.1. Plunge cut to z=-0.3 for the workpiece of thickness 0.2 with top at z=0. The point A is located at (1,1) and SP is the starting point.

Page 32: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

What must be done if one wants to move directly to A’?

Page 33: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

N100 G20N102 G0 G17 G40 G49 G80 G90 [safety block]N104 T1 M6N106 G0 G90 G54 X0. Y0. A0. S5000 M3N108 G43 H1 Z0.N110 Z.5 [to retract plane]N112 X-1. Y2. [any point in upper left side of A] N114 Z.1 [to feed plane]N116 G1 Z-.3 F25.N117 G42 X1. Y1. F50. [tool compensation right]N118 X3.8 M96 [modal, default in some machines]N120 Y1.9351 N122 G2 X2.8155 Y3. I.3 J1.2649N124 G1 X2.2N126 Y2.8 M97N128 X1. M96N130 Y1. N132 Z-.2 F125. [off machining surface, good practice]N134 G0 Z.5 [to retract plane]N136 G40 X0. Y0. [tool compensation cancel]N140 M5N142 G91 G28 Z0. [to machine zero thru z0]N144 G28 X0. Y0. A0. [to machine zero thru x0,y0,A0]N146 M30

Page 34: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Computer-Assisted Part Programming

In computer assisted part programming in CAM that has almost

replaced standalone APT’s, general purpose computers are used

as an aid to programming and special-purpose high level

programming languages perform the various calculations

necessary to prepare the CL data. There are two major part

programming languages:

Machine-oriented languages create tool paths with all

necessary calculations processing the special coordinate-data

and coding for speed and feedrate

General purpose languages break down the computer

processing into two: preprocessing and post-processing. The

processing state produces an intermediate data points for

cutter location (CL). There are three steps

Translate input symbols

Arithmetic calculations

Cutter offset calculations

Page 35: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

In computer assisted part programming

Machine-oriented languages

General purpose languages

EIA RS-494B provides a new standard for computer numerical

control that allows different machines operate from the same

input data. This standard is “Standard for 32-Bit Binary CL

Exchange (BCL) Input Format for Numerically Controlled

Machines.” The BCL format represents NC machining input data

that are 32-bit binary integer words. The contents of this record

closely parallels the contents of CL data record in ANSI

Programming Language APT. A BCL file is typically produced by

a part-oriented post-processor call a BCL converter. The BCL

format appears as:

FILE HEADER (optional)

PARTNO (optional)

UNITS record

DATA record

(continue)

DATA record

END OF FILE record

Page 36: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

EIA-RS-494 is a 1983 Binary Cutter Location (BCL) standard for CNC.

[From Wikipedia, 11/13/2012] Here is a list of Electronic Industries Alliance (EIA) Standards. The EIA ceased operations on February 11, 2011, but the former sectors continue to serve the constituencies of EIA. EIA designated ECA to continue to develop standards for interconnect, passive and electro-mechanical (IP&E) electronic components under the ANSI-designation of EIA standards. All other electronic components standards are managed by their respective sectors. ECA is expected to merge with the National Electronic Distributors Association (NEDA) to form the Electronic Components Industry Association (ECIA). However, the EIA standards brand will continue for IP&E standards within ECIA. As currently authorized, any ANSI standard designated at ANSI EIA-xxx is developed and/or managed by ECA (and, in the future, ECIA).

EIA-RS-494

Page 37: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Computer-Assisted Part Programming by

Pro/Manufacturing > CL Data

Page 38: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

APT (Automatically Programmed Tool)

More than 100 part-programming languages have been developed since

1956 and some have stood the test of time and did not. APT has been the

most popular part-programming language and employed by most CAM

systems. Summary characteristics of APT is given below

Three dimensional unbounded surfaces and points are defined to

represent the part

Surfaces are defined in a X-Y-Z coordinate system chosen by the part

programmer

In programming, the tool does all the moving; the part is stationary

The tool path is controlled by pairs of three-dimensional surfaces;

other motions, not controlled by surfaces, are also possible

A series of short straight-line motions are calculated to represent

curved tool paths (linear interpolation)

The tool path is calculated so as to be within specified tolerances of

the controlling surfaces

The X, Y, and Z coordinates of successive tool-end positions along

the desired tool path are recorded as the general solution to the

programming problem

Additional processing (postprocessing) of the tool-end coordinates

generates the exact tape codes and format for a particular machine

Page 39: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

An APT processor interprets and computes the cutter path,

whereas a post-processor translates the cutter-path to a

format acceptable by a specific machine.

1. Identification statements. These define a specific project.

2. Geometry statements. These define a scaler or geometric

quantity.

3. Motion statements. These describe a cutter path, such as

GOLFT.

4. Postprocessor statements. These define machining

parameters such as feed, speed, coolant on/off and so on.

5. Auxiliary statements. These describe auxiliary machine-tool

functions to identify the tool, part, tolerances, and so on.

Page 40: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Programming Language APT (revision, redesignation and consolidation of ANSI X3.37-1995, ANSI X3.37-1995/AM 2-1998, ANSI X3.37-1995/AM 1-1998) (formerly ANSI INCITS 37-1999)

Establishes the form for, and the interpretation of ,programs expressed in the Automatically Programmed Tools (APT) language and of the System-Neutral CLFILE (SCL), which can be generated by processors, such as APT, or by graphical systems. The purpose is to promote portability of these input language programs to a wide variety of computers. In addition, the SCL permits commonality and portability, regardless of the source that produces it, to a wide variety of manufacturing equipment. APT is an English-like language for describing operations for numerically controlled machines. An APT language input program is converted by a computer processor and, probably, subsequently by a postprocessor into an ordered set of instructions for numerically controlled machines.

ANSI INCITS 37-1999

Page 41: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

APT: Part Definition (Geometry)

Geometry Statements Creating entities such as points, lines, circles, planes, cylinders, cones, and

spheres structure

variable = function name / function description

Page 42: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Point Definitions

PT=POINT/X,Y,Z

PT=POINT/INTOF,LINE1,LINE2

PT=POINT/MODIFIER,INTOF,LINE1,CIRCLE1

where Modifier options are {xlarge,xsmall,ylarge,ysmall} PT=POINT/MODIFIER,INTOF,C1,C2

PT=POINT/CIRCLE,ATANGL (in degrees)

PT=POINT/CENTER,CIRCLE

PT=POINT/MODIFIER,INTOF,LINE,CONE (intersection of a

line with a cone)

PT=POINT/INTOF,PLANE1,PLANE2,PLANE3(intersection of

three planes

PT=POINT/RTHETA,XYPLAN,RADIUS,ANGLE (polar

coordinates)

PT=POINT/INTOF,LINE,TABCYL,TABC1 (Intersection of a line

and a tabulated cylinder)

PT=POINT/PATTERN,N (Point as Nth location of a pattern)

Page 43: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Line Definitions

Ln=Line/x1,y1,z1,x2.y2.z2 (Line thru a pt and tangent to

a circle)

Ln=Line/point,modifier,tanto,circle (Line tangent to two

circles)

Ln=Line/modifier,tanto,circle1, modifier,tanto,circle2

(Line tangent to two circles)

Ln=Line/point,atangl,axis (Line thru a pt and making an

angle w/axis )

Ln=Line/point,slope,value(Line thru a pt and having a

slope )

Ln=Line/xaxis (or yaxis) (Line on a axis)

Ln=Line/point,slope,value,line2(Line thru a pt and having

a slope wrt another line)

Ln=Line/point,parlel,line(Line thru a pt and parallel to

another line)

Ln=Line/point,perpto,line(Line thru a pt and

perpendicular to another line)

Ln=Line/parlel,line,modifier,offset value(Line parellel to

another line given offset distance)

Page 44: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Ln=Line/intof,plane1,plane2 (Line given by intersection of

two planes)

Ln=Line/atangl,value,interc,modifier,value

Ln=Line/point,tanto,tabcyl (Line in x-y plane passing thru

a pt and tangent to a tabulated cylinder)

Ln=Line/point,perpto,tabcyl (Line thru a pt and

perpendicular to a tabulated cylinder)

Page 45: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Ex.3 (programming for geometry)

Introduce a coordinate and label geometric entities and define the

geometries that can form the part. Define all points and then lines

using the points defined before.

Page 46: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Planes Definitions

Plane requires three points for complete definition. Plane by equation: PL=plane/a,b,c,d in equation ax+by+cz-d=0 Plane by 3 pts: PL=plane/pt1,pt2,pt3 Plane thru a pt and parallel to another plane: PL=plane/pt,parlel,pl2 Plane parallel to another plane at a distance:

PL=parlel,pl2,modifier,value, modifier={xsmall,xlarge,ysmall,ylarge,zsmall,zlarge}

Plane thru a point and perpendicular to a vector: PL=plane/pt,perpto,vector1

Plane thru two pts and perpendicular to another plane: PL=plane/pt1,pt2,perpto,pl1

Plane perpendicular to two planes and thru a pt: PL=plane/pt,perpto,pl1,pl2

Page 47: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Definition of Circle

By a center and a radius: C=circle/center,pt1,radius,value By a center and tangent to a line: C=circle/center,pt,tanto,line By a center and a pt on its circumference: C=circle/center,pt1,pt2 on

circumference By three pts: C=circle/pt1,pt2,pt3 By a center and a tangent to another circle:

C=circle/center,pt1,modifier (large or small) By a radius and two intersecting lines:

C=circle/tanto,line,modifier,pt,radius,value By a radius tangent to a line and thru a pt:

C=circle/tanto,line,modifier,pt,radius,value By a radius tangent to a line and another circle: C=circle/

modifier,line, modifier,in/out,C2,radius,value By a radius and tangent to two circles: C=circle/

modifier,in/out,C2,in/out,C3,radius,value By a radius tangent to a line and a tabulated cylinder:

C=circle/tanto,line1,modifier,tabcyl, modifier,point (closest pt), radius, value

Page 48: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Definition of Cylinders

cy=cylinder/x,y,z,a,b,c,radius cy=cylinder/center_pt,axix_vector,radius tc=tabcyl/modifier1,modifer2,[trform,m],data

where modifiere={nox,noy,noz,rtheta,thetar}and tabulated cylinder is a surface created by a curve and

a vector

Suf=rldsuf/suf1,p1,p2,p3,suf2,p4,p5,p6A ruled surface is created blending two curves.

Page 49: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Ex.4 (cylinder)

Introduce a coordinate and label geometric entities and define the

geometries that can form the part. Start with lines if possible to define

entities.

Page 50: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Ex.5 (surfaces)

Introduce a coordinate and label geometric entities and define the

geometries that can form the part. Start with lines if possible to define

entities.

Page 51: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Additional Definitions

Elips = ellipse/center,pt,semi-major axix length,

semi-minor axis length, semi-major axis angle.

Hyp = hyperb/center, pt, length of half transverse

axis, angle of transverse axis

Cn = cone/x,y,z,a,b,c,angle

where x,y,z and a,b,c are vertex and base center

coordinates

Cn = cone/point,vector,angle

Vc = vector/x,y, z

Vc = vector/pt1,pt2

Vc = vector/perpto,plane,modifier

where modifier = {posx,posyposz}

Vc = vector/vec1,cross,vec2

Ptrn = pattern/linear,pt1,pt2,no_of_pts

Ptrn = pattern/linear,pt,vec,incr,no_of_incr,at,d

Ptrn = pattern/linear,pt,vec,incr1,incr2,incr3, …,incrn

Ptrn = pattern/radial,incr_angle,total_angle,ccw,N

Page 52: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Ex.6 (part)

Introduce a coordinate and label geometric entities and define the

geometries that can form the part. Start with lines if possible to define

entities.

Page 53: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Motion Statement

Basic motion statements are based on three surfaces that guide the

tool in three-dimensional space. They are

Drive Surface

Part Surface

Check Surface

Page 54: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

There are two types of motion;

point-to-point (PTP) motion for rapid traversing without cutting

contouring for continuous material removal in three-dimensional space.

Page 55: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

GOTO and FROM Statement

GOTO / a point

This is a PTP statement for rapid motion.

FROM / a point

This is to start a motion from.

Page 56: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

GO Statement

This is for contouring.

TO TO TO

GO / ON, Drive Surface, ON, Part Surface, ON, Check Surface

PAST PAST PAST

TANTO

The modifier TANTO is only used by check surface.

On PS

DS

CS

GO/TO,DS,TO,PS,TO,CS

On PS

DS

CS

GO/TO,DS,TO,PS,ON,CS

On PS

DS

CS

GO/TO,DS,TO,PS,PAST,CS

On PS

DS CS

GO/TO,DS,TO,PS,TANTO,CS

Page 57: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Ex.7

Example [Part Program] Make an APT program for the following part with

tool compensation using APT. Use POINT, LINE, CIRCLE to define

geometry first, and then use motion statements such as FROM, GOTO,

GO. Starting point is SP from which move to the point A and then move

counterclockwise. At the end of cutting move the tool to the starting point.

Ignore all other commands. The point A is located at (1,1) and SP is at the

origin. The cutting precision of machine is 1/1000 in. Assume the tool

moves tangent to the part surface PL1 that is positioned at z = 0.

Page 58: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Solution

SP = POINT / 0,0,0

PTA = POINT / 1,1,0

PTB = POINT / 3.8,1,0

PTC = PONT / 3.8,1.735,0

PTD = POINT / 2.815,2.8,0

PTE = POINT / 2.2,2.8,0

PTF = POINT /2.2,2.6,0

PTG = POINT / 1,2.6,0

LNAB = LINE / PTA,PTB

LNBC = LINE / PTB,PTC

CIRCLECD = CIRCLE /

POINT(4.1,3.2,0),PTB,PTC

LNDE = LINE / PTD,PTE

LNEF = LINE / PTE,PTF

LNFG = LINE / PTF,PTG

LNGA = LINE / PTG,PTA

FROM / SP

GO / TO,LNAB,TO,PL1,ON,LNAG

GO / TO,LNAB,TO,PL1,PAST,LNBC

GO / TO,LNBC,TO,PL1,PAST,CIRCLECD

GO / TO,CIRCLECD,TO,PL1,PAST,LNDE

GO / TO,LNDE,TO,PL1,PAST,LNEF

GO / TO,LNEF,TO,PL1,TO,LNFG

GO / TO,LNFG,TO,PL1,PAST,LNGA

GO / TO,LNGA,TO,PL1,ON,LNAB

GOTO / SP

Page 59: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Relative Motion Statement

Point-To-Point (PTP) Motion

GODLTA / coordinate increment

Contouring Motion

• COMMAND / (TO) Drive Surface, TO/ON/PAST/TANTO, Check SurfaceHere, the command can be any one of the followings

GOLFT move left along the drive surfaceGORGT move right along the drive surfaceGOUP move up along the drive surfaceGODOWN move down along the drive surfaceGOFWD move forward from a tangent positionGOBACK move backward from a tangent position

Page 60: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Ex.8

Example. Assuming all geometric entities have been defined

as shown in the figure and the hypothetical part plane is

PL1, make a possible APT motion program to cut the part.

Page 61: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Solution.

FROM / START

GO / TO,L1,TO,PL1,ON,L3

GORGT / L1,TANTO,C1

GOFWD / C1,TANTO,L2

GOFWD / L2,PAST,L3

GOLEFT / L3,PAST,L1

GOTO / START

Note: GOLFT and GORGT for next

motion are relative to the direction

of the current motion.

Page 62: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Miscellaneous Statements

Macro is a set of instruction that can be repeatedly used. (i.e.,

subroutine in Fortran or function in C language)

Ex. DRILL = MACRO

GODLTA/0,0,-0.5

GODLTA/0,0,+0.5

TERMAC

Looping can be programmed just like any other structured

programming using LOOPST and LOOPND.

PATTERN command defines a set of points and CYCLE command can perform manufacturing operations at those

pointsEx. Suppose a pattern of points has been defined in PTN2. Then,

CYCLE/DRILL(…, list of parameters)GOTO/PTN2CYCLE/OFF

Page 63: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Ex.9

y

x

Hole depths are 0.5

(1,2)

(2,3)

(2,4)

(4,3)

RESERVE/PNT,6

LOOPST

STARTY=3

J=1

4 I =1

STARTX=2

5 PNT(I)=POINT/STARTX,STARTY,1

IF(I-3) 6,8,8

6 I = I + 1

STARTX = STARTX + 2

JUMPTO/5

8 IF(J-2) 9,10,10

9 J = J + 1

STARTY = STARTY + 1

JUMPTO/4

10 LOOPND

The following program shows how to drill

holes in a certain pattern.

Page 64: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Ex.10 Motion Commands for Milling

The following part is to be machined by milling. The work piece is 4 x 5 x

1.6 inches and low-carbon steel. Assume the milling machine is 3-axis

CNC.

Page 65: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Process Plan:

1.Set the lower left corner of the part as the machine zero-point.

2.Clamp the work piece in a vise.

3.Mill the slot with a ½ in four-flute flat end mill made of carbide.

From the Machinability Data Handbook, the recommended feed

is 0.005 in/tooth/rev and recommended cutting speed is 100 fpm

4.Drill four holes with a 0.5-in-diameter twist drill. Use 0.18 ipr feed

and 100 fpm speed.

Page 66: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Machining Specifications

Despite the great deal of standardization through programming

languages like APT and computer-assisted part programs, these

standards are not so apparent in hardware as in software. As a result,

the APT program has to be post-processed for a particular machine.

Typical post-processor commands include:

MACHIN/ calls a machine tool

COOLNT/ coolant fluid can be turned on and off.

FEDRAT/ feed rate is specified

SPINDL/ spindle speed is specified

TURRET/ call a specific tool from tool changer

END forces to stop the machine so that the operator can

change a tool manually or inspect the part.

Page 67: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

Tolerance Setting

Nonlinear motion along a curve is achieved by a set of continuous

straight line segments. The tolerance statements dictate how many

line segments to be generated for contouring motion.

Either one or both may be specified.

OUTTOL / 0.002

INTOL / 0.001

Page 68: Chapter 9. NC Part Programming: Defining Geometry and · Block Address Format and G-code program A block of NC part program consists of several words and a program written in this

CL Data to MCD

CAD/CAM system

• effectively creates geometry (i.e., modeling)

• adds PMI (product manufacturing information)

• produces engineering drawings

• produces CL data in tool-path simulation by CAP programming

like APT

• helps to convert CL data to machine control data (MCD) for

machining in post-processing. MCD = NC control codes