iCAx开思网

标题: 用VBAScript 向工程图中添加文本框,如何更改文本框名称及字体颜色? [打印本页]

作者: marksman2006    时间: 2012-7-13 16:23
标题: 用VBAScript 向工程图中添加文本框,如何更改文本框名称及字体颜色?
用VBAScrip向drafting添加文本框,如何更改文本框名称及字体颜色?
添加文本代码如下。

Language="VBSCRIPT"
Sub CATMain()

Set DrwDocument = CATIA.ActiveDocument
Set DrwSheets   = DrwDocument.Sheets
Set Selection   = DrwDocument.Selection
Set DrwSheet    = DrwSheets.ActiveSheet

Dim x as Real
Dim y as Real

x = 205
x = DrwSheet.GetPaperWidth - x
y = 7.5

Dim oDoc As DrawingDocument
Dim oBackGround As DrawingView
Dim oText As DrawingText

Set oDoc = CATIA.ActiveDocument
Set oBackGround = oDoc.Sheets.ActiveSheet.Views.Item(2)
Set oText = oBackGround.Texts.Add(“Test", x, y)
oText.AnchorPosition = catBottomRight
oText.SetFontSize 0,0,7
oText.SetFontName 0,0, "SSS4"

End Sub




欢迎光临 iCAx开思网 (https://www.icax.org/) Powered by Discuz! X3.3