📄 tiqian_no_tutai_hob.grs
字号:
entity/L(5),L1(200),L2(200),Ld,L1d(200),L2d(200),L3(200),R11(200)
entity/p1(2),p2(2),pd(3),p3(2),R12(200),R21(200)
entity/hob(1000),Gear(1000),d1(6),f1(2),Gear2(1000)
number/D0,Xn,pi,z
number/mat1(12),mat2(12),mat6(12),mat7(12),mat3(12),mat4(12)
number/mn,zg,B,sn,Da,Bn,ga,heg,hg,tn,sfng,R1,R2,cja,cjg,xuan
ufargs/mn,zg,B,sn,Da,Bn,ga,heg,hg,tn,sfng,cja,cjg,R1,R2,xuan
D0=mn*zg/cosf(B) $$被切齿轮分度圆直径
Xn=((tn-sfng)/cosf(B)-sn)/2*cosf(ga)/sinf(ga)
D=mn*zg/cosf(B)/2-Xn $$被切齿轮分度圆直径
pi=3.1415927
z=intf(pi*Da/tn)+2
$$画出齿条法向齿形的辅助封闭曲线
L(1)=line/0,-D-hg+heg,3,-D-hg+heg
L(2)=line/0,-D-hg+heg,0,-D-hg+heg-3
L(3)=line/0,-D-hg+heg-3,z*tn+6,-D-hg+heg-3
L(4)=line/z*tn+6,-D-hg+heg-3,z*tn+6,-D-hg+heg
L(5)=line/z*tn+6,-D-hg+heg,z*tn+3,-D-hg+heg
$$画修缘线段
p1(1)=point/endof,xlarge,L(1)
p1(2)=point/p1(1),delta,(hg-cja)*sinf(cjg)/cosf(cjg),hg-cja,0
L1(1)=line/p1(1),p1(2)
$$画出齿形切削部分直线
p2(1)=point/endof,ylarge,L1(1)
p2(2)=point/p2(1),delta,cja*sinf(ga)/cosf(ga),cja,0
L2(1)=line/p2(1),p2(2)
$$画出齿形对称线
pd(1)=point/p2(1),delta,(cja-heg)*sinf(ga)/cosf(ga),cja-heg,0
pd(2)=point/pd(1),delta,sfng/2,0,0
pd(3)=point/pd(2),delta,0,10,0
Ld=line/pd(2),pd(3)
mat1=matrix/mirror,Ld
L1d(1)=transf/mat1,L1(1)
L2d(1)=transf/mat1,L2(1)
$$画齿顶线段
p3(1)=point/endof,xlarge,L2(1)
p3(2)=point/endof,ylarge,L2d(1)
L3(1)=line/p3(1),p3(2)
$$画出全齿
do/lb10:,i,2,z,1
mat2=matrix/transl,tn,0,0
L1(i)=transf/mat2,L1(i-1)
L2(i)=transf/mat2,L2(i-1)
L1d(i)=transf/mat2,L1d(i-1)
L2d(i)=transf/mat2,L2d(i-1)
L3(i)=transf/mat2,L3(i-1)
lb10:
$$删除多余的点和线
delete/p1(1..2),p2(1..2),p3(1..2),pd(1..3),Ld
$$齿顶圆角
do/lb30:,i,1,z,1
R11(i)=fillet/xlarge,L2(i),ysmall,L3(i),radius,R1
R12(i)=fillet/ysmall,L3(i),xsmall,L2d(i),radius,R1
lb30:
$$画出齿根圆弧
R21(1)=fillet/xlarge,L(1),ylarge,L1(1),radius,R2
R21(1+z)=fillet/ylarge,L1d(z),xlarge,L(5),radius,R2
do/Lb40:,i,1,z-1,1
R21(i+1)=fillet/xlarge,L1d(i),ylarge,L1(i+1),radius,R2
Lb40:
ifthen/B<>0
hob(2)=solext/L(1..5),L1(1..z),$
L2(1..z),$
L3(1..z),$
L1d(1..z),$
L2d(1..z),$
R11(1..z),$
R12(1..z),$
R21(1..z+1),$
height,Bn/cosf(B)+sinf(B)/cosf(B)*(z*tn+6),axis,0,0,1
ifthen/xuan==0
mat6=matrix/zxrot,-B
mat7=matrix/transl,(z*tn+6)*cosf(B)/2,0,-(z*tn+6)*sinf(B)
hob(1)=transf/mat6,hob(2)
hob(1)=transf/mat7,hob(1),move
endif
ifthen/xuan==1
mat6=matrix/zxrot,B
hob(1)=transf/mat6,hob(2)
endif
delete/hob(2)
d1(1)=point/0,0,Bn
d1(2)=point/10,0,Bn
d1(3)=point/0,10,Bn
d1(4)=point/0,0,0
d1(5)=point/10,0,0
d1(6)=point/0,10,0
f1(1)=plane/d1(1),d1(2),d1(3)
f1(2)=plane/d1(4),d1(5),d1(6)
hob(2..3)=solcut/hob(1),with,f1(1)
delete/hob(2)
hob(1..2)=solcut/hob(3),with,f1(2)
delete/hob(2)
mask/omit,70
delete/all
else
hob(1)=solext/L(1..5),L1(1..z),$
L2(1..z),$
L3(1..z),$
L1d(1..z),$
L2d(1..z),$
R11(1..z),$
R12(1..z),$
R21(1..z+1),$
height,Bn,axis,0,0,1
endif
Gear(1)=solcyl/origin,0,0,0,height,Bn,diamtr,Da
$$运动仿真
ja=2
do/lb100:,j,2,360/ja+10,1
mat3=matrix/transl,-D0/2*ja/180*pi,0,0
hob(j)=transf/mat3,hob(j-1)
mat4=matrix/xyrot,-ja
Gear2(j-1)=subtra/Gear(j-1),with,hob(j-1)
Gear(j)=transf/mat4,Gear2(j-1)
delete/Gear2(j-1)
lb100:
delete/hob(360/ja+10)
mask/omit,70
delete/all
halt
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -