




已阅读5页,还剩12页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
数控原理课程设计:逐点插补法四象限直线,四象限圆弧顺逆,过象限圆弧顺逆 程序以及运行截图工具:Vb6.0Private Sub Command1_Click()Dim xe%, ye%, a%, b%, f%, l%, m%xe = Val(Text1.Text)ye = Val(Text2.Text)f = 0a = 0b = 0Picture1.ClsPicture1.Scale (-10, 10)-(10, -10)Picture1.Line (-10, 0)-(10, 0)Picture1.Line (0, 10)-(0, -10)Picture1.CurrentX = 0: Picture1.CurrentY = 0: Picture1.Print 0For l = -9 To 9 Step 1Picture1.CurrentX = l: Picture1.CurrentY = 0: Picture1.Print lPicture1.CurrentX = 0: Picture1.CurrentY = l: Picture1.Print lNext lPicture1.Line (0, 0)-(xe, ye)直线第一象限If xe 0 And ye 0 ThenDo Until a = xe And b = yeIf f = 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - Abs(ye)Elseb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f + Abs(xe)End IfPicture1.PSet (a, b)LoopEnd If直线第二象限If xe 0 ThenDo Until a = xe And b = yeIf f = 0 Thena = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f - Abs(ye)Elseb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f + Abs(xe)End IfPicture1.PSet (a, b)LoopEnd If直线第三象限If xe 0 And ye = 0 Thena = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f - Abs(ye)Elseb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f + Abs(xe)End IfPicture1.PSet (a, b)LoopEnd If直线第四象限If xe 0 And ye = 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - Abs(ye)Elseb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f + Abs(xe)End IfPicture1.PSet (a, b)LoopEnd IfEnd Sub圆弧插补Private Sub Command2_Click()Dim xe%, ye%, a%, b%, f!, x1%, y1%, r!, x!, y!, c!, d!, g%, h%xe = Val(Text1.Text)ye = Val(Text2.Text)x1 = Val(Text3.Text)y1 = Val(Text4.Text)r = Sqr(xe * xe + ye * ye)a = x1b = y1c = Abs(x1)d = Abs(y1)Picture1.ClsPicture1.Scale (-10, 10)-(10, -10)Picture1.Line (-10, 0)-(10, 0)Picture1.Line (0, 10)-(0, -10)Picture1.CurrentX = 0: Picture1.CurrentY = 0: Picture1.Print 0For l = -9 To 9 Step 1Picture1.CurrentX = l: Picture1.CurrentY = 0: Picture1.Print lPicture1.CurrentX = 0: Picture1.CurrentY = l: Picture1.Print lNext l逆圆第一象限If xe = 0 And ye = 0 And x1 = 0 And y1 = 0 And xe = 0 Thena = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd If逆圆第二象限If xe = 0 And x1 = 0 And xe = 0 Thenb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd If逆圆第三象限If xe = 0 And ye = 0 And x1 = 0 And y1 x1 ThenFor x = x1 To xe Step 0.0001y = -Sqr(r * r - x * x)Picture1.PSet (x, y)Next xDo Until a = xe And b = yeIf f = 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd If逆圆第四象限If xe = 0 And ye = 0 And y1 x1 ThenFor x = x1 To xe Step 0.0001y = -Sqr(r * r - x * x)Picture1.PSet (x, y)Next xDo Until a = xe And b = yeIf f = 0 Thenb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd If顺圆第一象限If xe = 0 And ye = 0 And x1 = 0 And y1 = 0 And xe x1 ThenFor x = x1 To xe Step 0.0001y = Sqr(r * r - x * x)Picture1.PSet (x, y)Next xDo Until a = xe And b = yeIf f = 0 Thenb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd If顺圆第二象限If xe = 0 And x1 = 0 And xe x1 ThenFor x = x1 To xe Step 0.0001y = Sqr(r * r - x * x)Picture1.PSet (x, y)Next xDo Until a = xe And b = yeIf f = 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd If顺圆第三象限If xe = 0 And ye = 0 And x1 = 0 And y1 = 0 And xe = 0 Thenb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd If顺圆第四象限If xe = 0 And ye = 0 And y1 = 0 And xe = 0 Thena = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd If圆弧过象限 过第一第二象限的逆圆If x1 = 0 And y1 = 0 And xe = 0 ThenFor x = x1 To xe Step -0.0001y = Sqr(r * r - x * x)Picture1.PSet (x, y)Next xg = 0h = rIf x1 = 0 And y1 = 0 And g = 0 And h = 0 And g = 0 Thena = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd IfIf xe = 0 And g = 0 And xe = 0 Thenb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd IfEnd If圆弧第二第三象限的逆圆If x1 = 0 And xe = 0 And ye = 0 ThenFor y = y1 To ye Step -0.0001x = -Sqr(r * r - y * y)Picture1.PSet (x, y)Next yg = -1 * rh = 0If x1 = 0 And g = 0 And g = 0 Thenb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd IfIf xe = 0 And ye = 0 And g = 0 And h g ThenDo Until a = xe And b = yeIf f = 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd IfEnd If三四象限逆圆If x1 = 0 And y1 = 0 And ye = 0 ThenFor x = x1 To xe Step 0.0001y = -Sqr(r * r - x * x)Picture1.PSet (x, y)Next xg = 0h = -rIf g = 0 And h = 0 And x1 = 0 And y1 x1 ThenDo Until a = g And b = hIf f = 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd IfIf xe = 0 And ye = 0 And h g ThenDo Until a = xe And b = yeIf f = 0 Thenb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd IfEnd If14象限逆圆If x1 = 0 And y1 = 0 And ye = 0 ThenFor y = y1 To ye Step 0.0001x = Sqr(r * r - y * y)Picture1.PSet (x, y)Next yg = rh = 0If g = 0 And h = 0 And y1 x1 ThenDo Until a = g And b = hIf f = 0 Thenb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd IfIf xe = 0 And ye = 0 And g = 0 And h = 0 And g xe ThenDo Until a = xe And b = yeIf f = 0 Thena = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd IfEnd If12象限顺圆If x1 = 0 And xe 0 And ye 0 ThenFor x = x1 To xe Step 0.0001y = Sqr(r * r - x * x)Picture1.PSet (x, y)Next xg = 0h = rIf g = 0 And x1 = 0 And g x1 ThenDo Until a = g And b = hIf f = 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd IfIf xe = 0 And ye = 0 And g = 0 And h = 0 And xe g ThenDo Until a = xe And b = yeIf f = 0 Thenb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd IfEnd If23象限顺圆If x1 = 0 And y1 = 0 And xe 0 ThenFor y = y1 To ye Step 0.0001x = -Sqr(r * r - y * y)Picture1.PSet (x, y)Next yg = -rh = 0If g = 0 And h = 0 And x1 = 0 And y1 = 0 And g = 0 Thenb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd IfIf xe = 0 And g = 0 And xe g ThenDo Until a = xe And b = yeIf f = 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd IfEnd If34顺圆If x1 = 0 And y1 = 0 And xe 0 And ye = 0 And h = 0 And y1 = 0 And g = 0 Thena = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd IfIf xe = 0 And ye = 0 And g = 0 And h = 0 And xe = 0 Thenb =
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 陕西省殡管理办法
- 高速绿化管理办法
- 校外助学点管理办法
- 生产与试验管理办法
- 《管理办法》听证会
- 风险审核管理办法
- 防疫管理办法封控
- 丹顶鹤公园管理办法
- 物业全覆盖管理办法
- 高校用电管理办法
- 现代家庭教育方法
- 北京市朝阳区2024-2025学年高一下学期期末语文试题(含答案)
- 牙外伤护理配合课件
- 新高一家长会课件
- 腹部血管超声诊断
- 2025年公务员考试时事政治模拟题附答案详解(模拟题)
- 2025年江苏省事业单位招聘考试教师招聘语文专业知识试卷(中学语文教师)
- 医学美容技术专业教学标准(高等职业教育专科)2025修订
- 党课课件含讲稿:以作风建设新成效激发干事创业新作为
- 2024-2025北京中考英语真题阅读CD篇
- 智慧市政系统解决方案
评论
0/150
提交评论