G-Code Tutorial - Avoiding Obstacles Using G98 and G99 Codes

March 10, 2021 5:35 pm


In this G-code tutorial, the @G-Code TutorMarc Cronin explains how to avoid obstacles, such as clamps, using G98 and G99 codes.

Not all parts can be held in a vise. Sometimes, the best way you keep your part locked to the table is by using a clamp.
Depending on the features of your part, that clamp might turn out to be an obstacle for your tool and when that happens, you will want to make sure that you take that into account while you are programming your machining cycle, or the results might be a broken tool or worse.

A typical example of this situation is a part that features multiple holes like the one shown in the video.
When the clamp is positioned between two holes, you’ll need to make sure that the tool retracts enough to avoid the clamp, and the best way to do it is by using the G98 and G99 commands within our drilling cycle (G81).

By adding G98 to the drilling cycle, the program will tell the machine to retract to a safe position while the tool is moving between two holes to avoid the obstacle in the middle. Once the collision is avoided, you can add the G99 command to go back to the original Z value written in the first line of the drilling cycle.

To learn more about canned cycles or improve your CNC programming skills, visit Gcodetutor.com. Stay tuned for more machining videos!

Recommended Videos

Leave a Reply