Catia百格线生成宏_第1页
Catia百格线生成宏_第2页
免费预览已结束,剩余13页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Catia百格线生成宏你是否为在 Catia 做 2D 图纸的时候,画百格线而伤脑筋呢别担心,接下来 我告诉你一个简单的方法1. 新建一个 txt 文本文档,比如2.把以下内容复制到中=这里开始,不要复制我=Option ExplicitI * Purpose:This macro allows you to create Grid line in CATIAdrawing Author: chenqa Languages:VBScript Locales:English Developing CATIA Level: V5R12View mush parallel to system aix

2、es,view angle 0deg,90deg and -90degI *Sub CATMain()= FalseDim sStatus As String Set the CATIA popup file alerts to FalseIt prevents to stop the macro at each alert during its execution= False Optional: allows to find the sample wherever its installed Variables declarationDim oDrwDocument As DrawingD

3、ocumentDim 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 coordinate select from DrawingDim X1 As IntegerDim Y1 As IntegerDim X2 As IntegerDim Y2

4、 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 AsD= InputBox(Please Input the Distance Value, input box, 100)D= Cint (D) Retrive a new drawing documentSet o

5、DrwDocument =Retrieve the drawing documents sheets collectionSet oDrwSheets =Retrieve the active sheetSet oDrwSheet =Retrieve the active view of the sheetSet oDrwView =Retrive the value of the viewX=Y=dScale =dAngle=Set oFactory2D =Get the coordinate from the select two pointOn Error Resume NextSet

6、xSel =ReDim sFilter(0)sFilter(0) = Point2DMsgBox Please select the left-bottom point sStatus =(sFilter, Select First Point., false) If (sStatus = Normal)ThenDim SelectedPoint1 As SelectedElementSet SelectedPoint1 = (1)Dim pt1Coord(2) As Int( pt1Coord )MsgBox The frst point has been selected Else Msg

7、Box Select a 2D Point 1Exit SubEnd IfMsgBox Please select the ritht-top point sStatus = (sFilter, Select The Second Point., false)If (sStatus = Normal) ThenDim SelectedPoint2 As SelectedElementSet SelectedPoint2 = (1)Dim pt2Coord(2) As Int( pt2Coord )MsgBox The second point has been selected Else Ms

8、gBox Select a 2D point 1Exit SubEnd Ifif dAngle=0 thenX1= Cint( (pt1Coord(0) - X)/dScale)Y1= Cint (pt1Coord(1) - Y)/dScale)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

9、) X2= Cint(pt2Coord(1)-Y)/dScale) Y2= Cint(pt2Coord(0)-X)/dScale) end ifif dAngle0 thenDi_V=-Di_Vend ifif dAngle0 thenset Line2D1 = (X1-D/3,-Y1-D*i,X1+nx*D+D/3,-Y1-D*i)Line2D1set Circle2D1=(X1+nx*D+D/3 +R,-Y1-D*i,R)Circle2D1set Line2D1=(X1+nx*D+D/3+R,-Y1-D*i+R,X1+nx*D+D/3+R,-Y1-D*i-R)Line2D1Set MyText = +TextV,-Y1-D*i) = catMiddleCenter0, 0, iFontSizeSet MyText = -TextV,-Y1-D*i) = catMiddleCenter0, 0, iFontSize end ifif dAngle0 then set Line2D1 =(X1+D*j,-Y1+D/3,X1+D*j,-Y1-ny*D-D/3)Line2D1set Circle2D1=(X1+D*j,-Y1+D/3+R,R)Circle2D1set Line2D1 = (X1+D*j,-Y1+D/3+R*2,X1+D*J,-Y1+D/3)Line

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论