机床数控技术课程设计说明书-050710621-吴悠.doc
《机床数控技术课程设计说明书-050710621-吴悠.doc》由会员分享,可在线阅读,更多相关《机床数控技术课程设计说明书-050710621-吴悠.doc(18页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、机床数控技术课程设计说明书_050710621_吴悠 2010 2011 学年第一学期机床数控技术课程设计课程设计班级:0507106课程设计名称:机床数控技术课程设计考核日期:2011 年1月10 日任课教师:王宏涛内含资料:成绩单1份、光盘1张、说明书: 份机床数控技术课程设计 说明书班级:0507106学号:050710621姓名:吴悠指导教师:王宏涛时间:2011 年1月地点:明故宫校区计算中心1。课设任务(1)DDA法插补第三象限直线;(2)逐点比较法插补第41象限逆圆弧.2.课设要求(1)具有数据输入界面,如起点、终点、圆心、半径及插补步长等;(2)具有插补过程的动态显示功能,如单
2、步插补、连续插补;(3)插补的步长可调;3。编程语言VisualBasic4.课设界面一)DDA法直线插补3)逐点比较法圆弧插补4. 程序设计流程图(1)DDA法插补第三象限直线画坐标轴及坐标计算xe1=x11-x01ye1=y11-y01Xe0?i2=1Jrx=m1? YI1=i+i2*L1Flag1=1Jry=jry-m1 Y N NJ1=j+j2*L1Flag1=1Jry=jry-m1Jry=m1?i2=-1 Ye0? Y YJ2=1 N NJ2=-1Flag=1?Count1=count1+1Count1m01? YCount=0 Y画线:(i+x01,y=y01)-(i1+x01,y
3、1+y01)Flag1=0;i=i1;j=j1 NK=count1? N Y N等待下一次的按钮按下Jrx=jrx+jvxJvy=jry+jvy(2)逐点比较法连续插补第41象限逆圆弧。f是否大于0画坐标及坐标轴 Y调用Drawcircle(计算圆心及起始点坐标画圆)i1 = i1 - L2f = f - 2 * (i - a) * L2 + L2 2Form1.Picture1.Line (i, j)-(i1, j1), RGB(255, 0, 0);i = i1 N是否在第四象限? Nj1 = j1 + L2f = f + 2 * (j - b) * L2 + L2 2Form1.Pict
4、ure1.Line (i, j)-(i1, j1), RGB(255, 0, 0); j = j1 Yj1 = j1 + L2f = f + 2 * (j - b) * L2 + L2 2Form1.Picture1.Line (i, j)-(i1, j1), RGB(255, 0, 0);j = j1f是否大于0i1 = i1 + L2f = f + 2 * (i - a) * L2 + L2 2Form1.Picture1.Line (i, j)-(i1, j1), RGB(255, 0, 0);i = i1 Y NEnd5。 变量说明(1)DDA直线插补变量名称说明变量名称说明X01起始
5、点x坐标JvxX向累加器y02起始点y坐标JvyY向累加器X11终止点x坐标Jrxx向积分器Y11终止点y坐标JryY向积分器L1插补步长Changflag1输入改变标志Xe1起点、终点x坐标间距I2X向方向转换Ye1起点、终点y坐标间距J2Y向方向转换Count1累加计数器Flag1溢出标志M1计数总次数M01插补次数(2)逐点比较法圆弧插补变量名称说明变量名称说明X02起始点x坐标Count1累加计数器1y02起始点y坐标Count2累加计数器2X12终止点x坐标F偏差判别函数Y12终止点y坐标Changflag2输入改变标志L2插补步长Flag2溢出标志Xe2起点、终点x坐标间距Ye2起
6、点、终点y坐标间距6. 源程序Private Changingflag1 As Integer *输入改变标志位Private Sub Command1_Click() *画图Dim x01, y01, x11, y11 As SinglePicture1。Clsx01 = Val(Text1。Text) *起点Xy01 = Val(Text2。Text) *起点Yx11 = Val(Text3.Text) *终点Xy11 = Val(Text4.Text) *终点YPicture1.Scale (-16, 16)(16, 16)Picture1.Line (-15。5, 0)(15。5, 0
7、)Picture1。Line (0, 15。5)-(0, 15。5)Picture1.Line (15。3, 0。2)-(15.5, 0)Picture1.Line (15.3, -0。2)(15.5, 0)Picture1。Line (-0。2, 15。3)-(0, 15.5)Picture1。Line (0.2, 15.3)(0, 15。5)For ii = 15 To 15 Step 1Picture1.Line (ii, 0。2)-(ii, 0)Picture1.CurrentX = ii: Picture1.CurrentY = 0: Picture1.Print iiNext ii
8、For ii = -15 To 15 Step 1Picture1.Line (0。2, ii)-(0, ii)If ii 0 Then Picture1.CurrentX = 0.01 * XY: Picture1.CurrentY = ii: Picture1.Print iiNext ii*以上是画坐标轴和坐标Picture1.Line (x01, y01)-(x11, y11), RGB(0, 0, 255)End SubPrivate Sub Command2_Click() *单步插补Dim x01, y01, x11, y11, xe1, ye1, i, j, i1, i2, j
9、2, L As SingleDim n, m1 As IntegerStatic countl As Integer *单步计数器x01 = Val(Text1。Text)y01 = Val(Text2。Text)x11 = Val(Text3.Text)y11 = Val(Text4.Text)n = Val(Text13。Text)L1 = Val(Text5。Text) *步长m1 = (2 n) *总次数m01 = CInt(m1 / L1) *插补次数L0 = m01Picture1。ClsPicture1.Scale (-16, 16)-(16, 16)Picture1.Line
10、(-15.5, 0)-(15.5, 0)Picture1。Line (0, 15。5)-(0, -15.5)Picture1.Line (15。3, 0。2)(15。5, 0)Picture1.Line (15.3, 0。2)(15.5, 0)Picture1.Line (-0。2, 15。3)-(0, 15.5)Picture1.Line (0.2, 15.3)(0, 15。5)For ii = 15 To 15 Step 1Picture1.Line (ii, 0。2)-(ii, 0)Picture1.CurrentX = ii: Picture1.CurrentY = 0: Pictur
11、e1.Print iiNext iiFor ii = -15 To 15 Step 1Picture1.Line (0.2, ii)-(0, ii)If ii 0 Then i2 = 1End IfIf xe1 0 Then i2 = -1End IfIf ye1 0 Then j2 = 1End IfIf ye1 = m1 Then i1 = i + i2 L1 flag1 = 1 jrx = jrx m1 End If If jry = m1 Then j1 = j + j2 * L1 flag1 = 1 jry = jry - m1 End If If flag1 = 1 Then Fo
12、rm1。Picture1.Line (i + x01, j + y01)(i1 + x01, j1 + y01), RGB(255, 0, 0) flag1 = 0 i = i1 j = j1 End IfNext kElse: countl = 0End IfEnd SubPrivate Sub Command3_Click()Dim x01, y01, x11, y11, xe1, ye1, i, j, i1, j1, i2, j2, L As Single *连续插补Dim n, m As Integerx01 = Val(Text1。Text)y01 = Val(Text2。Text)
13、x11 = Val(Text3。Text)y11 = Val(Text4。Text)n = Val(Text13.Text)L1 = Val(Text5。Text)m1 = (2 n)m01 = CInt(m1 / L1)Picture1。ClsPicture1。Scale (16, 16)-(16, -16)Picture1。Line (-15。5, 0)(15。5, 0)Picture1.Line (0, 15.5)(0, 15。5)Picture1。Line (15。3, 0.2)(15。5, 0)Picture1。Line (15。3, 0。2)-(15。5, 0)Picture1。L
14、ine (0.2, 15。3)(0, 15。5)Picture1。Line (0.2, 15.3)-(0, 15。5)For ii = -15 To 15 Step 1Picture1.Line (ii, 0.2)(ii, 0)Picture1.CurrentX = ii: Picture1.CurrentY = 0: Picture1。Print iiNext iiFor ii = -15 To 15 Step 1Picture1。Line (0.2, ii)(0, ii)If ii 0 Then i2 = 1End IfIf xe1 0 Then i2 = 1End IfIf ye1 0
15、Then j2 = 1End IfIf ye1 0 Then j2 = -1End Ifjvx = Abs(xe1)jvy = Abs(ye1)jrx = 0jry = 0i = 0j = 0i1 = 0j1 = 0flag1 = 0For k = 1 To m01 Step 1 jrx = jrx + jvx jry = jry + jvy If jrx = m1 Then i1 = i + i2 L1 flag1 = 1 jrx = jrx m1 End If If jry = m1 Then j1 = j + j2 * L1 flag1 = 1 jry = jry - m1 End If
16、 If flag1 = 1 Then Form1。Picture1.Line (i + x01, j + y01)(i1 + x01, j1 + y01), RGB(255, 0, 0) flag1 = 0 i = i1 j = j1 End IfNext kEnd SubPrivate flag2 As Integer *flag2为标志位,顺时针插补为,逆时针插补为Private Changingflag2 As Integer *输入改变标志位,改变为1Private a, b, a1, b1, a2, b2, zhengyuan As SinglePrivate Sub danbuzh
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 机床 数控技术 课程设计 说明书 050710621 吴悠
限制150内