Override Label Text Color

Split from Camber Feedback Thread:

Hey Zachri,

Is it possible to add the color override property to the “LabelStyleComponent” section for “ReferenceText”? Or, do you know if there is a way to specify text override color setting by string?

I believe these components are "LabelGroupSubEntity"s. Do we have to collect the text contained and set an override within the properties of that entity somehow? →
https://help.autodesk.com/view/CIV3D/2022/ENU/?guid=9078bd07-1e44-3eed-b744-381d1602f534


1 Like

@WrightEngineering unfortunately all of those text formatting settings cannot be set through the API :confused:

Maybe…what is your ultimate goal?

1 Like

I have different label styles depending on curb height. I didn’t want to make a child style for each one to say “EX TC/EX BC” instead of “TC/BC”. My thought was to keep label styles to a minimum and use dynamo to quickly batch set text overrides. Camber works great to replace “TC/BC with EX TC/EX BC”. But if I were to do the text override manually I would also typically change the color to a faded ctb color if its an existing elevation callout. I’m trying to keep styles to a minimum because I actually generate the station/offset/elevation labels using a dynamo script as well and the workflow would become much more complicated if I added child styles. But perhaps making child styles and using dynamo to change the style after the fact would probably be the best way to go.

Gotcha. Instead of one style for everything, could you break in down into two styles (one for proposed, one for existing) with the necessary color settings, then override the text contents from there?

1 Like

Yeah, I think two different styles for each curb height is the best way to go. (Existing and Proposed). Problem is it’s kind of a pain to go to the many different styles and change them manually. Thinking the best way to go is:

select labels → existing label style names → (existing label style names) + (“-EX”) → labels set styles.

Unfortunately the “CivilObject.Style” and CivilObject.SetStyle" nodes don’t seem too work on "AlignmentStationOffsetLabel"s so I can’t seem to find a way to update label styles.

This probably belong on it’s own thread, “Changing label styles by name” or something. :sweat_smile:

The contents of a Label is MText. You can enter control codes in the text to set the color:

Results in:

It is very basic, not every control character of a MText is accepted. If you read the contents of a real MText, it shows more:

This {\C114;\c4758291;is} a {\C240;\c2367469;colored} text

But pasting this in the Code Block, the semicolon becomes a paragraph break. The second ‘\c’ with the long number seems to be RGB, the first is ACI. After some trial and error just the ACI without semicolon is accepted, and of course an escaped backslash. So if you wrap your contents in curly braces and an ACI color, you can control the whole label.

6 Likes

This is exactly what I was looking for/thinking of!! Awesome! Thank you.

1 Like

Another option is to set thecolor of the text component to ByBlock, then it will take over the color you set to the Label object.

1 Like

Good stuff, Anton!

1 Like