用CATScript 做的CATIA标题栏和工程图框 联系客服

发布时间 : 星期六 文章用CATScript 做的CATIA标题栏和工程图框更新完毕开始阅读374cfd264b35eefdc8d333a5

Case 1

displayFormat = \ Case 7

displayFormat = \ Case 8

displayFormat = \ Case 9

displayFormat = \ Case 10

displayFormat = \ Case 11

displayFormat = \ Case 12

displayFormat = \ Case 13

displayFormat = \ End Select End If

End Sub

Sub CATReference()

'-------------------------------------------------------------------------------

'How to create a reference text

'-------------------------------------------------------------------------------

Set Text = DrwTexts.Add(\ Text.Name = \End Sub

Function CATCheckRef(Mode As Integer) As Integer

'-------------------------------------------------------------------------------

'How to check that the called macro is the right one

'-------------------------------------------------------------------------------

nbTexts = DrwTexts.Count i = 0

notFound = 0

While (notFound = 0 And i

Set Text = DrwTexts.Item(i) WholeName = Text.Name

leftText = Left(WholeName, 10) If (leftText = \ notFound = 1

refText = \ If (Mode = 1) Then

MsgBox \ CATCheckRef = 1 Exit Function

ElseIf (Text.Name <> refText) Then

MsgBox \Chr(10) + \ CATCheckRef = 1 Exit Function End If End If Wend

CATCheckRef = 0

End Function

Sub CATFrame()

'-------------------------------------------------------------------------------

'How to create the Frame

'-------------------------------------------------------------------------------

Dim Cst_1 As Double 'Length (in cm) between 2 horinzontal marks Dim Cst_2 As Double 'Length (in cm) between 2 vertical marks Dim Nb_CM_H As Integer 'Number/2 of horizontal centring marks Dim Nb_CM_V As Integer 'Number/2 of vertical centring marks Dim Ruler As Integer 'Ruler length (in cm)

CATFrameStandard Nb_CM_H, Nb_CM_V, Ruler, Cst_1, Cst_2 CATFrameBorder End Sub

Sub CATFrameStandard(Nb_CM_H As Integer, Nb_CM_V As Integer, Ruler As Integer, Cst_1 As Double, Cst_2 As Double)

'-------------------------------------------------------------------------------

'How to compute standard values

'-------------------------------------------------------------------------------

Cst_1 = 74.2*mm '297, 594, 1189 are multiples of 74.2 Cst_2 = 52.5*mm '210, 420, 841 are multiples of 52.2 If DrwSheet.Orientation = CatPaperPortrait And _ (sheetFormat = CatPaperA0 Or _ sheetFormat = CatPaperA2 Or _ sheetFormat = CatPaperA4) Or _

DrwSheet.Orientation = CatPaperLandscape And _ (sheetFormat = CatPaperA1 Or _ sheetFormat = CatPaperA3) Then Cst_1 = 52.5*mm Cst_2 = 74.2*mm End If

Nb_CM_H = CInt(.5 * Width / Cst_1) Nb_CM_V = CInt(.5 * Height / Cst_2)

Ruler = CInt((Nb_CM_H - 1) * Cst_1 / 50) * 100 'here is computed the maximum ruler length

If RulerLength < Ruler Then Ruler = RulerLength End If End Sub

Sub CATFrameBorder()

'-------------------------------------------------------------------------------

'How to draw the frame border

'-------------------------------------------------------------------------------

On Error Resume Next Set Line = Fact.CreateLine(OV, OV , OH, OV ) Line.Name = \ Set Line = Fact.CreateLine(OH, OV , OH, Height - Offset) Line.Name = \ Set Line = Fact.CreateLine(OH, Height - Offset, OV, Height - Offset) Line.Name = \ Set Line = Fact.CreateLine(OV, Height - Offset, OV, OV ) Line.Name = \ If Err.Number <> 0 Then Err.Clear End If

On Error Goto 0 End Sub

Sub CATTitleBlock()

'-------------------------------------------------------------------------------

'How to create the TitleBlock

'-------------------------------------------------------------------------------

CATTitleBlockFrame 'To draw the geometry

CATTitleBlockText 'To fill in the title block If ObjAmount>0 Then

CATTitleObjBlock 'To draw the TitleObjBlock and fill in it Else Exit Sub End If End Sub

Sub CATTitleObjBlock()

'-------------------------------------------------------------------------------

'How to create the TitleObjBlock

'-------------------------------------------------------------------------------

CATTitleObjBlockFrame 'To draw the geometry

CATTitleObjBlockText 'To fill in the title Objblock End Sub

Sub CATTitleBlockFrame()

'-------------------------------------------------------------------------------

'How to draw the title block geometry

'-------------------------------------------------------------------------------

ObjAmount= InputBox(\输入“0”或单击“取消” →零件图标题栏; 2.输入零件个数“≥1” →带有明细栏的装配图标题栏\ If( ObjAmount<2 and ObjAmount>101 )then

ObjAmount= InputBox(\请输入零件的数目(不大于101不小于2。):\ End If

RowWidth = + 7*mm 'Define rows Rowwidth. const Rows = 7 'Define how many rows . Col(1) = -180*mm Col(2) = -170*mm Col(3) = -168*mm Col(4) = -160*mm