×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Hello All, What ever the color

## Hello All, What ever the color

(OP)
Hello All,
What ever the color code i am using for the sub string in a drawing text, it is changing to black color. Can any one help me in solving this. The below is the code. Thanks in advance.

DrawingText.setparameteronsubstring catcolor, starting position, length, ival

Thanks
Sri

### RE: Hello All, What ever the color

Which means that you fail to set catcolor in a correct way.
CATIA expects it to be encoded in RGBA:

#### CODE

catcolor = 255 * 255 * 255 * red + 255 * 255 * green + 255 * blue + alpha

### RE: Hello All, What ever the color

(OP)
Hello Little,
Thanks for the answer. I have taken the color codes from google. I have given 32 and 5 also. For both the values it is changing to Black only. Please help me.\

Thanks
Sri

### RE: Hello All, What ever the color

Use this functions to convert between RGBA and Long:

#### CODE

' Courtesy of Little Cthulhu, 2020
Function RGBAtoLong(r, g, b, a)
Dim lColorRGBA
If (r >= 128) Then
' first bit is not 0, resulting long is negative
lColorRGBA = &H81000000 + (r - 129) * &H1000000 + g * &H10000 + b * &H100 + a
Else
' first bit is 0, resulting long is positive
lColorRGBA = r * &H1000000 + g * &H10000 + b * &H100 + a
End If
RGBAtoLong = lColorRGBA
End Function

Function LongToRGBA(lngColor) ' Array[4]
Dim lColor: lColor = Abs(lngColor)
If lngColor < 0 Then
lColor = lColor - 1
End If
ReDim rgba(3)
Dim i: For i = 0 To 3
rgba(3 - i) = lColor Mod 256
lColor = (lColor - rgba(3 - i)) / 256
If lngColor < 0 Then
rgba(3 - i) = 255 - rgba(3 - i)
End If
Next
LongToRGBA = rgba
End Function

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

#### Resources

eBook - Functional Prototyping Using Metal 3D Printing
Functional prototypes are a key step in product development â€“ they give engineers a chance to test new ideas and designs while also revealing how the product will stand up to real-world use. And when it comes to functional prototypes, 3D printing is rewriting the rules of whatâ€™s possible. Download Now

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!