Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Apply color to a drafting note 1

Status
Not open for further replies.

AdrielValdez

Aerospace
Joined
Mar 27, 2023
Messages
3
Location
MX
I am programming a journal that must find a note in a draft and apply a color, I have everything ready except for the color assignment. I am using this draftingNoteBuilder1.Style.LetteringStyle.GeneralTextColor = workPart.Colors.Find("Pale Sky") but in different versions of NX apparently does not find that color name and gives me errors, so I would like to know if there is a way to apply color using the ID of the color and not the name, or even better apply color using RGB.

Thank you.
 
If you know the integer index value of the color you want to use, you can pass it to the .Find method. For instance, if you want to use color 211, you could use .Colors.Find(211).

NX has a limited color palette (216 colors) and you cannot assign colors to objects by RGB values. However, if you have RGB values, you can use the .AskClosestColor method to find the closest match in the NX part file's color definition file (CDF). A journal that makes use of the function can be found here:

www.nxjournaling.com
 
Thank you Cowski, it works just replacing the color name with the id!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top