继续冒泡,今天的是算法。三角函数的应用,需要懂三个函数各边各角的关系,并且会知道已知条件求未知条件。(三角函数应该是初中知识,可以自行百度)
例子是C20倒角,吃刀单边1.5,
(C20-三角函数车倒角,大50小10)
T101 G99 G97
M3 S500
M8 G0 X53.
Z2.
G94 X10. Z0. F0.2
#1 = 50.
#2 = 10
N1 #1 = # 1-3.
IF[#1 LT# 2] THEN#1 = # 2
#3 = [# 1-#2]/2/TAN45
G0 X#1
G1 Z-#3
G0 U2. Z2.
IF[#1 EQ#2] GOTO2
IF[#1 GT#2] GOTO1
N2 G0 Z2.
(精车,重置变量。)
#1 = 50
#2 = 10
#10 = 0.
X#2
G1 Z0.
N3 #2 = #2+0.5
IF[#2 GT#1] THEN# 2 = #1
#10 = #10+ TAN45*[0.5/2]
G1 X#2 Z-#10
IF[#2 EQ#1] GOTO5
IF[#2 LT#1] GOTO3
N5
M30
例子是C20倒角,吃刀单边1.5,
(C20-三角函数车倒角,大50小10)
T101 G99 G97
M3 S500
M8 G0 X53.
Z2.
G94 X10. Z0. F0.2
#1 = 50.
#2 = 10
N1 #1 = # 1-3.
IF[#1 LT# 2] THEN#1 = # 2
#3 = [# 1-#2]/2/TAN45
G0 X#1
G1 Z-#3
G0 U2. Z2.
IF[#1 EQ#2] GOTO2
IF[#1 GT#2] GOTO1
N2 G0 Z2.
(精车,重置变量。)
#1 = 50
#2 = 10
#10 = 0.
X#2
G1 Z0.
N3 #2 = #2+0.5
IF[#2 GT#1] THEN# 2 = #1
#10 = #10+ TAN45*[0.5/2]
G1 X#2 Z-#10
IF[#2 EQ#1] GOTO5
IF[#2 LT#1] GOTO3
N5
M30