机床数控技术课程计划.docx
《机床数控技术课程计划.docx》由会员分享,可在线阅读,更多相关《机床数控技术课程计划.docx(20页珍藏版)》请在冰豆网上搜索。
![机床数控技术课程计划.docx](https://file1.bdocx.com/fileroot1/2022-10/27/a23786be-76b8-48ac-9657-2df3455dc910/a23786be-76b8-48ac-9657-2df3455dc9101.gif)
机床数控技术课程计划
机床数控技术课程设计
说明书
学校:
南京航空航天大学
专业:
机械工程及自动化
学号:
姓名:
设计题目:
PL1DC21
指导老师:
时间:
一.课设任务:
1.PL1-----逐点比较法插补第1象限直线;
2.DC21---DDA法插补第2~1象限顺圆弧。
二.课设要求:
1.具有数据输入界面,如输入直线插补的起点、终点,圆弧插补的起止点、圆心或半径、插补的步长等;
2.具有插补过程的动态显示功能,如单步插补、连续插补等;
3.插补的步长可调;
4.直线的起点、圆弧的圆心在坐标系中的位置可变(即直线的起点、圆弧的圆心可不设定在坐标原点)
5.建议使用C语言编程,有条件者可使用VB、VC等语言编程。
三.程序界面及运行截图
1.直线连续插补:
2.直线单步插补:
3.圆弧连续插补:
4.圆弧单步插补:
四、程序流程图
1.PL1:
逐点比较法插补第1象限直线
逐点比较法插补直线的过程为每进给一步需完成偏差判别,坐标进给,偏差计算,
终点判别四个步骤,具体流程如图1所示。
2、DDA法圆弧插补
五.程序及变量说明(Matlab)
functionvarargout=cxy_050910610(varargin)
gui_Singleton=1;
gui_State=struct('gui_Name',mfilename,...
'gui_Singleton',gui_Singleton,...
'gui_OpeningFcn',@cxy_050910610_OpeningFcn,...
'gui_OutputFcn',@cxy_050910610_OutputFcn,...
'gui_LayoutFcn',[],...
'gui_Callback',[]);
ifnargin&&ischar(varargin{1})
gui_State.gui_Callback=str2func(varargin{1});
end
ifnargout
[varargout{1:
nargout}]=gui_mainfcn(gui_State,varargin{:
});
else
gui_mainfcn(gui_State,varargin{:
});
end
functioncxy_050910610_OpeningFcn(hObject,eventdata,handles,varargin)
globalu
u=0;
globalfla;
fla=0;
handles.output=hObject;
guidata(hObject,handles);
functionvarargout=cxy_050910610_OutputFcn(hObject,eventdata,handles)
varargout{1}=handles.output;
functionx1_Callback(hObject,eventdata,handles)
globalx01;
x01=str2double(get(handles.x1,'string'));
functionx1_CreateFcn(hObject,eventdata,handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
functionx2_Callback(hObject,eventdata,handles)
globalx02;
x02=str2double(get(handles.x2,'string'));
functionx2_CreateFcn(hObject,eventdata,handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
functiony1_Callback(hObject,eventdata,handles)
globaly01;
y01=str2double(get(handles.y1,'string'));
functiony1_CreateFcn(hObject,eventdata,handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
functiony2_Callback(hObject,eventdata,handles)
globaly02;
y02=str2double(get(handles.y2,'string'));
functiony2_CreateFcn(hObject,eventdata,handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
functionx3_Callback(hObject,eventdata,handles)
globalx03;
x03=str2double(get(handles.x3,'string'));
functionx3_CreateFcn(hObject,eventdata,handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
functiony3_Callback(hObject,eventdata,handles)
globaly03;
y03=str2double(get(handles.y3,'string'));
functiony3_CreateFcn(hObject,eventdata,handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
functionx4_Callback(hObject,eventdata,handles)
globalx04;
x04=str2double(get(handles.x4,'string'));
functionx4_CreateFcn(hObject,eventdata,handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
functiony4_Callback(hObject,eventdata,handles)
globaly04;
y04=str2double(get(handles.y4,'string'));
functiony4_CreateFcn(hObject,eventdata,handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
functionr_Callback(hObject,eventdata,handles)
globalR;
R=str2double(get(handles.r,'string'));
functionr_CreateFcn(hObject,eventdata,handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
functionclear_Callback(hObject,eventdata,handles)
cla;
functionstraightline_Callback(hObject,eventdata,handles)
globals;
gridon;
x01=str2double(get(handles.x1,'string'));
x02=str2double(get(handles.x2,'string'));
y01=str2double(get(handles.y1,'string'));
y02=str2double(get(handles.y2,'string'));
x=linspace(x01,x02,1000);
y=((y02-y01)/(x02-x01))*(x-x01)+y01;
plot(x,y,'b');
holdon;
s=1;
functioncircular_arc_Callback(hObject,eventdata,handles)
gridon;
x03=str2double(get(handles.x3,'string'));
x04=str2double(get(handles.x4,'string'));
y03=str2double(get(handles.y3,'string'));
y04=str2double(get(handles.y4,'string'));
R=str2double(get(handles.r,'string'));
l=sqrt((y04-y03).^2+(x04-x03).^2);
k=sqrt(R^2-(l^2)/4);
x0=(x03+x04)/2+((y04-y03)*k)/l;
y0=(y03+y04)/2-((x04-x03)*k)/l;
x=linspace(x03,x04,1000);
y=y0+sqrt(R^2-(x-x0).^2