




已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 心理教育家长会教学课件
- 端午节小学生班队会课件
- 2025年自动酸雨采样器及测定仪项目合作计划书
- 心理健康高中课件教学
- 建筑工地看管协议书范本
- 2025年铌酸钾晶体(KNBO3)项目合作计划书
- 空军工程大学网上课件
- 心理健康课件中职生
- 2025版全国性电商平台物流配送服务合同
- 2025房地产认筹协议正本:房地产投资信托基金(REITs)合作协议
- 交通信号设备采购投标方案
- 涡轮发动机滑油系统-典型的发动机滑油系统
- 2023年雷州市人民医院专项招聘医学类人员及高层次卫技人才考试历年高频考点试题含答案黑钻版解析
- DB15T 562.3-2013鄂温克民族服饰 第3部分 通古斯鄂温克服饰
- 工程预付款支付申请表
- 英语短诗(精选20首)
- GB/T 16622-2022压配式实心轮胎规格、尺寸与负荷
- C=0抽样方案最新版
- 数字集成电路验证方法学课件
- 深基坑土方开挖专项施工方案60551
- 消防控制室施工方案
评论
0/150
提交评论