当前位置:首页 > 用CATScript 做的CATIA标题栏和工程图框
用CATScript 做的CATIA标题栏和工程图框
使用方法:drafting--〉edit--〉background--〉tools--〉macro--〉macros中select本文件,run即可。
环境变量设置(很实用)
CATLM_ODTS=1 - Disable license error messages at startup
L_WILSON_LAN=1 - Access to Wilson's spline curves
CGM_ROLLINGOFFSET=1 - Access to the Rolling Offset option in GSD
TAILLE_MEMOIRE_CHOISIE=1 - Optimize IGES export memory CATNoStartDocument=no - Disable product at startup CNEXTBACKGROUND = no - Disable sky background at startup CNEXTSPLASHSCREEN = no - Disable display of planet at startup
SHOW_CST_CHILDREN = 1 - Display stresses in the parents specification tree in sketcher
CNEXTOUTPUT = console - Display Catia's logs in command windows
MM_NO_REPLACE = 1 - Associativty about replacement of components cloned with different
标题栏.CATScript
代码:
'COPYRIGHT DASSAULT SYSTEMES 2001 '
****************************************************************************
' Purpose: To draw a Frame and TitleBlock
' Assumptions: A Drafting document should be active
' Author: 庞军杰,王晓军 ' Languages: VBScript ' Version: V5R7 '
****************************************************************************
Public DrwDocument As DrawingDocument Public DrwSheets As DrawingSheets Public DrwSheet As DrawingSheet Public DrwView As DrawingView Public DrwTexts As DrawingTexts Public Text As DrawingText Public Fact As Factory2D Public Point As Point2D
Public Line As Line2D Public Cicle As Circle2D Public Selection As Selection
Public GeomElems As GeometricElements
Public Height As Double 'Sheet height Public Width As Double 'Sheet width Public Offset As Double 'Distance between the sheet edges and the frame borders
Public OH As Double 'Horizontal origin for drawing the titleblock
Public OV As Double 'Vertical origin for drawing the titleblock
Public Col(16) As Double 'Columns coordinates Public Row(6) As Double 'Rows coordinates
Public colRev(4) As double 'Columns coordinates of revision block Public TranslationX As Double 'Horizontal translation to operate when changing standard Public TranslationY As Double 'Vertical translation to operate when changing standard
Public displayFormat As String 'Sheet format according to standard
Public sheetFormat As catPaperSize 'Sheet format as integer value
'new variable
Public RowWidth As Double 'Sheet width Public ObjAmount As Double
Public Coll(8) As Double 'Collumns coordinates Public Rowl(53) As Double 'Rowls coordinates ObjAmount=i+3 'end
Const mm = 1 Const Inch = 254 Const RulerLength = 200
Const MacroID = \Const RevRowHeight = 10
Sub CATMain() CATInit
On Error Resume Next
name = DrwTexts.GetItem(\ If Err.Number <> 0 Then Err.Clear
name = \ End If
On Error Goto 0
If (name = \ CATDrw_Creation End If End Sub
Sub CATDrw_Creation()
'-------------------------------------------------------------------------------
'How to create the FTB
'------------------------------------------------------------------------------- CATInit 'To init public variables & work in the background view If CATCheckRef(1) Then Exit Sub 'To check whether a FTB exists already in the sheet
CATStandard 'To compute standard sizes
CATReference 'To place on the drawing a reference point CATFrame 'To draw the frame
CATTitleBlock 'To draw the TitleBlock and fill in it
'****************************** 'If ObjAmount>0 Then
' CATTitleObjBlock 'To draw the TitleBlock and fill in it ' Else Exit Sub ' End If
'******************************
End Sub
Sub CATInit()
'-------------------------------------------------------------------------------
'How to init the dialog and create main objects
'-------------------------------------------------------------------------------
Set DrwDocument = CATIA.ActiveDocument
Set DrwSheets = DrwDocument.Sheets Set Selection = DrwDocument.Selection Set DrwSheet = DrwSheets.ActiveSheet
Set DrwView = DrwSheet.Views.ActiveView Set DrwTexts = DrwView.Texts
Set Fact = DrwView.Factory2D
Set GeomElems = DrwView.GeometricElements
End Sub
Sub CATStandard()
'-------------------------------------------------------------------------------
'How to compute standard values
'-------------------------------------------------------------------------------
Height = DrwSheet.GetPaperHeight Width = DrwSheet.GetPaperWidth sheetFormat = DrwSheet.PaperSize
Offset = 10.*mm 'Offset default value = 10.
If (sheetFormat = CatPaperA0 Or sheetFormat = CatPaperA1 Or sheetFormat = CatPaperUser And _ (DrwSheet.GetPaperWidth > 594.*mm Or DrwSheet.GetPaperHeight > 594.*mm)) Then
Offset = 20.*mm End If
OH = Width - Offset OV = Offset
documentStd = DrwDocument.Standard If (documentStd = catISO) Then If sheetFormat = 13 Then displayFormat = \ Else
displayFormat = \ End IF Else
Select Case sheetFormat Case 0
displayFormat = \
共分享92篇相关文档