Search code examples
vbacatia

Selecting partially bolded DrawingText in Catia Drawing workbench


I'm currently developing a Catia vba script to look for specific texts in a plan, within the Drawing workbench.

For this particular macro, I need to search bold text. But the thing is I know that the DrawingText object has an attributed called bold that evaluates to True if ALL the text is bolded, but not if just a word is bolded.

Example:

  • This is my text -> True
  • This is my text -> False

What would be a good way to indentify this partially bolded DrawingText objects?


Solution

  • aText.GetParameterOnSubString(catBold,startPos,numChars)

    will return 1 if all the characters in the specifed substring are Bold, 0 otherwise.

    So first check if your sub-string is in the text by using InStr(aText.Text,subString). and if it is, use this test to see if is in Bold.