Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro Color Text tittle block Catia

Status
Not open for further replies.

APA.IC

Automotive
Jun 22, 2018
3
ES
Hi everybody,

I'm just running a macro in Catia V5 R19 to fill a title block with the properties and everithing. All is working fine except the text color. I need different colors in some texts but it doesn't work. I think the code for the color is wrong but I don't know in which formar I do have to write it. I've tried RGB, Hex, Decimal, etc. The code I'm using is the next and I have to use the color white (255, 255, 255) and cyan (0, 255, 255).
Thank you!

'----PART NUMBER----
Set MyTextPartNo = MyDrawingViews.ActiveView.Texts.Add("HOLA", 25, 199)
MyTextPartNo.Name = "TitleBlock_Text_EnoviaV5_Effectivity"
MyTextPartNo.SetFontSize 0, 0, 3
MyTextPartNo.SetFontName 0, 0, "Century Gothic (TrueType)"
MyTextPartNo.AnchorPosition = catMiddleLeft
DrwTexts.GetItem("TitleBlock_Text_EnoviaV5_Effectivity").Text = ProductDrawn.PartNumber

'----COLOR PART NUMBER----
Set MyTextPartNoColor = DrwTexts.GetItem("TitleBlock_Text_EnoviaV5_Effectivity")
MyTextPartNoCol = 25500
MyTextPartNoColor.TextProperties.Color = MyTextPartNoCol
MyTextPartNoColor.TextProperties.Update

End Sub​
 
Replies continue below

Recommended for you

Hi,
please try something like this:

Code:
Option Explicit

Sub Main()
    Const catColor = 10
    Const colorGreen As Long = 10027263
    
    Dim doc, sheet, txts, txt

    Set doc = CATIA.ActiveDocument
    Set sheet = doc.Sheets.Item(1)
    Set txts = sheet.Views.Item("SplitText").Texts
    Set txt = txts.GetItem("Text 64")
    
    txt.SetParameterOnSubString catColor, 1, Len(txt.Text), colorGreen
End Sub

Tesak
- Text along a curve for Catia V5
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top