版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、一、課程設(shè)計(jì)的內(nèi)容用計(jì)算機(jī)高級(jí)編程語言(如VB,VC+等)來實(shí)現(xiàn)數(shù)控裝置中的一個(gè)基本的功能刀具補(bǔ)償功能(亦即仿真數(shù)控裝置的刀具補(bǔ)償功能),要求對(duì)任意給定的某一由直線與圓弧組成的平面幾何輪廓:二、課程設(shè)計(jì)的要求與數(shù)據(jù)具體的要求如下:(1)能實(shí)現(xiàn)四種轉(zhuǎn)接(直線直線、直線圓弧、圓弧直線、圓弧圓?。?;(2)能實(shí)現(xiàn)三種過渡方式(伸長型、縮短型、插入型);(3)能實(shí)現(xiàn)左、右刀補(bǔ)(即G41,G42)。(4)在屏幕上繪出刀具的中心軌跡。三、課程設(shè)計(jì)應(yīng)完成的工作每個(gè)學(xué)生應(yīng)在規(guī)定時(shí)間內(nèi),獨(dú)立完成所選題目。運(yùn)用VB編程語言,編寫計(jì)算機(jī)軟件在WINDOWS實(shí)現(xiàn)數(shù)控裝置的計(jì)算機(jī)仿真。要求清楚地分析問題、提出算法、確定人
2、機(jī)界面、列出流程圖,最后用程序驗(yàn)證,完成軟件測試,并且提交程序說明書。對(duì)選擇典型零件編程題目的學(xué)生,要求用編寫計(jì)算機(jī)軟件的方法解決數(shù)控過程的一個(gè)問題??梢匀芜x用本人熟悉的一種編程語言,要求清楚地分析問題、提出算法、列出流程圖,最后用程序驗(yàn)證,并且提交程序說明書。四、課程設(shè)計(jì)進(jìn)程安排序號(hào)設(shè)計(jì)各階段內(nèi)容地點(diǎn)起止日期11、布置任務(wù),領(lǐng)取課程設(shè)計(jì)任務(wù)書,了解課程設(shè)計(jì)的目的、內(nèi)容和要求;了解課程設(shè)計(jì)的步驟;2、理解本課程設(shè)計(jì)題目的具體內(nèi)容要求,根據(jù)各自不同情況選擇題目;教室第18周 第20周2了解和掌握有關(guān)軟件開發(fā)的知識(shí),如VB編程、VC編程、軟件工程、軟件開發(fā)的常用技巧及注意事項(xiàng);3調(diào)查研究,收集資料
3、,查閱文獻(xiàn)。學(xué)生對(duì)所選題目進(jìn)行論證及確定設(shè)計(jì)方案, 4掌握數(shù)控結(jié)構(gòu)設(shè)計(jì)要求,具體技術(shù)指標(biāo)和計(jì)算要求; 進(jìn)行機(jī)械結(jié)構(gòu)設(shè)計(jì)或者軟件設(shè)計(jì);5進(jìn)行數(shù)控系統(tǒng)和算法的軟件編程與開發(fā),初步實(shí)現(xiàn)系統(tǒng)的基本功能6通過多個(gè)實(shí)例來驗(yàn)證和改進(jìn)系統(tǒng)功能,完善軟件界面7對(duì)所開發(fā)的軟件程序進(jìn)行標(biāo)識(shí)和說明8按要求的格式編制課程設(shè)計(jì)說明書9課程設(shè)計(jì)答辯目錄一、內(nèi)容提要.2二、軟件功能介紹.2軟件窗口界面.2軟件功能簡介.2三、刀具半徑補(bǔ)償知識(shí).3概念.3主要用途.3常用方法.3四、刀具半徑補(bǔ)償算法.4轉(zhuǎn)接點(diǎn)算法說明.4刀具補(bǔ)償算法.6五、仿真結(jié)果圖.8六、設(shè)計(jì)總結(jié).9七、參考文獻(xiàn).10八、附錄(部分代碼).11一、內(nèi)容提要本文
4、介紹了以Visual Basic 為開發(fā)工具,制作程序來實(shí)現(xiàn)數(shù)控裝置中的一個(gè)基本的功能-刀具補(bǔ)償功能(亦即仿真數(shù)控裝置的刀具補(bǔ)償功能),要求對(duì)任意給定的某一由直線與圓弧組成的平面幾何輪廓;(1)能實(shí)現(xiàn)四種轉(zhuǎn)接(直線-直線,直線-圓弧,圓弧-直線,圓弧-圓?。唬?)能實(shí)現(xiàn)三中過渡方式(伸長型,縮短型,插入型);(3)能實(shí)現(xiàn)左,右刀補(bǔ)(即G41,G42)。(4)在屏幕上繪出刀具的中心軌跡。 在程序中討論了刀具半徑補(bǔ)償?shù)脑恚⒔榻B了如何判斷縮短型,伸長型和插入型,如何實(shí)現(xiàn)直線與直線,直線與圓弧,圓弧與直線,圓弧與圓弧的轉(zhuǎn)接二、軟件功能介紹本模擬軟件有一個(gè)窗口,圖形界面如下:、軟件功能簡介:(1)
5、軟件能實(shí)現(xiàn)任何直線、圓弧交叉多段線段的連接刀具插補(bǔ)加工;(2)能實(shí)現(xiàn)直線直線、直線圓弧、圓弧直線、圓弧圓弧刀具補(bǔ)償;(3)可以實(shí)時(shí)在窗體中輸入圖形參數(shù),實(shí)現(xiàn)加工;(4)刀具半徑可以變換大小三、刀具半徑補(bǔ)償知識(shí)概念:根據(jù)按零件輪廓編制的程序和預(yù)先設(shè)定的偏置參數(shù),數(shù)控裝置能實(shí)時(shí)自動(dòng)生成刀具中心軌跡的功能稱為刀具半徑補(bǔ)償功能。根據(jù)ISO標(biāo)準(zhǔn),當(dāng)?shù)毒咧行能壽E在編程軌跡(零件輪廓)前進(jìn)方向的右邊時(shí),稱為右刀補(bǔ),用G42指令實(shí)現(xiàn);反之稱為左刀補(bǔ),用G41指令實(shí)現(xiàn)。主要用途數(shù)控裝置大都具有刀具半徑補(bǔ)償功能,這為程序編制提供了方便。當(dāng)編制零件加工程序時(shí),可利用刀具半徑補(bǔ)償功能,直接按零件輪廓進(jìn)行編程,而不需要
6、進(jìn)行大量的刀具中心運(yùn)動(dòng)軌跡的計(jì)算。采用刀具半徑補(bǔ)償后,數(shù)控系統(tǒng)能自動(dòng)計(jì)算出刀具中心的偏移向量,進(jìn)而得到偏移后的刀具中心軌跡,并使系統(tǒng)按中心軌跡運(yùn)行。具體體現(xiàn)在以下兩個(gè)方面:1) 由于刀具的磨損或因換刀引起的刀具半徑變化時(shí),不必重新編程,只須修改相應(yīng)得偏置參數(shù)即可。2) 由于輪廓加工往往不是一道工序能完成的,在粗加工時(shí),要為精加工工序預(yù)留加工余量。加工余量的預(yù)留可通過修改偏置參數(shù)實(shí)現(xiàn),而不必為粗、精加工各編制一個(gè)程序。常用方法刀具半徑補(bǔ)償分為B類補(bǔ)償和C類補(bǔ)償。B刀補(bǔ)的特點(diǎn)是刀具中心軌跡的段間連接都是以圓弧進(jìn)行的;C刀補(bǔ)的特點(diǎn)是相鄰兩段輪廓的刀具中心軌跡之間用直線進(jìn)行連接。B類補(bǔ)償只能實(shí)現(xiàn)在本程
7、序段內(nèi)的刀具半徑補(bǔ)償,而對(duì)程序段間的過渡不予處理。只有B類刀具半徑補(bǔ)償功能的數(shù)控系統(tǒng),使用時(shí),對(duì)有外輪廓(外拐角)部分,必須增加尖角過渡輔助程序段;對(duì)內(nèi)輪廓(內(nèi)拐角),會(huì)產(chǎn)生過切現(xiàn)象。刀具半徑C類補(bǔ)償功能可實(shí)現(xiàn)自動(dòng)尖角過渡,只要給出零件輪廓的程序數(shù)據(jù),數(shù)控系統(tǒng)就能自動(dòng)地進(jìn)行拐角處的刀具中心軌跡交點(diǎn)的計(jì)算,采用的算法是一次進(jìn)行兩段直線的處理,C類補(bǔ)償功能可用于內(nèi)、外拐角輪廓的加工。四、刀具半徑補(bǔ)償計(jì)算轉(zhuǎn)接點(diǎn)算法說明刀具補(bǔ)償算法刀具算法即計(jì)算各種轉(zhuǎn)接類型的轉(zhuǎn)接點(diǎn)的坐標(biāo)值,下屬刀補(bǔ)算法中,假設(shè)刀具半徑d,圓弧半徑R直線接直線的情況假設(shè)第一段直線L1的起點(diǎn)為(,),終點(diǎn)為(,),第二段直線L2的起點(diǎn)為
8、(,),(,)。第一段直線L1的方向矢量為第二段直線L2的方向矢量為縮短型直線1與直線2終點(diǎn)采用角度計(jì)算刀具半徑矢量的計(jì)算:以rd表示刀具半徑矢量,1表示對(duì)應(yīng)的直線編程矢量與X軸正向的夾角,則可求出:G41: rdx=rd*(-sin1)rdy=rd*(cos1)G42: rdx=rd*(sin1)rdy=rd*(-cos1)對(duì)刀具中心軌跡起點(diǎn)的計(jì)算:通過對(duì)左、右刀補(bǔ)及各種線型的轉(zhuǎn)接分析,得出其通用的計(jì)算公式:Jx=Ox+rdxJy=Oy+rdy對(duì)刀具中心軌跡終點(diǎn)的計(jì)算:左刀補(bǔ)時(shí):c=1;右刀補(bǔ)時(shí):c=-1;Kx=Fx-c*rd*sin2Ky=Fy+c*rd*cos2因此,只要配合直線的斜率就
9、能計(jì)算出轉(zhuǎn)接點(diǎn)的坐標(biāo),從而完成刀具補(bǔ)償。 伸長型其計(jì)算方法與縮短型一樣。插入型 刀補(bǔ)進(jìn)行有兩個(gè)轉(zhuǎn)接點(diǎn),采用角度判別計(jì)算,其坐標(biāo)值的計(jì)算公式如下:對(duì)左刀補(bǔ)(G41)kk=1;對(duì)右刀補(bǔ)(G42)kk=-1插入點(diǎn)計(jì)算公式為:C1x=Ax+rd*(cos1-kk*sin1)C1y=Ay+rd*(sin1+kk*cos1)C2x=Ax+rd*(-cos2-kk*sin2)C2y=Ay+rd*(-sin2+kk*cos2)直線接圓弧的情況 假設(shè)直線L的起點(diǎn)為(,),終點(diǎn)為(,),圓弧C的起點(diǎn)為(,),終點(diǎn)為(,),圓心相對(duì)于圓弧起點(diǎn)的坐標(biāo)為(I,K)。刀補(bǔ)圓弧的半徑為:r=rd*kc+ 順圓時(shí)kc=1,逆
10、圓時(shí)為-1。直線接圓弧的伸長型刀補(bǔ)進(jìn)行轉(zhuǎn)接點(diǎn)求法如圖所示,其中有兩個(gè)轉(zhuǎn)接點(diǎn),首先求出兩切線夾角的平均數(shù),利用求出的角度計(jì)算過渡直線的斜率,從而得出直線與過渡直線的交點(diǎn)與直線與圓弧的交點(diǎn)。.圓弧接直線的情況其原理與直線接圓弧相同。.圓弧接圓弧的情況縮短型刀補(bǔ)進(jìn)行:圓弧接圓弧的縮短型刀補(bǔ)進(jìn)行轉(zhuǎn)接點(diǎn)求法很簡單,只要求出其刀補(bǔ)圓弧的交點(diǎn)就可以畫出刀補(bǔ)情況。伸長型刀補(bǔ)進(jìn)行:圓弧接圓弧的伸長型刀補(bǔ)進(jìn)行轉(zhuǎn)接點(diǎn)求法與縮短型相類似。插入型刀補(bǔ)進(jìn)行:圓弧接圓弧的插入型刀補(bǔ)進(jìn)行轉(zhuǎn)接點(diǎn)求法與直線圓弧相類似。五、仿真結(jié)果圖直線與直線直線與圓弧圓弧與圓弧六、設(shè)計(jì)總結(jié)這個(gè)基于VB的刀補(bǔ)程序是用幾何方法編寫的,以矢量夾角為判
11、斷標(biāo)準(zhǔn).程序分為直線直線;直線圓弧;圓弧-直線;圓弧圓弧四大類。我這次編寫的程序所用的方法是很基本的幾何邏輯原理,都是高中的幾何知識(shí),十分淺顯.但比較冗長。通過本次課程設(shè)計(jì)我受益良多,不僅鞏固了數(shù)控技術(shù)的知識(shí),另外,在編程實(shí)現(xiàn)所需功能的時(shí)候,需運(yùn)用數(shù)學(xué)知識(shí),而且需考慮各種可能出現(xiàn)的情況。因此,這次課程設(shè)計(jì)也提高了個(gè)人分析問題的能力。經(jīng)過這次獨(dú)立地編寫這個(gè)刀具半徑補(bǔ)償程序,使我對(duì)VB有了更為深刻認(rèn)識(shí). 由于能力有限,本軟件有一定的局限性,仿真不具有通用性,程序編寫的過程中,有很多地方想的不周密而令到程序不是很嚴(yán)謹(jǐn),請(qǐng)見諒! 今后我會(huì)繼續(xù)努力,做得更好。最后感謝高院長的指導(dǎo),指導(dǎo)了我們這個(gè)課程設(shè)計(jì)
12、,謝謝老師的辛苦勞動(dòng)!七參考文獻(xiàn)1機(jī)床設(shè)計(jì)手冊第三分冊2廖效果.數(shù)字控制機(jī)床.武漢:華中理工大學(xué)出版社.3廖效果.數(shù)控技術(shù). 武漢:湖北科學(xué)技術(shù)出版社.4劉又午.數(shù)字控制機(jī)床.北京:機(jī)械工業(yè)出版社5龔浦泉.機(jī)床電氣控制.重慶:重慶大學(xué)出版社6 譚浩強(qiáng).Basic語言結(jié)構(gòu)化程序設(shè)計(jì)教程.北京:中國科學(xué)技術(shù)出版社.19907 楊林,李繼良. Visual Basic編程高手.北京:北京大學(xué)出版社.2000八、附錄(部分代碼)Dim ax As Double, ay As Double, cx As Double, cy As Double, dx As Double, dy As Double,
13、ex As Double, ey As Double, rx As DoubleDim ry As Double, bx As Double, by As Double, a1 As Double, a2 As Double, a3 As Double, a4 As Double, c1 As Integer, c2 As IntegerDim r1 As Double, r2 As Double, x1 As Double, x2 As Double, x3 As Double, x4 As Double, y1 As Double, y2 As Double, y3 As DoubleDi
14、m y4 As Double, d As Integer, db As Double, term As Integer, l1 As Double, l2 As Double, w1 As Double, w2 As DoubleDim j11 As Double, j1 As Double, j2 As Double, j3 As Double, jj As Double, jjs As Double, jjs1 As Double, hx As DoubleDim hy As Double, kx As Double, ky As Double, fx As Double, fy As D
15、ouble, pd As Double, jx As Double, jy As Double, jx1 As DoubleDim jy1 As Double, jx2 As Double, jy2 As Double, tana1 As Double, tana2 As Double, b1 As Double, b2 As Double, bj1 As DoubleDim bj2 As Double, ka As Integer, kb As Integer, kc As Integer, kd As Integer, we As Integer, zzqx As Double, zzqy
16、 As Double, lx As DoubleDim ly As Double, zya As Double, zyb As Double, zyc As Double, rr1 As Double, rr2 As Double, aa1 As Double, aa2 As Double, kc1 As IntegerDim kc2 As Integer, zj As Double, jxx1 As Double, jxx2 As Double, jyy1 As Double, jyy2 As Double, zzj As Double . . . . 當(dāng)非加工角大于90度時(shí) Select
17、Case p Case 12rr1 = r1 + kc1 * dbrr2 = r2 + kc2 * db q = (r1 + db * kc1) * (r1 + db * kc1) - (r2 + db * kc2) * (r2 + db * kc2) w = rx - ex e = q + w * w - ry * ry + ey * ey a11 = 4 * (ry - ey) * (ry - ey) + 4 * w * w b11 = 4 * e * (ry - ey) - 8 * w * w * ry c11 = e * e - 4 * w * w * (r1 + kc1 * db)
18、* (r1 + kc1 * db) + 4 * w * w * ry * ry Call jec(a11, b11, c11, jy1, jy2) jy11 = jy1 jy12 = jy1 jy13 = jy2 jy14 = jy2 jx11 = rx + Sqr(r1 + kc1 * db) * (r1 + kc1 * db) - (ry - jy1) * (ry - jy1) jx12 = rx - Sqr(r1 + kc1 * db) * (r1 + kc1 * db) - (ry - jy1) * (ry - jy1) jx13 = rx + Sqr(r1 + kc1 * db) *
19、 (r1 + kc1 * db) - (ry - jy2) * (ry - jy2) jx14 = rx - Sqr(r1 + kc1 * db) * (r1 + kc1 * db) - (ry - jy2) * (ry - jy2) Call huayuan(jx11, jy11, ex, ey, rr5, aa5) Call huayuan(jx12, jy12, ex, ey, rr6, aa6) Call huayuan(jx13, jy13, ex, ey, rr7, aa7) Call huayuan(jx14, jy14, ex, ey, rr8, aa8) m = 0 If r
20、r5 = rr2 Then jx1 = jx11 jy1 = jy11 aaa1 = aa5 m = 1 Else If rr6 = rr2 Then If m = 0 Then jx1 = jx12 jy1 = jy12 aaa1 = aa6 m = 1 Else jx2 = jx12 jy2 = jy12 aaa2 = aa6 End If Else If rr7 = rr2 Then If m = 0 Then jx1 = jx13 jy1 = jy13 aaa1 = aa7 m = 1 Else jx2 = jx13 jy2 = jy13 aaa2 = aa7 End If Else
21、If rr8 = rr2 Then jx2 = jx14 jy2 = jy14 aaa2 = aa6 End If End If End If End If If (a1 - aaa1) * Sgn(a1 - aaa1) 8 * Atn(1) Then zj = zj - 8 * Atn(1) End If If zj 0 And zj 2 * Atn(1) And zj 4 * Atn(1) And zj 6 * Atn(1) And zj 8 * Atn(1) Then b1 = by - bx * Tan(zj) axx = (1 + Tan(zj) * Tan(zj) bxx = (2
22、 * (b1 - by) * Tan(zj) - 2 * bx) cxx = bx * bx + (b1 - by) * (b1 - by) - db * db Call jec(axx, bxx, cxx, jzx1, jzx2) jzy1 = jzx1 * Tan(zj) + b1 jzy2 = jzx2 * Tan(zj) + b1 Call pp(jzx1, jzy1, jzx2, jzy2, rx, ry, jzxx, jzyy) bzj = jzyy + jzxx / Tan(zj) aax = (1 + 1 / (Tan(zj) * Tan(zj) bbx = (-1) * 2
23、* (bzj - ry) / Tan(zj) - 2 * rx) ccx = rx * rx + (bzj - ry) * (bzj - ry) - (r1 + kc1 * db) * (r1 + kc1 * db) Call jec(aax, bbx, ccx, jx11, jx12) jy11 = (-1) * jx11 / Tan(zj) + bzj jy12 = (-1) * jx12 / Tan(zj) + bzj Call pp(jx11, jy11, jx12, jy12, bx, by, jx1, jy1) aaa = (1 + 1 / (Tan(zj) * Tan(zj) b
24、bb = (-1) * 2 * (bzj - ey) / Tan(zj) - 2 * ex) ccc = ex * ex + (bzj - ey) * (bzj - ey) - (r2 + kc2 * db) * (r2 + kc2 * db) Call jec(aaa, bbb, ccc, jx21, jx22) jy21 = (-1) * jx21 / Tan(zj) + bzj jy22 = (-1) * jx22 / Tan(zj) + bzj Call pp(jx21, jy21, jx22, jy22, bx, by, jx2, jy2) Call huayuan(jx1, jy1
25、, rx, ry, rr1, aa1) If c1 = 0 Then (rx, ry), rr1, RGB(255, 0, 0), a1, aa1 Else (rx, ry), rr1, RGB(255, 0, 0), aa1, a1 End If Call huayuan(jx2, jy2, ex, ey, rr2, aa2) If c2 = 0 Then (ex, ey), rr2, RGB(255, 0, 0), aa2, a4 Else (ex, ey), rr2, RGB(255, 0, 0), a4, aa2 End If (jx1, jy1)-(jx2, jy2), RGB(25
26、5, 0, 0) End If End SelectCase 2pd = 8 * Atn(1) - pd zj = j1 - pd / 2 If zj 8 * Atn(1) Then zj = zj - 8 * Atn(1) End If If pd 2 * Atn(1) Then p = 12 Else p = 13 End If If c1 = 0 Then kc1 = 1 Else kc1 = (-1) End If If c2 = 0 Then kc2 = 1 Else kc2 = (-1) End If If pd 2 * Atn(1) Then p = 12 Else p = 13
27、 End If 當(dāng)非加工角大于90度時(shí) Select Case p Case 12rr1 = r1 + kc1 * dbrr2 = r2 + kc2 * db q = (r1 + db * kc1) * (r1 + db * kc1) - (r2 + db * kc2) * (r2 + db * kc2) w = rx - ex e = q + w * w - ry * ry + ey * ey a11 = 4 * (ry - ey) * (ry - ey) + 4 * w * w b11 = 4 * e * (ry - ey) - 8 * w * w * ry c11 = e * e - 4
28、 * w * w * (r1 + kc1 * db) * (r1 + kc1 * db) + 4 * w * w * ry * ry Call jec(a11, b11, c11, jy1, jy2) jy11 = jy1 jy12 = jy1 jy13 = jy2 jy14 = jy2 jx11 = rx + Sqr(r1 + kc1 * db) * (r1 + kc1 * db) - (ry - jy1) * (ry - jy1) jx12 = rx - Sqr(r1 + kc1 * db) * (r1 + kc1 * db) - (ry - jy1) * (ry - jy1) jx13
29、= rx + Sqr(r1 + kc1 * db) * (r1 + kc1 * db) - (ry - jy2) * (ry - jy2) jx14 = rx - Sqr(r1 + kc1 * db) * (r1 + kc1 * db) - (ry - jy2) * (ry - jy2) Call huayuan(jx11, jy11, ex, ey, rr5, aa5) Call huayuan(jx12, jy12, ex, ey, rr6, aa6) Call huayuan(jx13, jy13, ex, ey, rr7, aa7) Call huayuan(jx14, jy14, e
30、x, ey, rr8, aa8) m = 0 If rr5 = rr2 Then jx1 = jx11 jy1 = jy11 aaa1 = aa5 m = 1 Else If rr6 = rr2 Then If m = 0 Then jx1 = jx12 jy1 = jy12 aaa1 = aa6 m = 1 Else jx2 = jx12 jy2 = jy12 aaa2 = aa6 End If Else If rr7 = rr2 Then If m = 0 Then jx1 = jx13 jy1 = jy13 aaa1 = aa7 m = 1 Else jx2 = jx13 jy2 = j
31、y13 aaa2 = aa7 End If Else If rr8 = rr2 Then jx2 = jx14 jy2 = jy14 aaa2 = aa6 End If End If End If End If If (a1 - aaa1) * Sgn(a1 - aaa1) 8 * Atn(1) Then zj = zj - 8 * Atn(1) End If If zj 0 And zj 2 * Atn(1) And zj 4 * Atn(1) And zj 6 * Atn(1) And zj 8 * Atn(1) Then b1 = by - bx * Tan(zj) axx = (1 +
32、 Tan(zj) * Tan(zj) bxx = (2 * (b1 - by) * Tan(zj) - 2 * bx) cxx = bx * bx + (b1 - by) * (b1 - by) - db * db Call jec(axx, bxx, cxx, jzx1, jzx2) jzy1 = jzx1 * Tan(zj) + b1 jzy2 = jzx2 * Tan(zj) + b1 Call pp(jzx1, jzy1, jzx2, jzy2, rx, ry, jzxx, jzyy) bzj = jzyy + jzxx / Tan(zj) aax = (1 + 1 / (Tan(zj
33、) * Tan(zj) bbx = (-1) * 2 * (bzj - ry) / Tan(zj) - 2 * rx) ccx = rx * rx + (bzj - ry) * (bzj - ry) - (r1 + kc1 * db) * (r1 + kc1 * db) Call jec(aax, bbx, ccx, jx11, jx12) jy11 = (-1) * jx11 / Tan(zj) + bzj jy12 = (-1) * jx12 / Tan(zj) + bzj Call pp(jx11, jy11, jx12, jy12, bx, by, jx1, jy1) aaa = (1
34、 + 1 / (Tan(zj) * Tan(zj) bbb = (-1) * 2 * (bzj - ey) / Tan(zj) - 2 * ex) ccc = ex * ex + (bzj - ey) * (bzj - ey) - (r2 + kc2 * db) * (r2 + kc2 * db) Call jec(aaa, bbb, ccc, jx21, jx22) jy21 = (-1) * jx21 / Tan(zj) + bzj jy22 = (-1) * jx22 / Tan(zj) + bzj Call pp(jx21, jy21, jx22, jy22, bx, by, jx2,
35、 jy2) Call huayuan(jx1, jy1, rx, ry, rr1, aa1) If c1 = 0 Then (rx, ry), rr1, RGB(255, 0, 0), a1, aa1 Else (rx, ry), rr1, RGB(255, 0, 0), aa1, a1 End If Call huayuan(jx2, jy2, ex, ey, rr2, aa2) If c2 = 0 Then (ex, ey), rr2, RGB(255, 0, 0), aa2, a4 Else (ex, ey), rr2, RGB(255, 0, 0), a4, aa2 End If (j
36、x1, jy1)-(jx2, jy2), RGB(255, 0, 0) End If End SelectEnd SelectEnd SubPrivate Sub Command2_Click() = True = True = False = False = False = False = False = Falseterm = 0 = True = True = False = False = False = False = False = FalseEnd SubPrivate Sub Command3_Click() = False = False = False = False =
37、False = False = True = Trueterm = 3 = False = False = False = False = False = False = True = TrueEnd SubPrivate Sub Command4_Click() = False = False = False = False = True = True = False = Falseterm = 2 = False = False = False = False = True = True = False = FalseEnd SubPrivate Sub Command5_Click()
38、= True = True = False = False = False = False = False = False = False = False = True = True = False = False = False = Falseterm = 1End SubPrivate Sub Command7_Click() = FalseEnd SubPrivate Sub Command8_Click()Dim p As Integer Dim zzx As Double Dim zzy As Double Dim zza As Double Dim zzb As Double Di
39、m zzc As Double Dim bzzj As Double Dim zxx1 As Double Dim zxx2 As Double Dim z1x1 As Double Dim z1y1 As Double Dim z1x2 As Double Dim z1y2 As Double Dim zya As Double Dim zyb As Double Dim zyc As Double Dim bzj As Double Dim zy1 As Double Dim zy2 As Double Call zyjjjs(x1, y1, x2, y2, a1, a2, c1, d,
40、j1, j2, j3, jj, pd) Select Case d Case 2 左刀補(bǔ)時(shí) zj = pd / 2 + j1 If zj 8 * Atn(1) Then zj = zj - 8 * Atn(1) End If If c1 = 1 Then kc1 = 1 Else kc1 = (-1) End If hx = db * (-1) * Sin(j1) hy = db * (Cos(j1) kx = x1 + hx ky = y1 + hy fx = x3 - db * Sin(j3) fy = y3 + db * Cos(j3) zzx = (x1 + x3) / 2 zzy =
41、 (y1 + y3) / 2 If pd 2 * Atn(1) Then p = 12 Else p = 13 End If 當(dāng)非加工角大于90度時(shí) Select Case p Case 12 If x1 x2 Then = pd tana1 = (y2 - y1) / (x2 - x1) b1 = ky - kx * tana1 zya = 1 + tana1 * tana1 zyb = 2 * tana1 * (b1 - ry) - 2 * rx zyc = rx * rx + (b1 - ry) * (b1 - ry) - (Sqr(y2 - ry) * (y2 - ry) + (x2
42、- rx) * (x2 - rx) + kc1 * db) * (Sqr(y2 - ry) * (y2 - ry) + (x2 - rx) * (x2 - rx) + kc1 * db) Call jec(zya, zyb, zyc, jx1, jx2) jy1 = tana1 * jx1 + b1 jy2 = tana1 * jx2 + b1 If (jx1 - x2) * (jx1 - x2) + (jy1 - y2) * (jy1 - y2) (jx2 - x2) * (jx2 - x2) + (jy2 - y2) * (jy2 - y2) Then jx = jx1 Else jx =
43、 jx2 End If jy = tana1 * jx + b1 Else jy1 = (-1) * Sqr(Sqr(y2 - ry) * (y2 - ry) + (x2 - rx) * (x2 - rx) + kc1 * db) * (Sqr(y2 - ry) * (y2 - ry) + (x2 - rx) * (x2 - rx) + kc1 * db) - (kx - rx) * (kx - rx) + ry jy2 = Sqr(Sqr(y2 - ry) * (y2 - ry) + (x2 - rx) * (x2 - rx) + kc1 * db) * (Sqr(y2 - ry) * (y
44、2 - ry) + (x2 - rx) * (x2 - rx) + kc1 * db) - (kx - rx) * (kx - rx) + ry jx1 = kx jx2 = kx If (jx1 - x2) * (jx1 - x2) + (jy1 - y2) * (jy1 - y2) (jx2 - x2) * (jx2 - x2) + (jy2 - y2) * (jy2 - y2) Then jy = jy1 Else jy = jy2 End If jx = kx End If (kx, ky)-(jx, jy), RGB(255, 0, 0) Call huayuan(jx, jy, r
45、x, ry, rr1, aa1) If c1 = 0 Then (rx, ry), rr1, RGB(255, 0, 0), aa1, a2 Else (rx, ry), rr1, RGB(255, 0, 0), a2, aa1 End If Case 13當(dāng)非加工角小于九十度時(shí) If x1 = x2 And y1 y2 And a2 = 2 * Atn(1) Then jx1 = kx jy1 = y2 - db jx2 = kx - 2 * db jy2 = jy1 Else If zj = 2 * Atn(1) Then tana1 = (y2 - y1) / (x2 - x1) b1 = ky - kx * tana1 jy1 = y2 + db jy2 = y2 + db jx1 = (jy1 - b1) / tana1 jxx1 = (-1) * Sqr(Sqr(y2 - ry) * (y2 - ry) + (x2 - rx) * (x2 - rx) + kc1 * db) * (Sqr(y2 - ry) * (y2 - ry) + (x2 - rx) * (x2 - rx)
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度床墊行業(yè)展會(huì)參展商采購合同3篇
- 2024版航天器發(fā)射與數(shù)據(jù)服務(wù)合同
- 2024版臨時(shí)工合同協(xié)議書范文
- 2024年軟件開發(fā)購銷合同
- 個(gè)人借款協(xié)議模板2024專業(yè)版版B版
- 二零二五版二手房買賣合同公證服務(wù)合同規(guī)范與執(zhí)行2篇
- 2024版股權(quán)激勵(lì)合同2篇
- 二零二五版房屋買賣更名與配套設(shè)施移交協(xié)議3篇
- 二零二五年度環(huán)保項(xiàng)目墊資合同范本2篇
- 2024幼兒園幼兒教師聘任與勞動(dòng)合同書3篇
- 2024-2025學(xué)年成都高新區(qū)七上數(shù)學(xué)期末考試試卷【含答案】
- 定額〔2025〕1號(hào)文-關(guān)于發(fā)布2018版電力建設(shè)工程概預(yù)算定額2024年度價(jià)格水平調(diào)整的通知
- 2025年浙江杭州市西湖區(qū)專職社區(qū)招聘85人歷年高頻重點(diǎn)提升(共500題)附帶答案詳解
- 《數(shù)學(xué)廣角-優(yōu)化》說課稿-2024-2025學(xué)年四年級(jí)上冊數(shù)學(xué)人教版
- “懂你”(原題+解題+范文+話題+技巧+閱讀類素材)-2025年中考語文一輪復(fù)習(xí)之寫作
- 2025年景觀照明項(xiàng)目可行性分析報(bào)告
- 2025年江蘇南京地鐵集團(tuán)招聘筆試參考題庫含答案解析
- 2025年度愛讀書學(xué)長參與的讀書項(xiàng)目投資合同
- 電力系統(tǒng)分析答案(吳俊勇)(已修訂)
- 化學(xué)-河北省金太陽質(zhì)檢聯(lián)盟2024-2025學(xué)年高三上學(xué)期12月第三次聯(lián)考試題和答案
- 期末復(fù)習(xí)試題(試題)-2024-2025學(xué)年四年級(jí)上冊數(shù)學(xué) 北師大版
評(píng)論
0/150
提交評(píng)論