Macro program turning trapezoidal thread
N10 T1D1M3S300
N20 R1=0.2;---cut depth per cut
N30 R2=1;-Mark of current cutting times
N40 R3=0;--Total cutting times
N50 R4=3.5;-total depth of cut
N60 R5=30;-blank diameter
N70 R6=10;-Longitudinal starting point (z direction)
N80 R7=-30;---longitudinal end point (Z direction)
N90 R8=6;--lead
N100 R9=0;---start point offset angle
N110 R10=1.93;---groove bottom width
N120 R11=1;---tool width
N130 R2=1
N140 R3=R4/R1; calculate the total number of cuts
N150 AAA:; cycle mark
N160 G94F1000; G1 feed rate 1000mm per minute
N170 G0Z=R6+(R4-R1*R2)*TAN(19.8)+(R10-R11)/2; z-axis starting point offset right
N180 G1X=R5-2*R1*R2; X axis feed
N190 G33Z=R7K=R8 SF=R9; thread cutting
N200 STOPRE
N210 G0X=R5+2; X axis retracts (exit blank 2mm)
N220 Z=R6-(R4-R1*R2)* TAN(19.8)-(R10-R11)/2; Z axis starting point left offset
N230 G1X=R5-2*R1*R2; X axis feed
N240 G33Z=R7K=R8 SF=R9; thread cutting
N250 STOPRE
N260 G0X=R5+2; X axis retracts (exit blank 2mm)
N270 R2=R2+1; current cutting times plus 1
N280 IF R2>R3 GOTOF BBB; The cutting times are less than the total times and jump to AAA to continue execution
N290 GOTOB AAA
N300 BBB:
N310 G0Z=R6+(R10-R11)/2; z-axis starting point offset right
N320 G1X=R5-2*R4; X axis feed
N330 G33Z=R7K=R8 SF=R9; thread cutting
N340 STOPRE
N350 G0X=R5+2; After the cycle is completed, the X axis reaches the starting point
N360 Z=R6+2; Z axis returns to the starting point
N370 M30; End of subroutine
The simulation is as shown in the figure below, no question haha
|