Skip to content
UNIVERSITY OF CALIFORNIA, DAVISMECHANICAL AND AEROSPACE ENGINEERING
AEMS — Advanced Education for Manufacturing SystemsAn educational initiative
of ARMS Laboratory
TRAINING PAGE 02 · WRITE, PREDICT, VERIFY

Make the tool follow your plan.

Read a drawing, build a safe two-tool NC program, and watch each block move through the machine. Finish by creating a new program from a test print.

On this page5 visual lessons · complete program walkthrough · G02/G03 practice · program test
Start with program structure below.

Suggested sequence: Machining & cutting → NC programming → Machine operation. Each page can also be studied on its own.

Stock and datum80 × 60 × 10 mm. G54 X0 Y0 Z0 is at the top X−/Y− corner.
ToolsT01 Ø6 end mill for the rectangular path; T02 Ø4 drill for the hole.
Controller scopeFanuc-style teaching subset. Write explicit decimal points for metric axis values.
FROM THE MACHINING TRAINING

Turn the cutting plan into S and F words

For the T01 milling pass, start with the calculated spindle speed and table feed. Choose separate conditions for T02 drilling.

S1800 · F180

Practice values: Ø6 mm end mill, 2 effective teeth.

Revisit the cutting calculator
01 · PROGRAM BASICS

Read the structure and the command words

An NC program is a sequence of blocks. Learn what each section does before writing the complete test program.

Start here
PROGRAM ANATOMY

Preparation → cutting → completion

Select a section to see its purpose and representative blocks.

How to read a block: O names the program; N numbers a block; parentheses hold comments. G selects a motion or coordinate function, M controls a machine action, and X/Y/Z, S, F, T, H, and R provide values. The simulator checks only its listed teaching subset.

COMMAND ATLAS

Core commands in this lesson

The same word can affect later blocks until another command changes that state.

WordMeaning hereWhere you use it
G21 · G17 · G90Metric, XY plane, absolute positionsPreparation
G54 · G43 HWork origin and matching tool lengthBefore cutting with each tool
G00 · G01Rapid positioning · straight feed moveApproach, cut, retract
G02 · G03 · I · JClockwise / counterclockwise arc in G17; I/J locate its center from the startCircular milling at fixed Z
G91 G28 Z0.0Incremental return of Z to machine reference in this lessonBefore a tool change; restore G90 afterward
G81 · G99 · G80Drill cycle · return to R plane · cancel cycleDrilling
T · M06 · G43 HSelect tool, change tool, apply its lengthAt each operation start
S M03 · M05Set RPM and start clockwise spindle · stop spindleBefore and after cutting
F · M08 · M09Feed rate · coolant on · coolant offCutting and completion
M01 · M30Optional pause · program endFirst-cycle check and completion

G00/G01 and G90/G91 are modal: they remain active until changed. The exact behavior of physical controllers varies; use the simulator's own reference for this page.

INTERACTIVE CHECK

What does X20.0 mean now?

The tool is at work X10.0. Choose the position mode, then run one block.

LEARNING PATH

Before the program test

Use the command atlas to build a complete, readable sequence.

  1. Mark the datum and dimensions on the print.
  2. Choose units, plane, coordinate mode, and work offset.
  3. Call T01 and H01; verify clearance, then mill at feed.
  4. Retract Z, change to T02 and H02, then drill with G81.
  5. Cancel the cycle, retract, stop spindle/coolant, and end.
  6. Run Graphics and inspect every warning before the test run.

Practice with the worked example first. The final drawing changes the groove coordinates so the program must be built from the print.

02 · FROM PRINT TO MOTION

Connect the print, code, and tool path

These examples use a verified setup. Learn straight moves, circular moves, and drilling before writing the complete test program.

Illustrated lessons
LESSON 01

Read the part drawing

The dimensions describe the tool centerline and one drilled hole.

X+Y+G5480 mm STOCK60 mmX10 Y50X70 Y10Ø4 · X40 Y301015
Practice print · green dashes are the programmed cutter centerline; the cut is wider than this line.

The programmed Z−2.0 is 2 mm below the stock top. X and Y are measured from G54, not from machine home.

LESSON 02

Keep the tool clear

Watch the difference between a safe approach and a rapid into stock.

G00 at Z+20: clear travelG00 near partG01 to Z−2: cutting feedG54 Z0 · stock topVISE / SUPPORT
Blue dashes = rapid travel. Rust line = feed motion. The path must clear stock and vise.
Choose a motion
LESSON 03

Build the program in blocks

Tool, offset, spindle, coolant, approach, cut, retract, and tool change each have a job.

Block 1 / 9

LESSON 04

Make a circular move with G02 and G03

In G17, X/Y gives the endpoint; I/J gives the center's offset from the start. Direction is viewed from +Z toward the XY plane.

START X20 Y30END X60 Y30CENTERI+20 J0G02 · CWG03 · CCW
Top view: the same endpoints and center can make different semicircles.
G17 G90
G00 X20.0 Y30.0
G02 X60.0 Y30.0 I20.0 J0.0 F180

Start X20 Y30. I+20 J0 puts the center at X40 Y30. G02 follows the upper semicircle to X60 Y30.

Write the arc blocks

Assume G17 and G90 are active. Start at X20 Y30; end at X60 Y30 with center X40 Y30. Write one block for each half of the circle. Feedback updates while you type.

This simulator supports G17 XY arcs with I/J center offsets and a constant Z. I/J stay relative to the arc's start even under G90. It does not model R-format arcs or helical motion. Use the arc practice program in the studio to inspect the path.

LESSON 05

See the drilling cycle

G81 moves to the R plane, feeds to depth, and retracts. G80 ends the cycle.

R+3Z0Z−6G99 G81 Z−6.0 R3.0 F120Blue: approach · rust: feed · green: retract
Sectioned stock · all Z values are relative to the stock top in G54.

After the hole, cancel G81 with G80 before any ordinary XY move. The R plane must be above the programmed drilling depth.

03 · COMPLETE EXAMPLE

Read one full program from start to finish

This example mills the X10–70, Y10–50 rectangular centerline from Lesson 01, then drills at X40 Y30. Select a stage to trace its blocks and purpose.

Full program walkthrough
O1001 · TWO-TOOL EXAMPLE

Follow the setup, cut, tool change, drill, and end

The test print below changes the rectangular path to X15–65, Y15–45, so copy the sequence of decisions rather than the example coordinates.

Read the highlighted blocks in order, then use Load straight-line example in the editor below to step through the simulated path.

04 · PRACTICE AND FULL-PROGRAM TEST

Practice paths, then write a complete program

Use the worked example to explore the path, then start a fresh program for the test drawing. The verified setup is supplied for this page.

Interactive simulation
FULL-PROGRAM TEST

Write a complete program from this geometry

Use the editor below. The supplied machine setup is verified; your task is the entire part program from preparation through M30.

X+Y+G5480 mm STOCK60 mmX15 Y45X65 Y15Ø4 · X40 Y30
Test print · dashed path is the Ø6 end mill's centerline, not the outer edge of the cut.

Program requirements

  1. Set metric units, G17, absolute coordinates, and G54 at the stock's top X−/Y− corner.
  2. Use T01 with H01 to mill the rectangular centerline X15–65, Y15–45 at Z−2.0. The four edges can be cut in either direction.
  3. Retract clear, change to T02 with H02, and drill one hole at X40 Y30 to Z−6.0 using G81 with R+3.0. Cancel the cycle with G80.
  4. Use positive spindle and feed settings, coolant for the simulated aluminum job, clear travel, and a complete end sequence ending in M30.

Run Graphics to see the program assessment. It checks the simulated path and safety state, not just whether certain command words appear. The worked example and arc practice use different geometry.

EDITOR

Write the NC program

Programmed centerline: X15/Y15 to X65/Y45 at Z−2.0; drill X40/Y30 to Z−6.0.

Run Graphics to connect the editor to the path.

Practice examples use different geometry. The test drawing is above. Run Graphics to preview the path and assess a test draft.

SIMULATOR

Tool path and machine

Orbit by dragging. Step through the parsed motion, switch views, or replay the sequence.

Run Graphics to load a path.
05 · CONCEPT CHECK

Explain the code you wrote

Answer the concept checks and run Graphics on your test program. Results update as you work.

7 questions + program
1. What does G54 establish?

Use the job's top X−/Y− stock corner.

2. Which line applies the length for T02?
3. Why use G80 after drilling?
4. Which part of a typical program selects tools, offsets, and the work coordinate system?
5. With the tool at X10.0, where does G91 X20.0 end?
6. Start at X20 Y30. What center does I20 J0 define?
7. In G17, which command makes a counterclockwise XY arc?
0/7 answered