Breaking edges is a small operation that eats a surprising amount of programming time. Each part needs a slightly different depth, angle or set of sides, and hand-writing the passes is where mistakes creep in. The Shader7 CNC Machinist hub has two generators for this:

Both write Fanuc Macro B style code with the key values stored in # variables, so you can adjust a depth or angle at the control without regenerating the program.

The chamfer generator with its settings panel, live toolpath preview and generated macro
The chamfer generator with its settings panel, live toolpath preview and generated macro.

Part 1: Circular Chamfer Macro Generator

What it makes

The circular generator mills a cone-shaped chamfer at the top of a bore. It starts at the top depth, takes a full circle at the radius that matches the chamfer at that height, steps down, and repeats until it reaches the final depth, where the radius equals the base diameter. A final pass runs exactly at the base.

Settings

Field Variable What to enter
Start Depth #1 Z of the first pass, usually the top face (for example 0)
Final Depth #2 Z at the bottom of the chamfer (for example −1.5)
Base Diameter #3 Bore diameter at the final depth
Chamfer Angle #4 Angle of the chamfer wall from the vertical (45 for a standard 45° chamfer)
Z Step #6 Depth of each pass
Tool Offset Register D #7 The D register that holds your cutter radius
Cut Feedrate F Feed for the circular passes
Retract Feedrate F Feed for moving back to the centre
Safe Z Retract Z height at the end of the program
Program Number O The program number
Spindle Command M141 S500; M103 for gear-head machines, or M03 S500 for a standard spindle

Start Depth must be higher than Final Depth; the app stops with an error message if it is not.

How the macro works

The generated program moves to the bore centre (X0 Y0), then runs a WHILE loop:

WHILE[#1 GT #2] DO1
#9=ABS[#1-#2] (DISTANCE TO BASE)
#5=[[#3/2]+[#9*TAN[#4]]] (CURRENT RADIUS)
G90 G1 Z#1 F...
G91 G1 G41 D#7 X#5 F...
G03 X0 Y0 I-#5 J0
G1 G40 X-#5 F...
#1=#1-#6 (NEXT PASS)
END1

At each level, the radius is the base radius plus the height above the base times tan(angle). For a 45° chamfer the radius grows by exactly the height. The cutter moves out from the centre with cutter compensation (G41) on, cuts a full counter-clockwise circle (G03, climb milling in a bore), and returns to the centre with compensation cancelled.

Example: base diameter 20 mm, 45°, start 0, final −1.5. The top pass is at radius 10 + 1.5 × 1 = 11.5 mm, so the finished chamfer is 23 mm across at the top face.

Preview

The live toolpath preview shows the base diameter as a blue circle, the chamfer's outer diameter as a dashed green circle and each step-down pass as an orange circle. If the green circle is bigger than the feature you expect, check the angle and depths.

Before you run it

  • Set the D register. Cutter compensation uses the radius stored in the D register you choose. For a chamfer mill, enter the radius at the height that is cutting, not the shank radius.
  • Position over the bore. The program assumes X0 Y0 is the bore centre. Set G54 there or shift the offset.
  • Check the end. The program ends with M0 (stop) so you can inspect the edge. Change it to M30 if it is a full program on its own.
  • Use Download .NC or Copy Code to move the program to your control, then verify it in the control's graphics before cutting.

Part 2: XY Chamfer Generator

What it makes

The XY generator chamfers the outside edges of a rectangular part. It works inside-out, enters and exits each side at 90° to the cutting direction using a safety offset, and finishes one complete side before moving to the next.

Settings

  1. Part Geometry & Origin: Length (X), Width (Y) and where G54 X0 Y0 sits: centre or any of the four corners.
  2. Machining Sides: tick +Y (top), −Y (bottom), −X (left) and +X (right), or use Select All / Clear All. The preview highlights active sides in teal.
  3. Macro Variables: - #1 Start Z and #2 Final Z - #3 DOC, the depth per pass - #4 Angle of the chamfer - #5 Tool Dia - #6 XY Safety, the clearance used for entry and exit - #9 Z Retract / Safe Z
  4. Tool, Feed & Direction: Tool No., Offset D, Feed, RPM, the spindle code (M03 or M141 / M103), and Cut Direction Mode.

Single or double direction

  • Single Direction retracts to safe Z after every pass and always cuts the same way. Choose it when finish and consistency matter most.
  • Double Direction keeps the tool down and links passes along the same connected chain of sides, cutting back and forth. Choose it to save time on deburring work.

How the program is built

The program stores the raw stock limits in #101 to #104 and calculates the chamfer offset for each pass from the depth and angle:

#8=[ABS[#2] - ABS[#1]] / TAN[#4] (OFFSET)

It then shifts each active side by that offset, so deeper passes move the tool inward along the bevel. The header also includes the tool change (T.. M06), the tool length offset (G43 H..) and coolant (M08).

Chamfer toolpath geometry: each deeper pass shifts the tool along the bevel
Chamfer toolpath geometry: each deeper pass shifts the tool along the bevel.

Choosing depth, angle and tool

  • Plunge below the chamfer width. Cutting with the middle of a chamfer mill's flank gives a cleaner edge and protects the fragile tip.
  • Angle convention. Both generators use the chamfer angle in the tan() term. Check the result on the preview or with one manual calculation before cutting.
  • Small passes for hard materials. A Z step of 0.2–0.5 mm is a sensible start in steel; aluminium tolerates more.
  • Burr direction. Climb milling (G03 inside a bore) usually leaves a smaller burr and a better finish.

Worked example: deburring a 30 mm bore

You want a 1 mm × 45° chamfer on the top edge of a 30 mm bore using a 90° chamfer mill.

  1. Start Depth (#1): 0 (the top face).
  2. Final Depth (#2): −1.0 (the chamfer depth).
  3. Base Diameter (#3): 30 (the bore diameter at the bottom of the chamfer).
  4. Chamfer Angle (#4): 45.
  5. Z Step (#6): 0.25, for four passes plus the final pass.
  6. Tool Offset Register D (#7): the register holding the chamfer mill's effective radius.
  7. Choose your feeds, safe Z, program number and spindle command, then Generate Macro.

The top pass runs at a radius of 15 + 1 × tan 45° = 16 mm, so the chamfer is 32 mm across at the top face, giving the 1 mm chamfer you want. The preview shows the 30 mm base circle in blue and the 32 mm outer circle dashed in green.

Troubleshooting chamfers

Problem Likely cause Fix
Chamfer too small D register radius too large, or depth too shallow Check the effective radius in the D register; increase #2
Chamfer too big D register radius too small Measure the tool and correct the D value
Chatter marks Too much tool overhang or feed too high Shorten the tool, reduce feed or Z step
Burr on the bore wall Final pass too heavy or tool worn Add a light final pass; replace the tool
Uneven chamfer around the bore Bore centre not at X0 Y0 Re-pick the bore centre with a probe or edge finder

Choosing between macro and fixed code

Macro programs make it easy to adjust a chamfer at the control, but some shops prefer fixed coordinates for traceability or because macros are not enabled. If that is you, run the generator, then copy the values for each pass into plain G-code, or use the expanded G-code dialect in 3D CAD Studio.

Frequently asked questions

Which generator should I use?

Use the Circular Chamfer generator for the top edge of a bore or hole. Use the XY Chamfer generator for the straight outside edges of a rectangular part.

Why does the circular macro need a D register?

It uses cutter radius compensation (G41) so the same program works with different chamfer mills. You store the effective radius in the D register instead of changing the program.

Can I change the chamfer size at the machine?

Yes. The main values are stored as # variables at the top of each program. Editing #2 (final depth) or #4 (angle) changes the chamfer without regenerating the code.

Which controls does the code run on?

The code uses Fanuc Custom Macro B syntax (WHILE/DO/END, # variables). It also suits controls with Macro B compatible options. Always check the program in your control's simulation first.

Can I download the program?

The circular generator offers Download .NC and Copy Code. The XY generator has Copy Code.

Generate your chamfer program

Use the Circular Chamfer generator for bore edges or the XY Chamfer generator for the outside edges of rectangular parts. Both preview the toolpath and write a Fanuc-style macro you can copy or download.