Upper Case Macro
Upper Case Macro
(OP)
I have the Backgroud_UpperCase_TXT.CATScript from the Catia Portable Script Center that I modified to include text in the main view as well.
The issue that I am running into is that when it changes everything to upper case, text boxes that have text with different formats in it all get changed to one format.
For example, some of the text is bolded and a different size, after the macro is run, all the text in that text box will be bolded and one size.
Is there a way to keep this from happening, I just want to make sure all my text is in upper case, I do not want the formatting to change.
The issue that I am running into is that when it changes everything to upper case, text boxes that have text with different formats in it all get changed to one format.
For example, some of the text is bolded and a different size, after the macro is run, all the text in that text box will be bolded and one size.
Is there a way to keep this from happening, I just want to make sure all my text is in upper case, I do not want the formatting to change.
CODE --> CATScript
Sub CATMain()
Dim sLF
Dim oDoc As Document
Dim sDrawingNumber
Dim oSheet As DrawingSheets
Dim oView As DrawingView
Dim oNewText As DrawingTexts
Dim i As Integer
'----------------
Set oDoc = CATIA.ActiveDocument
Set oSheet = oDoc.Sheets.Item(1)
oSheet.Activate
Set oView = oSheet.Views.Item("Background View")
For i = 1 To oView.Texts.Count
oView.Texts.Item(i).Text = UCase (oView.Texts.Item(i).Text)
Next
Set oView = oSheet.Views.Item("Main View")
For i = 1 To oView.Texts.Count
oView.Texts.Item(i).Text = UCase (oView.Texts.Item(i).Text)
Next
CATIA.ActiveWindow.ActiveViewer.Reframe
End Sub 




RE: Upper Case Macro
Should work...what OS? Which CATIA release, eventually patch ? Can you upload a sample file?
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Upper Case Macro
I am running Catia V5R23 SP3 Build Number 23 on Windows 7 Professional
I have attached the drawing i used to run this on.
I have also attached 3 pictures.
The way the font looks before the macro, after the macro, and the way i want it to look after the macro.
RE: Upper Case Macro
indocti discant et ament meminisse periti
RE: Upper Case Macro
How would you modify the code read each character as subtext?
RE: Upper Case Macro
CODE --> VBA
For Each oText In oView.Texts CTPmax = 16 ' 16 is the max value of CatTextProperty enum ReDim textprop(CTPmax, Len(oText.Text)) For CTP = 0 To CTPmax For i = 1 To Len(oText.Text) textprop(CTP, i) = oText.GetParameterOnSubString(CTP, i, 1) Next Next oText.Text = UCase(oText.Text) ' CatTextProperty 8 (catParagraph) and 9 (catPlain) should not be impacted by LCase or UCase ' but setting them impact length of text For CTP = 0 To CTPmax If CTP = 8 Then CTP = 10 For i = 1 To Len(oText.Text) oText.SetParameterOnSubString CTP, i, 1, textprop(CTP, i) Next Next NextStill faster than manually...
indocti discant et ament meminisse periti
RE: Upper Case Macro
Star from me for comments in code.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU