版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Catia 百格線生成宏Catia 百格線生成宏你是否為在 Catia 做 2D 圖紙的時(shí)候,畫(huà)百格線而傷腦筋呢?別擔(dān)心,接下 來(lái)我告訴你一個(gè)簡(jiǎn)單的方法1. 新建一個(gè) txt 文本文檔,比如 Draw-Grid.txt2. 把以下內(nèi)容復(fù)制到 Draw-Grid.txt 中=這里開(kāi)始,不要復(fù)制我=Option ExplicitI *Purpose:This macro allows you to create Grid line in CATIA drawing Author: chenqa Languages: VBScript Locales: English Developing CATI
2、A Level: V5R12View mush parallel to system aixes,view angle 0deg,90deg and -90degI *Sub CATMain()CATIA.RefreshDisplay = FalseCatia 百格線生成宏Dim sStatus As String Set the CATIA popupto FalseIt prevents to stop the macro at each alert during its executionCATIA.Display = False Optional: allows to find the
3、 sample wherever its installed Variables declarationDim oDrwDocument As DrawingDocumentDim oDrwSheets As DrawingSheetsDim oDrwSheet As DrawingSheetDim oDrwView As DrawingViewDim oFactory2D AS Factory2D The Distance between the linesDim D As IntegerDim nx As IntegerDim ny As Integer The point coordin
4、ate select from DrawingDim X1 As IntegerDim Y1 As IntegerCatia 百格線生成宏Dim X2 As IntegerDim Y2 As IntegerDim Pt1 As Point2DDim Pt2 As Point2DThe view scale dAngle for rotate view scale for view scaleDim dScale,dAngle As DoubleThe view coordinate originDim X As IntDim Y As IntDim xSel As INFITF.Selecti
5、onD= InputBox(Please Input the Distance Value, input box, 100)D= Cint (D) Retrive a new drawing documentSet oDrwDocument = CATIA.ActiveDocument Retrieve the drawing documents sheets collectionSet oDrwSheets = oDrwDocument.Sheets Retrieve the active sheetCatia 百格線生成宏Set oDrwSheet = oDrwSheets.ActiveS
6、heet Retrieve the active view of the sheetSet oDrwView = oDrwSheet.Views.ActiveViewRetrive the value of the viewX= oDrwView.xAxisDataY= oDrwView.yAxisDatadScale = oDrwView.ScaledAngle= oDrwView.AngleSet oFactory2D = oDrwView.Factory2DGet the coordinate from the select two pointOn Error Resume NextSe
7、t xSel = CATIA.ActiveDocument.Selection xSel.clearReDim sFilter(0)sFilter(0) = Point2DMsgBox Please select the left-bottom point sStatusxSel.SelectElement2(sFilter, Select First Point., false) If (sStatus = Normal) ThenCatia 百格線生成宏Dim SelectedPoint1 As SelectedElementSet SelectedPoint1 = xSel.Item(1
8、)Dim pt1Coord(2) As IntSelectedPoint1.GetCoordinates ( pt1Coord )MsgBox The frst point has been selected Else MsgBox Select a 2D Point 1Exit SubEnd IfMsgBox Please select the ritht-top point sStatus = xSel.SelectElement2(sFilter, Select The Second Point.,false)If (sStatus = Normal) ThenDim SelectedP
9、oint2 As SelectedElementSet SelectedPoint2 = xSel.Item(1)Dim pt2Coord(2) As IntSelectedPoint2.GetCoordinates ( pt2Coord )Catia 百格線生成宏MsgBox The second point has been selected Else MsgBox Select a 2D point 1Exit SubEnd Ifif dAngle=0 thenX1= Cint( (pt1Coord(0) - X)/dScale)Y1= Cint (pt1Coord(1) - Y)/dS
10、cale)X2= Cint (pt2Coord(0) - X)/dScale)Y2= Cint (pt2Coord(1) - Y)/dScale) end ifMsgBox (pt1Coord(0)MsgBox Xif dAngle0 thenX1=Cint(pt1Coord(1)-Y)/dScale)Y1=Cint (pt1Coord(0) -X)/dScale)X2= Cint (pt2Coord(1)-Y)/dScale)Y2= Cint (pt2Coord(0)-X)/dScale) end ifif dAngle0 then Di_V=-Di_V end ifif dAngle0 t
11、henset Line2D1 = oFactory2D.CreateLine (X1-D/3,-Y1-D*i,X1+nx*D+D/3,-Y1-D*i) oSel.Add Line2D1set Circle2D1=oFactory2D.CreateClosedCircle(X1+nx*D+D/3 +R,-Y1-D*i,R) oSel.Add Circle2D1set Line2D1= oFactory2D.CreateLine(X1+nx*D+D/3+R,-Y1-D*i+R,X1+nx*D+D/3+R,-Y1- D*i-R)oSel.Add Line2D1Set MyText = oDrwVie
12、w.Texts.Add(Text_XYZ_V,X1+nx*D+D/3+RCatia 百格線生成宏+TextV,-Y1-D*i)MyText.AnchorPosition = catMiddleCenterMyText.SetFontSize 0, 0, iFontSizeSet MyText =oDrwView.Texts.Add(Y1+D*i)*Di_V,X1+nx*D+D/3+R-TextV,-Y1-D*i)MyText.AnchorPosition = catMiddleCenterMyText.SetFontSize 0, 0, iFontSizeend ifif dAngle0 th
13、enset Line2D1 = oFactory2D.CreateLine (X1+D*j,-Y1+D/3,X1+D*j,-Y1-ny*D-D/3) oSel.Add Line2D1setCircle2D1=oFactory2D.CreateClosedCircle(X1+D*j,-Y1+D/3+R,R)oSel.Add Circle2D1set Line2D1 = oFactory2D.CreateLine(X1+D*j,-Y1+D/3+R*2,X1+D*J,-Y1+D/3) oSel.Add Line2D1Set MyText =oDrwView.Texts.Add(Text_XYZ_H,X1+D*j+TextV,-Y1+D/3+R)Catia 百格線生成宏MyText.AnchorPosition = catMiddleCenter MyText.SetFontSize 0, 0, iFontSizeSet MyText = oDrwView.Text
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二四年商業(yè)貸款合同規(guī)范文本20243篇
- 二零二四年度2024年企業(yè)融資租賃合同范本下載3篇
- 2025年股權(quán)質(zhì)押借款合同編制與審查要點(diǎn) - 副本
- 2025年汽車(chē)銷(xiāo)售售后服務(wù)合同規(guī)范文本
- 2025版校車(chē)承運(yùn)合同:校車(chē)運(yùn)營(yíng)資金管理與使用協(xié)議3篇
- 2025年戶(hù)用光伏電站設(shè)備銷(xiāo)售與安裝維護(hù)一體化合同
- 2025年度智能廣告牌監(jiān)控系統(tǒng)安裝與維護(hù)合同范本
- 2025年度新材料研發(fā)股權(quán)轉(zhuǎn)債權(quán)合作合同
- 2025年度繪畫(huà)材料市場(chǎng)調(diào)研與分析服務(wù)合同
- 2025版申通快遞快遞運(yùn)輸合同范本下載3篇
- 人教版八年級(jí)英語(yǔ)上冊(cè)期末專(zhuān)項(xiàng)復(fù)習(xí)-完形填空和閱讀理解(含答案)
- 一例蛇串瘡患者個(gè)案護(hù)理課件
- 低壓電工理論考試題庫(kù)低壓電工考試題
- 駱駝祥子選擇題100道及答案
- 2024年公務(wù)員考試題庫(kù)附答案【完整版】
- T-GDWCA 0019-2018 輻照工藝操作規(guī)范
- 司機(jī)考核管理制度
- 出差報(bào)銷(xiāo)單-中英對(duì)照版
- 【學(xué)前教育小學(xué)化成因分析及其對(duì)策10000字(論文)】
- 腕管綜合征課件
- 事業(yè)單位工作人員年度考核登記表(通用模板)
評(píng)論
0/150
提交評(píng)論