Hallo und Willkommen,
die kurze Variante ist über Search dauert bei großen Dateien länger:
Sub CATMain()
Dim MyDrawing As DrawingDocument
Dim MySelection As Selection
Dim MyText As DrawingText
Dim i As Integer
Dim sSuchString As String
Set MyDrawing = CATIA.ActiveDocument
Set MySelection = MyDrawing.Selection
'SuchString definieren
sSuchString = "AA"
MySelection.Search "(CATTPSSearch.CATTPSText + CATDrwSearch.DrwText),all"
For i = 1 To MySelection.Count2
Set MyText = MySelection.Item2(i).Value
If MyText.Text = sSuchString Then
MyText.TextProperties.FONTNAME = "Arial (TrueType)"
MyText.TextProperties.Update
End If
Next
End Sub
oder du machst eine Schleife über alle Sheets, alle Views und alle Texte und änderst dann die Schriftart.
Sub CATMain()
Dim MyDrawing As DrawingDocument
Dim MySelection As Selection
Dim MyViews As DrawingViews
Dim MyView As DrawingView
Dim MySheets As DrawingSheets
Dim MySheet As DrawingSheet
Dim MyTexts As DrawingTexts
Dim MyText As DrawingText
Dim i As Integer
Dim sSuchString As String
'SuchString definieren
sSuchString = "AA"
Set MyDrawing = CATIA.ActiveDocument
Set MySheets = MyDrawing.Sheets
'Schleife über alle Sheets
For Each MySheet In MySheets
Set MyViews = MySheet.Views
'Schleife über alle Views
For Each MyView In MyViews
Set MyTexts = MyView.Texts
'Schleife über alle Texte
For i = 1 To MyTexts.Count
Set MyText = MyTexts.Item(i)
If MyText.Text = sSuchString Then
MyText.TextProperties.FONTNAME = "Arial (TrueType)"
MyText.TextProperties.Update
End If
Next
Next
Next
End Sub
mfG
Mario
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP