Hi,
With a macro. Copy-paste in a CATScript.
REM Option Explicit
Dim CatiaApp As Application
Dim CatiaDoc As Document
Dim DrawDoc1 As DrawingDocument
Dim vDoc1 As Variant
Dim DrawSheets1 As DrawingSheets
Dim DrawSheet1 As DrawingSheet
Dim DrawViews1 As DrawingViews
Dim DrawView1 As DrawingView
Dim DrawTexts1 As DrawingTexts
Dim DrawText1 As DrawingText
Dim DrawLeader1 As DrawingLeader
Dim bMainViewIsActive
Dim sFileType As String
Dim Selection1
Dim objSelFilterType1()
Dim sStatus1 As String
Dim SelectedElement1
Dim PointLocation1(1)
Dim objSelected1
Dim sStatus2 As String
Dim PointLocation2(1)
Sub CATMain()
' Attach to Catia
Set CatiaApp = CATIA.Application
'~ MsgBox "Always look in lower left corner of your CATIA window and read the instructions"
On Error Resume Next ' Error Handler in case no file open.
Set CatiaDoc = CatiaApp.ActiveDocument
On Error GoTo 0 ' Error Handler OFF.
' Document is valid
If Not (CatiaDoc Is Nothing) Then
' Get document type
sFileType = TypeName(CatiaDoc)
' Is it a drawing ?
If sFileType = "DrawingDocument" Then
Set DrawDoc1 = CatiaDoc
Set DrawSheets1 = DrawDoc1.Sheets
Set DrawSheet1 = DrawSheets1.ActiveSheet
Set DrawViews1 = DrawSheet1.Views
Set DrawView1 = DrawViews1.ActiveView
Set DrawTexts1 = DrawView1.Texts
If (DrawView1.Name = "Main View") Then
bMainViewIsActive = True
Else
bMainViewIsActive = False
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim myString 'As Double
myString = "000"
myString = InputBox ("Please enter the text, automatically you will have also a circle around the text.", "Enter Text")
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Ask user to select a Text Insertion Location
Set vDoc1 = DrawDoc1
sStatus2 = vDoc1.Indicate2D("Select TEXT Insertion Point, it will be left upper corner", PointLocation2)
If (sStatus2 = "Cancel") Then
Unload frmStatus
Exit Sub
End If
Set DrawText1 = DrawTexts1.Add(myString, PointLocation2(0), PointLocation2(1))
DrawText1.SetFontSize 0,0,7.00
'Turn On a Frame
DrawText1.ActivateFrame 3 '53 '(locked catCircle)
Dim Message, Style, Title, Response, SecString
Message = ("Change frame text circle to double circle ?" )
Style = vbYesNo + vbDefaultButton1 'Define default button
Title = "Purpose : change frame text "
Response = MsgBox(Message, Style, Title)
If Response = vbYes Then ' User chose Yes.
SecString = "Yes"
DrawText1.ActivateFrame 15 '65
End If
Else
MsgBox "Current document is not a Drawing." & Chr(13) & Chr(13) _
& "Please load/activate a Catia " & Chr(13) _
& "drawing and try again.", vbExclamation
End If
Else
MsgBox "No active Drawing found in Catia." & Chr(13) & Chr(13) _
& "Please load/activate a Catia " & Chr(13) _
& "drawing and try again.", vbExclamation
End If
End Sub
Regards
Fernando
https://picasaweb.google.com/102257836106335725208