2511
G-Code, CAD, and CAM discussions / Re: Are there conditionals (if, while) in the G-code?
« on: July 23, 2006, 04:23:31 AM »
You could do it with one sub program by changing the # values between the sub calls.
O1000
#1=-0.45 (Depth to go down in first phase)
#3=5 (Number of steps for first phase)
#5=0.180 (Y for first phase, considering 1/2 inch tool size)
G90 (Absolute distance mode)
G00 X... Y... Z.1
G01 Z0 F2.
M98 P1001 L#3 (Call phase-1 #3 times)
G4 P5.0
#1=-1.250 (Depth to go down in second phase)
#3=8 (Number of steps for second phase)
#5=0.030 (Y for second phase, considering 1/2 inch tool size)
M98 P1001 L#3 (Call phase-2 #3 times)
G1 Z0.0 F6.0 (End)
M2
O1001
G91
G1 Z[#1 / #3] F2.0 (Feed down)
G90
G1 X2.400 F6.0 (Go to the right)
G1 Y#5 F6.0 (Go away)
G1 X1.650 F6.0 (Mill away far side)
G1 Y0.0 F6.0 (Come to start)
G4 P5.0
M99
Graham.
O1000
#1=-0.45 (Depth to go down in first phase)
#3=5 (Number of steps for first phase)
#5=0.180 (Y for first phase, considering 1/2 inch tool size)
G90 (Absolute distance mode)
G00 X... Y... Z.1
G01 Z0 F2.
M98 P1001 L#3 (Call phase-1 #3 times)
G4 P5.0
#1=-1.250 (Depth to go down in second phase)
#3=8 (Number of steps for second phase)
#5=0.030 (Y for second phase, considering 1/2 inch tool size)
M98 P1001 L#3 (Call phase-2 #3 times)
G1 Z0.0 F6.0 (End)
M2
O1001
G91
G1 Z[#1 / #3] F2.0 (Feed down)
G90
G1 X2.400 F6.0 (Go to the right)
G1 Y#5 F6.0 (Go away)
G1 X1.650 F6.0 (Mill away far side)
G1 Y0.0 F6.0 (Come to start)
G4 P5.0
M99
Graham.