Learn VMC Programming: G16 Polar Coordinate - The Smart Way to do PCD Drilling







PCD Drilling using Polar Coordinate:

​"Today, we are going to learn how to program a Pitch Circle Diameter (PCD) pattern. Imagine you have a circular flange that needs 8 holes drilled in a perfect circle. Normally, to program this, you would have to use trigonometry (Sin and Cos) to calculate the exact X and Y coordinates for every single hole. That takes a long time and it’s easy to make a mistake.

Instead, we are going to use G16 — Polar Coordinate Command.

G16 XY;
XY
: Horizontal coordinates of the hole. This tells the machine exactly where to stop and start drilling.

We want to drill 8 holes on a 100mm diameter circle which means a 50mm radius, with each hole spaced 45° apart.

​When we activate G16, the 'brain' of the VMC changes how it reads coordinates:

• ​X is no longer a horizontal distance; it becomes the Radius of our circle.

• ​Y is no longer a vertical distance; it becomes the Angle (in degrees).

​By the end of this program, you’ll see how we can drill a complex circular pattern by only changing the angle (Y value), making our code much shorter, cleaner, and faster to write."

The Modal Relationship:

​Canned cycles like G83 (Peck Drilling) are modal. This means once you turn G83 on, the machine stays in "drilling mode" and will execute a hole at every coordinate you provide until you cancel it with G80.

​When you combine G16 with G83:

• ​The Trigger: The machine sees G83 and goes to the first polar coordinate (X50.0, Y0.0) and drills.

• ​The Sequence: You then list only the Y values (angles). Because G83 is still active, the machine treats every new Y coordinate as a command to move to that angle (at the same X50.0 radius) and drill again.


Always remember, CNC programming, 0° is always at the 3 o'clock position, and the angles move Counter-Clockwise.


EXAMPLE:

O0001 (PCD DRILLING EXAMPLE) ;
N1 ;
G90 G80 G49 G40 G21 G17 G15 ;
G28 G91 Z0 ; (Return Z to home)
G28 X0 Y0 ; (Return XY to home)
T01 M06 ;
G00 G90 G54 X0. Y0. ; (Move to center of PCD first)
G43 H01 Z100.0 M03 S1000 ;
Z5.0 M08 ;
G16 ; (Start Polar Coordinate Command)
G83 X50.0 Y0.0 Z-40.0 R2.0 Q8.0 F200 ; (First hole at 0 degrees)
Y45.0 ; (Second hole)
Y90.0 ;
Y135.0 ;
Y180.0 ;
Y225.0 ;
Y270.0 ;
Y315.0 ;
G80 G15 ; (G80 cancels cycle, G15 cancels Polar mode - IMPORTANT)
G00 Z100.0 M09 ;
M05;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
M01;
M30 ;

To understand the program, it helps to look at it in three phases: Setup (preparations), Polar coordinates and canned cycles (the actual work), and Ending.


1. Setup:

These codes ensure the machine is in the correct state before the tool ever touches the metal.

• ​O1234: The program number. Every program starts with an 'O' followed by four digits.
• ​G21: Sets the machine to Metric units (millimeters).
• ​G90: Sets Absolute Positioning. This means all coordinates (X, Y, Z) are measured from one fixed "Zero" point (the center of your plate).
• ​G40 / G49 / G80: These are "cancel" codes. They turn off any previous tool radius compensation, tool length offsets, or active drilling cycles from the last job to prevent accidents.
• ​G28 G91 Z0: Sends the Z-axis (the spindle) to its home position. G91 (Incremental) is used here so the machine moves "0" distance from its home, essentially forcing it to go there immediately.
• ​M06 T01: M06 is the command for an automatic tool change; T01 selects Tool #1 (your Center Drill).
• ​G54: This is your Work Coordinate System. It tells the machine where your "Work Zero" is located on the table.
• ​G00: Rapid Traverse. Moves the tool at maximum speed to a position. Used for moving through the air, never for cutting.
• ​G43 H01 Z100.0: G43 activates the Tool Length Compensation. Since every tool has a different length, H01 tells the machine to look at the "Height" offset stored for Tool 1 so the tip knows exactly where Z0 is.
• ​M03 S1000: M03 starts the spindle rotating clockwise. S1000 sets the speed to 1000\text{ RPM}.
• ​M08 / M09: M08 turns the coolant on; M09 turns it off.


2. Polar Coordinates and Canned Cycles:

• ​G16 : Starts Polar Coordinate Mode. This is the "switch" that tells the machine: "From now on, X is not a distance, it is a Radius. Y is not a distance, it is an Angle."

• ​G83 X50.0 Y0.0 Z-40.0 R2.0 Q8.0 F200 ;: This is the Peck Drilling Cycle.

• ​X50.0: This is your Radius (PCD 100 / 2).

• ​Y0.0: This is the starting Angle (3 o'clock position).

• ​Z-40.0: The total depth of the hole.

• ​R2.0: The "Return" plane (the drill starts drilling from 2mm above the part).

• ​Q8.0: The "Peck" depth (it drills 8mm, pulls out to clear chips, then drills another 8mm).

• ​F200: The Feed rate (200 mm/min).

• ​Y45.0 ; to Y315.0 ;: Since we are in G16 and G90, we just tell the machine the new angle for each hole. The machine remembers the X50.0 (Radius) and all the G83 settings (Z, R, Q) until we tell it otherwise.


3. Closing:

• ​G80: Cycle Cancel. This is extremely important. It tells the machine "I am done drilling; stop trying to drill at every X, Y coordinate I give you."
G15: Cancels Polar Mode. This is critical. It switches the machine back to normal X and Y coordinates.
G00 Z100.0 M09 ;: Rapids the tool up to a safe height and turns off the coolant (M09).
• G91 G28 Z0.: Sends the Z-axis to its home position (reference point).
• ​M05: Stops the spindle rotation.
• ​M30: Program End and Reset. This stops everything and moves the "cursor" in the machine's brain back to the very first line, ready to run the next part.


1. If you don't cancel canned cycles with G80, the machine will try to drill at the next coordinate you give it.

2. G16 defines the pole i.e. the 0,0 point of your circle, based on where the tool is sitting at the exact moment the command is executed. The machine looks at its current Work Coordinate position (X, Y in G54) when it reads the G16 line.

​If you do this:

• ​G54 G00 X50.0 Y0.0; (Tool moves to the first hole location)
• ​G16; (Polar mode starts)

​The machine now thinks the center of your entire hole pattern is at X45.0 Y0.0. If you then tell it to go to X60.0 Y135.0, it will calculate that 60mm distance starting from that first hole, not from the center of your part.


​The Right Way:

• ​G54 G00 X0 Y0; (Tool moves to the actual center of the drawing)
• ​G16; (Polar mode starts—center is now correctly set at X0, Y0)
• ​G83 X45.0 Y0.0... (Now the machine knows this 45mm radius starts from the center)

If you don't want to physically move the tool to X0, Y0 before starting, you can "force" the machine to use Work Zero as the center, regardless of where the tool is, by including the coordinates in the command line:

• ​Command: G16 X0 Y0 ;

• ​The Result: This tells the controller, "Start Polar mode, but use X0, Y0 of the current Work Offset (like G54) as the center point."

​Even if your tool is sitting at X100.0 Y100.0 when it reads that line, it will correctly calculate the next move based on the center of your part.
Like this:


(POSITIONING) ;
G90 G54 G00 X50.0 Y0.0 ; (MOVE TO START RADIUS) ;
G43 H01 Z100.0 M03 S1000 ;
G00 Z10.0 M08 ;

(START POLAR DRILLING) ;
G16 X0.0 Y0.0 ; (ACTIVATE POLAR - CENTER AT WORK ZERO) ;
G83 G99 X50.0 Y0.0 Z-10.0 R2.0 Q5.0 F100 ; (HOLE 1 AT 0 DEG) ;
Y90.0 ; (HOLE 2 AT 90 DEG) ;
Y180.0 ; (HOLE 3 AT 180 DEG) ;
Y270.0 ; (HOLE 4 AT 270 DEG) ;


Here you don't need to call G16 again.

Like this :
(START POLAR DRILLING) ;
G16 X0.0 Y0.0 ; (ACTIVATE POLAR - CENTER AT WORK ZERO) ;
G83 G99 X50.0 Y0.0 Z-10.0 R2.0 Q5.0 F100 ; (HOLE 1 AT 0 DEG) ;
G16 Y90.0 ; (HOLE 2 AT 90 DEG) ;
Y180.0 ; (HOLE 3 AT 180 DEG) ;
Y270.0 ; (HOLE 4 AT 270 DEG) ;


3. If you don't cancel polar coordinates with G15, the machine will continue to treat every X as a radius and every Y as an angle for the rest of the program, which will cause a crash during your retract or home moves.

​In G16 polar mode, the "Polar" calculation only applies to the plane you are working in (usually G17, the XY plane).
• ​X becomes Radius.
• ​Y becomes Angle.
• ​Z stays as a linear depth.
​if you command G00 Z10.0, the machine doesn't care if G16 is on or off; it simply moves the spindle to a height of 10.0mm above your work zero. The G16 doesn't "bend" the Z-axis into an angle.

​The "danger" of G16 isn't the Z-axis; it's the next XY move you make. If you forget G15 and tell the machine to go to a safe corner (like X200. Y200.), it will instead swing to a 200mm radius at a 200° angle. With G15 the machine moves to a point 200mm over and 200mm up from zero.







Post a Comment

0 Comments