MATLAB程序:
clear
hd=pi/180;
m=10; %模数
h=1.25; %顶高系数
ha=h*m; %齿顶高
hc=1.25*m; %齿根高
arpha=20*hd; %压力角
p=pi*m; %节距
z1=5; %滚刀齿数
z=12; %工件齿数
x=0.0; %变位系数
df=m*z; %分度圆直径
da=m*z+2*ha; %顶圆直径
dc=m*z-2*hc; %根圆直径
rack_bottom=p/2-2*hc*tan(arpha); %齿条的底宽
rack_top=p/2-2*ha*tan(arpha); %齿条的顶宽
rack_tan=(p-(rack_bottom+rack_top))/2; %齿条的斜边宽
theta_=[]; %为极坐标画图将极角分配数组
rho_=[];
x0=df/2+x*m; %齿条的节线起点坐标
y0=5*p/2;
[theta_(1,,rho_(1,]=cart2pol([x0,x0],[y0,-y0]); %节线的极坐标
rack_x(1,1)=x0+hc; %齿条根线第一点X坐标
rack_y(1,1)=-(z1*p/2-rack_bottom/2); %齿条根线第一点Y坐标
rack_x(1,2)=x0-ha; %齿条顶线第二点X坐标
rack_y(1,2)=rack_y(1,1)+rack_tan; %齿条顶线第二点Y坐标
rack_x(1,3)=x0-ha; %齿条根线第三点X坐标
rack_y(1,3)=rack_y(1,2)+rack_top; %齿条根线第三点Y坐标
rack_x(1,4)=x0+hc; %齿条顶线第四点X坐标
rack_y(1,4)=rack_y(1,3)+rack_tan; %齿条顶线第四点Y坐标
for j=5:z1*4
rack_x(1,j)=rack_x(1,j-4);
rack_y(1,j)=rack_y(1,j-4)+p; %齿条的z1个齿,共z1*4个角点的坐标值
end
theta=0:pi/20:2*pi;
ddc=dc*ones(size(theta));
ddf=df*ones(size(theta));
dda=da*ones(size(theta));
rack_=[];
s=0;
figure
polar(theta,dda./1.94,'y');
hold on
h=polar(theta,dda/2,'k');
% hold on
xx1 = get(h, 'xdata');
yy1 = get(h, 'ydata');
fill(xx1, yy1, [0.6,0.6,0.6])
polar(theta,ddf./2,'r--');
hold on
polar(theta_(1,,rho_(1,,'g');
hold on
polar(theta,ddc/2,'m');
hold on
%%%%%%%%%%%%%%%%%% 滚动展成 %%%%%%%%%%%%%%%%%%%%%%
% for i=2:1:361
% s=(df/2)*hd+s;
% rack_x(i,=rack_x(1,;
% rack_y(i,=rack_y(1,-s;
% if s>p
% s=mod(s,p);
% end
% [tt(i,,hh(i,]=cart2pol(rack_x(i,,rack_y(i,);
% direction = [0 0 1];
% rack_(i)=polar(tt(i,,hh(i,,'m');
% rotate(rack_(i),direction,i)
% pause(0.05)
% end
%%%%%%%%%%%%%%%%%%% 滚齿模拟展成 %%%%%%%%%%%%%%%%%%%%%
t = 0;
rack_xx=rack_x(1,;
rack_yy=rack_y(1,;
for i=1:1:360
s=(df/2)*hd;
t = t+s;
rack_x(i, = rack_xx;
rack_y(i, = rack_yy;
if t>p
t=0;
rack_yy = rack_yy -p;
end
[tt(i,,hh(i,]=cart2pol(rack_x(i,,rack_y(i,);
direction = [0 0 1];
polar(tt(i,,hh(i,,'m');
h_rack = findobj(gca,'Type','line');
rotate(h_rack,direction,1)
rack_yy = rack_yy + s;
pause(0.05)
end
untitled.png