After you install EMC2 several sample files are placed in the /nc_files folder. Make sure the sample file is appropriate for your machine before running.
File Name: gridprobe.ngc
Description: Rectangular Probing
This program repeatedly probes in a regular XY grid and writes the probed location to the file 'probe-results.txt' in the same directory as the .ini file.
File Name: tool-lenght-probe.ngc
Description: Tool Length Probing
This program demonstrates how to measure tool lengths automatically using a switch hooked to the probe input. This is useful for machines without tool holders, where the length of a tool is different every time it is inserted.
File Name: probe-hole.ngc
Description: Finding the Center and Diameter of a hole.
The program demonstrates how to find the center of a hole, measure the hole diameter and record the results. The example does not include a tool change to put a probe in the spindle. Add the tool change code at the beginning, if needed.
Note that this code will not function until you replace <description of number> with a number.
G0 Z <Z-value of retracted position> F <feed rate>
#1001=<nominal X-value of hole center>
#1002=<nominal Y-value of hole center>
#1003=<some Z-value inside the hole>
#1004=<probe tip radius>
#1005=[<nominal hole diameter>/2.0 - #1004]
G0 X#1001 Y#1002 (move above nominal hole center)
G0 Z#1003 (move into hole - to be cautious, substitute G1 for G0 here)
G38.2 X[#1001 + #1005] (probe +X side of hole)
#1011=#5061 (save results) G0 X#1001 Y#1002 (back to center of hole)
G38.2 X[#1001 - #1005] (probe -X side of hole)
#1021=[[#1011 + #5061] / 2.0] (find pretty good X-value of hole center)
G0 X#1021 Y#1002 (back to center of hole)
G38.2 Y[#1002 + #1005] (probe +Y side of hole)
#1012=#5062 (save results)
G0 X#1021 Y#1002 (back to center of hole)
G38.2 Y[#1002 - #1005] (probe -Y side of hole)
#1022=[[#1012 + #5062] / 2.0] (find very good Y-value of hole center)
#1014=[#1012 - #5062 + [2 * #1004]] (find hole diameter in Y-direction)
G0 X#1021 Y#1022 (back to center of hole)
G38.2 X[#1021 + #1005] (probe +X side of hole)
#1031=#5061 (save results)
G0 X#1021 Y#1022 (back to center of hole)
G38.2 X[#1021 - #1005] (probe -X side of hole)
#1041=[[#1031 + #5061] / 2.0] (find very good X-value of hole center)
#1024=[#1031 - #5061 + [2 * #1004]] (find hole diameter in X-direction)
#1034=[[#1014 + #1024] / 2.0] (find average hole diameter)
#1035=[#1024 - #1014] (find difference in hole diameters)
G0 X#1041 Y#1022 (back to center of hole)
M2 (end of program)
File Name: comp-g1.ngc
Description: Cutter compensation with straight lead in and out.
This file demonstrates how to do a cutter compensation move using a G1 straight line lead in and lead out move. It is an error to have a G1 lead in move form a concave angle.