數(shù)控課程設(shè)計(jì)vb編程
《數(shù)控課程設(shè)計(jì)vb編程》由會(huì)員分享,可在線閱讀,更多相關(guān)《數(shù)控課程設(shè)計(jì)vb編程(61頁珍藏版)》請(qǐng)?jiān)谘b配圖網(wǎng)上搜索。
1、 課 程 設(shè) 計(jì) 課程名稱___ 數(shù)控技術(shù)課程設(shè)計(jì) _ 題目名稱仿真數(shù)控裝置的刀具補(bǔ)償功能的程序?qū)崿F(xiàn) 學(xué)生學(xué)院______ _ 機(jī)電學(xué)院________ _ 專業(yè)班級(jí)__ 學(xué) 號(hào) 學(xué)生姓名______ __ _ 指導(dǎo)教師 ____ _ ____ _ 2012年 7月 3 日 廣東工業(yè)大學(xué)數(shù)控技術(shù)課程設(shè)計(jì)任務(wù)書 題目名稱 仿真數(shù)控裝置的刀具補(bǔ)償
2、功能的程序?qū)崿F(xiàn) 學(xué)生學(xué)院 專業(yè)班級(jí) 化 姓 名 學(xué) 號(hào) 一、課程設(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)三種過渡方式(伸長(zhǎng)型、縮短型、插入型); (3)能實(shí)現(xiàn)左、右刀補(bǔ)(即G41,G42)。 (4)在屏幕上繪出刀具的中心軌跡。 三、課程設(shè)計(jì)應(yīng)完成的工作
3、 每個(gè)學(xué)生應(yīng)在規(guī)定時(shí)間內(nèi),獨(dú)立完成所選題目。運(yùn)用VB編程語言,編寫計(jì)算機(jī)軟件在WINDOWS實(shí)現(xiàn)數(shù)控裝置的計(jì)算機(jī)仿真。要求清楚地分析問題、提出算法、確定人機(jī)界面、列出流程圖,最后用程序驗(yàn)證,完成軟件測(cè)試,并且提交程序說明書。 對(duì)選擇典型零件編程題目的學(xué)生,要求用編寫計(jì)算機(jī)軟件的方法解決數(shù)控過程的一個(gè)問題??梢匀芜x用本人熟悉的一種編程語言,要求清楚地分析問題、提出算法、列出流程圖,最后用程序驗(yàn)證,并且提交程序說明書。 四、課程設(shè)計(jì)進(jìn)程安排 序號(hào) 設(shè)計(jì)各階段內(nèi)容 地點(diǎn) 起止日期 1 1、布置任務(wù),領(lǐng)取課程設(shè)計(jì)任務(wù)書,了解課程設(shè)計(jì)的目的、內(nèi)容和要求;了解課程設(shè)
4、計(jì)的步驟; 2、理解本課程設(shè)計(jì)題目的具體內(nèi)容要求,根據(jù)各自不同情況選擇題目; 教室 第18周~ 第20周 2 了解和掌握有關(guān)軟件開發(fā)的知識(shí),如VB編程、VC編程、軟件工程、軟件開發(fā)的常用技巧及注意事項(xiàng); 3 調(diào)查研究,收集資料,查閱文獻(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)功能,完善軟件界面
5、7 對(duì)所開發(fā)的軟件程序進(jìn)行標(biāo)識(shí)和說明 8 按要求的格式編制課程設(shè)計(jì)說明書 9 課程設(shè)計(jì)答辯 目錄 一、內(nèi)容提要..............................................2 二、軟件功能介紹..........................................2 2.1軟件窗口界面..........................................2 2.2軟件功能簡(jiǎn)介.............................
6、.............2 三、刀具半徑補(bǔ)償知識(shí).......................................3 3.1概念..................................................3 3.2主要用途..............................................3 3.3常用方法..............................................3 四、刀具半徑補(bǔ)償算法.......................................4 4.1轉(zhuǎn)接點(diǎn)算法說明
7、........................................4 4.2刀具補(bǔ)償算法..........................................6 五、仿真結(jié)果圖............................................8 六、設(shè)計(jì)總結(jié)..............................................9 七、參考文獻(xiàn)..............................................10 八、附錄(部分代碼)............................
8、............11 一、內(nèi)容提要 本文介紹了以Visual Basic 6.0為開發(fā)工具,制作程序來實(shí)現(xiàn)數(shù)控裝置中的一個(gè)基本的功能--刀具補(bǔ)償功能(亦即仿真數(shù)控裝置的刀具補(bǔ)償功能),要求對(duì)任意給定的某一由直線與圓弧組成的平面幾何輪廓; (1) 能實(shí)現(xiàn)四種轉(zhuǎn)接(直線--直線,直線--圓弧,圓弧--直線,圓弧--圓?。?; (2)能實(shí)現(xiàn)三中過渡方式(伸長(zhǎng)型,縮短型,插入型); (3)能實(shí)現(xiàn)左,右刀補(bǔ)(即G41,G42)。 (4)在屏幕上繪出刀具的中心軌跡。 在程序中討論了刀具半徑補(bǔ)償?shù)脑?,并介紹了如何判斷縮短型,伸長(zhǎng)型和插入型,如何實(shí)現(xiàn)直線與直線,直
9、線與圓弧,圓弧與直線,圓弧與圓弧的轉(zhuǎn)接 二、軟件功能介紹 2.1.本模擬軟件有一個(gè)窗口,圖形界面如下: 2.2、軟件功能簡(jiǎn)介: (1)軟件能實(shí)現(xiàn)任何直線、圓弧交叉多段線段的連接刀具插補(bǔ)加工; (2)能實(shí)現(xiàn)直線—直線、直線—圓弧、圓弧—直線、圓弧—圓弧刀具補(bǔ)償; (3)可以實(shí)時(shí)在窗體中輸入圖形參數(shù),實(shí)現(xiàn)加工; (4)刀具半徑可以變換大小 三、刀具半徑補(bǔ)償知識(shí) 3.1概念: 根據(jù)按零件輪廓編制的程序和預(yù)先設(shè)定的偏置參數(shù),數(shù)控裝置能實(shí)時(shí)自動(dòng)生成刀具中心軌跡的功能稱為刀具半徑補(bǔ)償功能。 根據(jù)ISO標(biāo)準(zhǔn),當(dāng)?shù)毒咧行能壽E在編程軌跡(零件輪廓)前進(jìn)方向的右邊時(shí),稱為右刀補(bǔ),
10、用G42指令實(shí)現(xiàn);反之稱為左刀補(bǔ),用G41指令實(shí)現(xiàn)。 3.2主要用途 數(shù)控裝置大都具有刀具半徑補(bǔ)償功能,這為程序編制提供了方便。當(dāng)編制零件加工程序時(shí),可利用刀具半徑補(bǔ)償功能,直接按零件輪廓進(jìn)行編程,而不需要進(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ù)留可通過修改偏
11、置參數(shù)實(shí)現(xiàn),而不必為粗、精加工各編制一個(gè)程序。 3.3常用方法 刀具半徑補(bǔ)償分為B類補(bǔ)償和C類補(bǔ)償。B刀補(bǔ)的特點(diǎn)是刀具中心軌跡的段間連接都是以圓弧進(jìn)行的;C刀補(bǔ)的特點(diǎn)是相鄰兩段輪廓的刀具中心軌跡之間用直線進(jìn)行連接。B類補(bǔ)償只能實(shí)現(xiàn)在本程序段內(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ǔ)償功能可用于
12、內(nèi)、外拐角輪廓的加工。 四、刀具半徑補(bǔ)償計(jì)算 4.1轉(zhuǎn)接點(diǎn)算法說明 4.2刀具補(bǔ)償算法 刀具算法即計(jì)算各種轉(zhuǎn)接類型的轉(zhuǎn)接點(diǎn)的坐標(biāo)值,下屬刀補(bǔ)算法中,假設(shè)刀具半徑d,圓弧半徑R 4.2.1直線接直線的情況 假設(shè)第一段直線L1的起點(diǎn)為(,),終點(diǎn)為(,),第二段直線L2的起點(diǎn)為(,),(,)。 第一段直線L1的方向矢量為 第二段直線L2的方向矢量為 縮短型 直線1與直線2終點(diǎn)采用角度計(jì)算 刀具半徑矢量的計(jì)算: 以rd表示刀具半徑矢量,α1表示對(duì)應(yīng)的直線編程矢量與X軸正向的夾角,則可求出: G41: rdx=rd*(-sin1) rdy=rd
13、*(cos1) G42: rdx=rd*(sin1) rdy=rd*(-cos1) 對(duì)刀具中心軌跡起點(diǎn)的計(jì)算: 通過對(duì)左、右刀補(bǔ)及各種線型的轉(zhuǎn)接分析,得出其通用的計(jì)算公式: Jx=Ox+rdx Jy=Oy+rdy 對(duì)刀具中心軌跡終點(diǎn)的計(jì)算:左刀補(bǔ)時(shí):c=1;右刀補(bǔ)時(shí):c=-1; Kx=Fx-c*rd*sin2 Ky=Fy+c*rd*cos2 因此,只要配合直線的斜率就能計(jì)算出轉(zhuǎn)接點(diǎn)的坐標(biāo),從而完成刀具補(bǔ)償。 伸長(zhǎng)型 其計(jì)算方法與縮短型一樣。 插入型 刀補(bǔ)進(jìn)行有兩個(gè)轉(zhuǎn)接點(diǎn),采用角度判別計(jì)算,其坐標(biāo)值的計(jì)算公式如下: 對(duì)左刀補(bǔ)(G41)kk=1; 對(duì)右刀補(bǔ) (G4
14、2)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) 4.2直線接圓弧的情況 假設(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,逆圓時(shí)為-1。 直線接圓弧的伸長(zhǎng)型刀補(bǔ)進(jìn)行轉(zhuǎn)接點(diǎn)求法如圖所示,其中有兩個(gè)轉(zhuǎn)接點(diǎn),首先求出兩切線夾角的平均數(shù),利用求出的角度計(jì)算過渡直線
15、的斜率,從而得出直線與過渡直線的交點(diǎn)與直線與圓弧的交點(diǎn)。 4.3.圓弧接直線的情況 其原理與直線接圓弧相同。 4.4.圓弧接圓弧的情況 縮短型 刀補(bǔ)進(jìn)行:圓弧接圓弧的縮短型刀補(bǔ)進(jìn)行轉(zhuǎn)接點(diǎn)求法很簡(jiǎn)單,只要求出其刀補(bǔ)圓弧的交點(diǎn)就可以畫出刀補(bǔ)情況。 伸長(zhǎng)型 刀補(bǔ)進(jìn)行:圓弧接圓弧的伸長(zhǎng)型刀補(bǔ)進(jìn)行轉(zhuǎn)接點(diǎn)求法與縮短型相類似。 插入型 刀補(bǔ)進(jìn)行:圓弧接圓弧的插入型刀補(bǔ)進(jìn)行轉(zhuǎn)接點(diǎn)求法與直線圓弧相類似。 五、仿真結(jié)果圖 5.1直線與直線 5.2直線與圓弧 5.3圓弧與圓弧 六、設(shè)計(jì)總結(jié) 這個(gè)基于VB的刀補(bǔ)程序是用幾何方法編寫的,以矢量夾角
16、為判斷標(biāo)準(zhǔn).程序分為直線—直線;直線—圓弧;圓弧--直線;圓弧—圓弧四大類。我這次編寫的程序所用的方法是很基本的幾何邏輯原理,都是高中的幾何知識(shí),十分淺顯.但比較冗長(zhǎng)。 通過本次課程設(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ù)努力,做得更好。 最后感謝高院長(zhǎng)的指導(dǎo)
17、,指導(dǎo)了我們這個(gè)課程設(shè)計(jì),謝謝老師的辛苦勞動(dòng)! 七參考文獻(xiàn) 1《機(jī)床設(shè)計(jì)手冊(cè)》第三分冊(cè) 2廖效果.數(shù)字控制機(jī)床.武漢:華中理工大學(xué)出版社.1992.9 3廖效果.數(shù)控技術(shù). 武漢:湖北科學(xué)技術(shù)出版社.2000.7 4劉又午.數(shù)字控制機(jī)床.北京:機(jī)械工業(yè)出版社 5龔浦泉.機(jī)床電氣控制.重慶:重慶大學(xué)出版社 6 譚浩強(qiáng).Basic語言結(jié)構(gòu)化程序設(shè)計(jì)教程.北京:中國(guó)科學(xué)技術(shù)出版社.1990 7 楊林,李繼良. Visual Basic編程高手.北京:北京大學(xué)出版社.2000
18、 八、附錄(部分代碼) Dim ax As Double, ay As Double, cx As Double, cy As Double, dx As Double, dy As Double, ex As Double, ey As Double, rx As Double Dim 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 Integer Dim r1 As Double
19、, r2 As Double, x1 As Double, x2 As Double, x3 As Double, x4 As Double, y1 As Double, y2 As Double, y3 As Double Dim y4 As Double, d As Integer, db As Double, term As Integer, l1 As Double, l2 As Double, w1 As Double, w2 As Double Dim j11 As Double, j1 As Double, j2 As Double, j3 As Double, jj As
20、Double, jjs As Double, jjs1 As Double, hx As Double Dim hy As Double, kx As Double, ky As Double, fx As Double, fy As Double, pd As Double, jx As Double, jy As Double, jx1 As Double Dim jy1 As Double, jx2 As Double, jy2 As Double, tana1 As Double, tana2 As Double, b1 As Double, b2 As Double, bj1 A
21、s Double Dim bj2 As Double, ka As Integer, kb As Integer, kc As Integer, kd As Integer, we As Integer, zzqx As Double, zzqy As Double, lx As Double Dim 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 Integer Dim kc2 As
22、Integer, zj As Double, jxx1 As Double, jxx2 As Double, jyy1 As Double, jyy2 As Double, zzj As Double . . . . 當(dāng)非加工角大于90度時(shí) Select Case p Case 12 rr1 = r1
23、+ kc1 * db rr2 = 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 * d
24、b) * (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 - jy
25、1)) jx13 = 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
26、, aa7) Call huayuan(jx14, jy14, ex, 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 E
27、lse 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 If rr8 = rr2 Then jx2 = jx14 jy2 = jy14 aaa2 = aa6 End If End If End If End If If (
28、a1 - aaa1) * Sgn(a1 - aaa1) < (a1 - aaa2) * Sgn(a1 - aaa2) Then jx = jx1 jy = jy1 Else jx = jx2 jy = jy2 End If Call huayuan(jx, jy, rx, ry, rr1, aa1) If c1 = 0 Then Picture1.Circle (rx, ry), rr1, RGB(255, 0, 0), a1, aa1 Else Picture1.Circle
29、 (rx, ry), rr1, RGB(255, 0, 0), aa1, a1 End If Call huayuan(jx, jy, ex, ey, rr2, aa2) If c2 = 0 Then Picture1.Circle (ex, ey), rr2, RGB(255, 0, 0), aa2, a4 Else Picture1.Circle (ex, ey), rr2, RGB(255, 0, 0), a4, aa2 End If Case 13 zj =
30、 pd / 2 + j1 If zj > 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 * (b1 - by) * Tan(zj) - 2 * bx) cxx =
31、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
32、) * 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) aa
33、a = (1 + 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,
34、 jy21, jx22, jy22, bx, by, jx2, jy2) Call huayuan(jx1, jy1, rx, ry, rr1, aa1) If c1 = 0 Then Picture1.Circle (rx, ry), rr1, RGB(255, 0, 0), a1, aa1 Else Picture1.Circle (rx, ry), rr1, RGB(255, 0, 0), aa1, a1 End If Call huayuan(jx2, jy2, ex, ey, rr2
35、, aa2) If c2 = 0 Then Picture1.Circle (ex, ey), rr2, RGB(255, 0, 0), aa2, a4 Else Picture1.Circle (ex, ey), rr2, RGB(255, 0, 0), a4, aa2 End If Picture1.Line (jx1, jy1)-(jx2, jy2), RGB(255, 0, 0) End If End Select Case 2 pd = 8 * Atn(1) - pd zj = j1
36、 - 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) Th
37、en p = 12 Else p = 13 End If 當(dāng)非加工角大于90度時(shí) Select Case p Case 12 rr1 = r1 + kc1 * db rr2 = 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) +
38、4 * w * w b11 = 4 * e * (ry - ey) - 8 * w * w * ry c11 = e * e - 4 * 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
39、- jy1) * (ry - jy1)) jx12 = rx - Sqr((r1 + kc1 * db) * (r1 + kc1 * db) - (ry - jy1) * (ry - jy1)) jx13 = 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,
40、 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 rr5 = rr2 Then jx1 = jx11 jy1 = jy11 aaa1 = aa5 m = 1 Else If rr6 = rr2 Then If m = 0 Then jx1 = jx12
41、 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 If rr8 = rr2 Then jx2 = j
42、x14 jy2 = jy14 aaa2 = aa6 End If End If End If End If If (a1 - aaa1) * Sgn(a1 - aaa1) < (a1 - aaa2) * Sgn(a1 - aaa2) Then jx = jx1 jy = jy1 Else jx = jx2 jy = jy2 End If Call huayuan(jx, jy, rx, ry, rr1, aa1) If c1 = 0
43、Then Picture1.Circle (rx, ry), rr1, RGB(255, 0, 0), a1, aa1 Else Picture1.Circle (rx, ry), rr1, RGB(255, 0, 0), aa1, a1 End If Call huayuan(jx, jy, ex, ey, rr2, aa2) If c2 = 0 Then Picture1.Circle (ex, ey), rr2, RGB(255, 0, 0), aa2, a4 Else Pictu
44、re1.Circle (ex, ey), rr2, RGB(255, 0, 0), a4, aa2 End If Case 13 zj = pd / 2 + j1 If zj > 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 *
45、Tan(zj) axx = (1 + 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,
46、 jzyy) bzj = jzyy + jzxx / Tan(zj) aax = (1 + 1 / (Tan(zj) * 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 j
47、y12 = (-1) * jx12 / Tan(zj) + bzj Call pp(jx11, jy11, jx12, jy12, bx, by, jx1, jy1) aaa = (1 + 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, jx2
48、2) 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, rx, ry, rr1, aa1) If c1 = 0 Then Picture1.Circle (rx, ry), rr1, RGB(255, 0, 0), a1, aa1 Else Picture1.C
49、ircle (rx, ry), rr1, RGB(255, 0, 0), aa1, a1 End If Call huayuan(jx2, jy2, ex, ey, rr2, aa2) If c2 = 0 Then Picture1.Circle (ex, ey), rr2, RGB(255, 0, 0), aa2, a4 Else Picture1.Circle (ex, ey), rr2, RGB(255, 0, 0), a4, aa2 End If Picture1.Line (jx1, jy
50、1)-(jx2, jy2), RGB(255, 0, 0) End If End Select End Select End Sub Private Sub Command2_Click() zz.Enabled = True zz.Visible = True zy.Enabled = False zy.Visible = False yz.Enabled = False yz.Visible = False yy.Enabled = False yy.Visible = False term = 0 zzcc.Enabled
51、= True zzcc.Visible = True zycc.Enabled = False zycc.Visible = False Command8.Enabled = False Command8.Visible = False Command19.Enabled = False Command19.Visible = False End Sub Private Sub Command3_Click() zy.Enabled = False zy.Visible = False zz.Enabled = False zz.Visible = False yz
52、.Enabled = False yz.Visible = False yy.Enabled = True yy.Visible = True term = 3 zzcc.Enabled = False zzcc.Visible = False zycc.Enabled = False zycc.Visible = False Command8.Enabled = False Command8.Visible = False Command19.Enabled = True Command19.Visible = True End Sub Private S
53、ub Command4_Click() zz.Enabled = False zz.Visible = False zy.Enabled = False zy.Visible = False yz.Enabled = True yz.Visible = True yy.Enabled = False yy.Visible = False term = 2 zzcc.Enabled = False zzcc.Visible = False zycc.Enabled = False zycc.Visible = False Command8.Enabled = True
54、 Command8.Visible = True Command19.Enabled = False Command19.Visible = False End Sub Private Sub Command5_Click() zy.Enabled = True zy.Visible = True zz.Enabled = False zz.Visible = False yz.Enabled = False yz.Visible = False yy.Enabled = False yy.Visible = False zzcc.Enabled = Fal
55、se zzcc.Visible = False zycc.Enabled = True zycc.Visible = True Command8.Enabled = False Command8.Visible = False Command19.Enabled = False Command19.Visible = False term = 1 End Sub Private Sub Command7_Click() Frame6.Enabled = False End Sub Private Sub Command8_Click() Dim p
56、As Integer Dim zzx As Double Dim zzy As Double Dim zza As Double Dim zzb As Double Dim 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 Di
57、m 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, 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)
58、 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 = (y1 + y3) / 2 If pd > 2 * Atn(1) Then p = 12 Else
59、 p = 13 End If 當(dāng)非加工角大于90度時(shí) Select Case p Case 12 If x1 <> x2 Then Text2.Text = 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
60、 - ry) - (Sqr((y2 - ry) * (y2 - ry) + (x2 - 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
61、 - y2)) < ((jx2 - x2) * (jx2 - x2) + (jy2 - y2) * (jy2 - y2)) Then jx = jx1 Else jx = 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) * (y
62、2 - 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) * (y2 - ry) + (x2 - rx) * (x2 - rx)) + kc1 * db) - (kx - rx) * (kx - rx)) + ry jx1 = kx jx2 = kx If
63、 ((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 Picture1.Line (kx, ky)-(jx, jy), RGB(255, 0, 0) Call huayuan(jx, jy, rx, ry, rr1,
64、 aa1) If c1 = 0 Then Picture1.Circle (rx, ry), rr1, RGB(255, 0, 0), aa1, a2 Else Picture1.Circle (rx, ry), rr1, RGB(255, 0, 0), a2, aa1 End If Case 13 當(dāng)非加工角小于九十度時(shí) If x1 = x2 And y1 < y2 And a2 = 6 * Atn(1) Then jx1 = kx jy1 = y2 + db jx2 = kx + 2 * db
65、 jy2 = jy1 Else 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
66、- 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)) + kc1 * db) - (jy2 - ry) * (jy2 - ry)) + rx jxx2 = Sqr((Sqr((y2 - ry) * (y2 - ry) + (x2 - rx) * (x2 - rx)) + kc1 * db) * (Sqr((y2 - ry) * (y2 - ry) + (x2 - rx) * (x2 - rx)) + kc1 * db) - (jy2 - ry) * (jy2 - ry)) + rx If ((jxx1 - x2) * (jxx1 - x2) + (jy2 - y2) * (jy2 - y2)) < ((jxx2 - x2) * (jxx2 - x2) + (jy2 - y2) * (jy2 - y2
- 溫馨提示:
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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024《增值稅法》全文學(xué)習(xí)解讀(規(guī)范增值稅的征收和繳納保護(hù)納稅人的合法權(quán)益)
- 2024《文物保護(hù)法》全文解讀學(xué)習(xí)(加強(qiáng)對(duì)文物的保護(hù)促進(jìn)科學(xué)研究工作)
- 銷售技巧培訓(xùn)課件:接近客戶的套路總結(jié)
- 20種成交的銷售話術(shù)和技巧
- 銷售技巧:接近客戶的8種套路
- 銷售套路總結(jié)
- 房產(chǎn)銷售中的常見問題及解決方法
- 銷售技巧:值得默念的成交話術(shù)
- 銷售資料:讓人舒服的35種說話方式
- 汽車銷售績(jī)效管理規(guī)范
- 銷售技巧培訓(xùn)課件:絕對(duì)成交的銷售話術(shù)
- 頂尖銷售技巧總結(jié)
- 銷售技巧:電話營(yíng)銷十大定律
- 銷售逼單最好的二十三種技巧
- 銷售最常遇到的10大麻煩