In CNC machining, we often encounter commands to mill grooves. Especially for the processing of the mold, and the shape of the punch and the die has many grooves with different depths and irregular shapes.

In this case, we cannot simply rely on manual programming to complete, we need to automatically program through three-dimensional processing software such as ug. Of course, we can still complete simple grooves by cyclic milling. When the amount of back cutting of the workpiece is too large to realize processing with one or two passes, we need to refer to the conditional statement to achieve it.

Below we use a simple example to explain the method of cyclic milling through conditional transfer IF statement command.

Example: There is a 100*100*100 blank board, and a groove is cut in the middle with a width of 20mm and a depth of 50mm.

Preparation: Select a milling cutter with a diameter of 20*100, and pay attention to the length greater than the depth of 50. Set the origin position as the center position on the left side of the workpiece. Cutter length compensation is set to 100, as below picture.

Cutter length compensation is set to 100

The procedure is as follows:

G54G90G000Y0; (set the XY axis of the coordinate system to move to the zero point)

G43H1Z20; (set cutter position)

M08; (open cutting fluid)

M03S1000; (start the spindle)

#1=0; (proposed initial value)

#2=-1; (proposed incremental value)

N1IF[#1EQ-50]GOTO2; (transfer to program 2 after #1 is equal to -50 when the restriction condition is met)

#1=#1+#2; (incremental addition)

G00Z#1; (move axis Z to cutting position)

G01X140F80; (Start pass milling)

G00Z20; (lift the knife after processing)

X0; (return to start bit)

GOTO1; (cycle program 1)

N2G00Z200; (Program 2 starts knife lift 200)

M05M09; (turn off the spindle and cutting fluid)

M30; (the program stops and returns to the starting point)

The above program references a conditional branch statement in the following format:

IF [condition] GOTO n (if the specified conditional expression is satisfied, move to the block marked with sequence number n; if the specified conditional expression is not satisfied, execute the next block).

The table of operators in conditional operations is as follows:

As a professional CNC machining manufacturer, DO Machining not only produce metal parts, but plastic and wood parts are also available.

Please visit our CAPABILITIES and what PRODUCTS we did.

CNC machining service is the core business of DO Machining, from protptyes to bulk production, our professional 3/4/5 aixs CNC machining centers, CNC turning equipments, CNC turning-milling equipments, CNC grinding machines etc., are operated by well trained manufacturing engineers to meet the demands from global 1000+ customers in 30+ industries.

CNC Machining can be done starting with blanks produced from standard bar stock or one of DO Machining other manufacturing processes.

Contact us to see how we can provide overall value to your CNC machining needs.